summaryrefslogtreecommitdiff
path: root/ansible/roles/git
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-08-13 16:35:47 +0100
committerJoe Carstairs <me@joeac.net>2026-08-13 16:35:47 +0100
commit9f2ebc2cce3af0e685677c23f2098c115e034adf (patch)
treebc6609cf851ee3f0a4f572d762b4ea35a34610f6 /ansible/roles/git
parentf31e65c51681823ade14abad87c742101a1b823d (diff)
move ansible/ dir to root
Diffstat (limited to 'ansible/roles/git')
-rw-r--r--ansible/roles/git/files/.gitconfig3
-rw-r--r--ansible/roles/git/files/cgitrc8
-rw-r--r--ansible/roles/git/tasks/main.yml153
-rw-r--r--ansible/roles/git/templates/conf.d/fcgiwrap3
-rw-r--r--ansible/roles/git/templates/conf.d/git-daemon3
-rw-r--r--ansible/roles/git/templates/nginx/cgit.conf17
6 files changed, 0 insertions, 187 deletions
diff --git a/ansible/roles/git/files/.gitconfig b/ansible/roles/git/files/.gitconfig
deleted file mode 100644
index 78fdfcf..0000000
--- a/ansible/roles/git/files/.gitconfig
+++ /dev/null
@@ -1,3 +0,0 @@
-[safe]
- directory = /srv/git/*
- directory = /media/seagate/git/*
diff --git a/ansible/roles/git/files/cgitrc b/ansible/roles/git/files/cgitrc
deleted file mode 100644
index 9d9d99c..0000000
--- a/ansible/roles/git/files/cgitrc
+++ /dev/null
@@ -1,8 +0,0 @@
-root-title=joeac's git repositories
-root-desc=
-strict-export=git-daemon-export-ok
-scan-path=/srv/git
-virtual-root=/
-about-filter=/usr/lib/cgit/filters/about-formatting.sh
-readme=:README.md
-snapshots=tar.gz zip
diff --git a/ansible/roles/git/tasks/main.yml b/ansible/roles/git/tasks/main.yml
deleted file mode 100644
index a676d0b..0000000
--- a/ansible/roles/git/tasks/main.yml
+++ /dev/null
@@ -1,153 +0,0 @@
-- name: Install cgit, fcgiwrap, git, nginx, and shadow
- community.general.apk:
- name:
- - cgit
- - fcgiwrap
- - git
- - nginx
- - shadow
-
-- name: Add git group
- ansible.builtin.group:
- name: git
-
-- name: Add git user
- ansible.builtin.user:
- name: git
- group: git
-
-- name: Find existing shells
- register: existing_shells
- changed_when: false
- ansible.builtin.command: cat /etc/shells
-
-- name: Add git-shell to /etc/shells
- when: "'/git-shell' not in existing_shells.stdout"
- ansible.builtin.shell: which git-shell >> /etc/shells
-
-- name: Find current git login shell
- register: current_git_login_shell
- ansible.builtin.shell: "cat /etc/passwd | grep ^git: | grep -o [^:]*$"
-
-- name: Set git login shell to git-shell
- when: "'git-shell' not in current_git_login_shell"
- ansible.builtin.shell: chsh -s $(which git-shell) git
-
-- name: Create fcgiwrap user and append 'git' group
- ansible.builtin.user:
- name: "{{ fcgiwrap_user }}"
- group: "{{ fcgiwrap_group }}"
- groups:
- - git
- append: true
-
-- name: Create git directory in attached storage
- ansible.builtin.file:
- path: /media/seagate/git
- state: directory
- owner: git
- group: git
- mode: "750"
-
-- name: Symlink git directory to /srv/git
- ansible.builtin.file:
- src: /media/seagate/git
- dest: /srv/git
- owner: git
- group: git
- state: link
- mode: "750"
-
-- name: Configure fcgiwrap daemon
- register: fcgiwrap_conf
- ansible.builtin.template:
- src: conf.d/fcgiwrap
- dest: /etc/conf.d/fcgiwrap
- mode: "644"
-
-- name: Restart fcgiwrap daemon and configure to start on boot
- when: fcgiwrap_conf is changed
- ansible.builtin.service:
- name: fcgiwrap
- enabled: true
- state: restarted
-
-- name: Start fcgiwrap daemon and configure to start on boot
- when: not ( fcgiwrap_conf is changed )
- ansible.builtin.service:
- name: fcgiwrap
- enabled: true
- state: started
-
-- name: Remove default nginx site config
- register: default_nginx_site
- ansible.builtin.file:
- path: /etc/nginx/http.d/default.conf
- state: absent
-
-- name: Install cgit nginx site config
- register: cgit_nginx_site
- ansible.builtin.template:
- src: nginx/cgit.conf
- dest: /etc/nginx/http.d/cgit.conf
- owner: nginx
- group: nginx
- mode: "660"
-
-- name: Restart nginx daemon and configure to start on boot
- when: default_nginx_site is changed or cgit_nginx_site is changed
- ansible.builtin.service:
- name: nginx
- enabled: true
- state: restarted
-
-- name: Start nginx daemon and configure to start on boot
- when: not ( default_nginx_site is changed or cgit_nginx_site is changed )
- ansible.builtin.service:
- name: nginx
- enabled: true
- state: started
-
-- name: Install cgit config
- ansible.builtin.copy:
- src: cgitrc
- dest: /etc/cgitrc
- mode: "+r"
-
-- name: Install git daemon
- community.general.apk:
- name: git-daemon-openrc
-
-- name: Configure git daemon
- register: gitd_conf
- ansible.builtin.template:
- src: conf.d/git-daemon
- dest: /etc/conf.d/git-daemon
-
-- name: Create gitd user
- ansible.builtin.user:
- name: gitd
- group: git
-
-- name: Mark git directory safe for gitd git operations
- register: gitd_gitconfig
- ansible.builtin.copy:
- src: .gitconfig
- dest: ~gitd/.gitconfig
- owner: gitd
- group: git
- mode: "644"
-
-- name: Restart git daemon and configure to start on boot
- when: gitd_conf is changed or gitd_gitconfig is changed
- ansible.builtin.service:
- name: git-daemon
- enabled: true
- state: restarted
-
-- name: Start git daemon and configure to start on boot
- when: not ( gitd_conf is changed or gitd_gitconfig is changed )
- ansible.builtin.service:
- name: git-daemon
- enabled: true
- state: started
diff --git a/ansible/roles/git/templates/conf.d/fcgiwrap b/ansible/roles/git/templates/conf.d/fcgiwrap
deleted file mode 100644
index 65a40e8..0000000
--- a/ansible/roles/git/templates/conf.d/fcgiwrap
+++ /dev/null
@@ -1,3 +0,0 @@
-socket=unix:{{ fcgiwrap_socket }}
-user={{ fcgiwrap_user }}
-group={{ fcgiwrap_group }}
diff --git a/ansible/roles/git/templates/conf.d/git-daemon b/ansible/roles/git/templates/conf.d/git-daemon
deleted file mode 100644
index c50b66b..0000000
--- a/ansible/roles/git/templates/conf.d/git-daemon
+++ /dev/null
@@ -1,3 +0,0 @@
-GITDAEMON_OPTS="--syslog --base-path=/srv/git"
-GIT_USER="gitd"
-GIT_GROUP="git"
diff --git a/ansible/roles/git/templates/nginx/cgit.conf b/ansible/roles/git/templates/nginx/cgit.conf
deleted file mode 100644
index 456173b..0000000
--- a/ansible/roles/git/templates/nginx/cgit.conf
+++ /dev/null
@@ -1,17 +0,0 @@
-server {
- listen {{ services.git.port }};
- listen [::]:{{ services.git.port }};
- server_name {{ ( subdomains | selectattr('service', 'eq', 'git') | first ).full_domain }};
-
- root /usr/share/webapps/cgit;
- try_files $uri @cgit;
-
- location @cgit {
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi;
- fastcgi_param PATH_INFO $uri;
- fastcgi_param QUERY_STRING $args;
- fastcgi_param HTTP_HOST $server_name;
- fastcgi_pass unix:/run/fcgiwrap/fcgiwrap.sock;
- }
-}