diff options
| author | Joe Carstairs <me@joeac.net> | 2026-08-26 10:27:32 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2026-08-26 10:27:32 +0100 |
| commit | 690f218cbdf89327408ea75f2d21fde257a29411 (patch) | |
| tree | c0d695883f761afe8f1b0f0c90bdf73309cc1e5a /roles/git | |
| parent | 9ec180130f0085340f3a6f2828b2f49d558a2548 (diff) | |
refactor git into cgit, git-daemon and git-http-backend
Diffstat (limited to 'roles/git')
| -rw-r--r-- | roles/git/files/.gitconfig | 3 | ||||
| -rw-r--r-- | roles/git/files/cgitrc | 9 | ||||
| -rw-r--r-- | roles/git/files/htpasswd | 9 | ||||
| -rw-r--r-- | roles/git/tasks/main.yml | 122 | ||||
| -rw-r--r-- | roles/git/templates/conf.d/git-daemon | 3 | ||||
| -rw-r--r-- | roles/git/templates/nginx/git.joeac.net.conf | 42 |
6 files changed, 0 insertions, 188 deletions
diff --git a/roles/git/files/.gitconfig b/roles/git/files/.gitconfig deleted file mode 100644 index 78fdfcf..0000000 --- a/roles/git/files/.gitconfig +++ /dev/null @@ -1,3 +0,0 @@ -[safe] - directory = /srv/git/* - directory = /media/seagate/git/* diff --git a/roles/git/files/cgitrc b/roles/git/files/cgitrc deleted file mode 100644 index 3b6d9c8..0000000 --- a/roles/git/files/cgitrc +++ /dev/null @@ -1,9 +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 -clone-prefix=git://git.joeac.net https://git.joeac.net diff --git a/roles/git/files/htpasswd b/roles/git/files/htpasswd deleted file mode 100644 index a32d3e2..0000000 --- a/roles/git/files/htpasswd +++ /dev/null @@ -1,9 +0,0 @@ -$ANSIBLE_VAULT;1.2;AES256;ansible -35346161393133303561303166386236386666346531643864393063383437626565366331353061 -3761366332303239353638613938356662306565346439380a613738376436353563326335393064 -64626337336238313164636437643566383136383830623636363036663762356462663465636166 -3666323734343835660a643566636532386630346138396331373266623031616535353266396563 -33643936633234623136616436646536356661343132356562656462616334316233353161323831 -61346232326235393839393431623532383164393430363663646630343132653266613537613736 -65393332663232316131386561346464373961313062303132396330353839663761613635666231 -66306431656336376334 diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml deleted file mode 100644 index da4bbf2..0000000 --- a/roles/git/tasks/main.yml +++ /dev/null @@ -1,122 +0,0 @@ -- name: Install cgit, git, and shadow - community.general.apk: - name: - - cgit - - git - - shadow - -- name: Add git group - ansible.builtin.group: - name: git - -- name: Append 'git' group to nginx user - ansible.builtin.user: - name: nginx - groups: - - git - append: true - -- name: Create git directory in attached storage - ansible.builtin.file: - path: /media/seagate/git - state: directory - owner: nginx - group: git - mode: "750" - -- name: Set owners recursively in git directory in attached storage - ansible.builtin.file: - path: /media/seagate/git - state: directory - owner: nginx - group: git - recurse: true - -- name: Symlink git directory to /srv/git - ansible.builtin.file: - src: /media/seagate/git - dest: /srv/git - owner: nginx - group: git - state: link - mode: "750" - -- name: Install htpasswd file - ansible.builtin.copy: - src: htpasswd - dest: /etc/nginx/.htpasswd - owner: nginx - group: nginx - mode: "400" - -- name: Install git.joeac.net nginx site config - register: cgit_nginx_site - vars: - fcgiwrap_socket: /run/fcgiwrap.sock - ansible.builtin.template: - src: nginx/git.joeac.net.conf - dest: /etc/nginx/http.d/git.joeac.net.conf - owner: nginx - group: nginx - mode: "660" - -- name: Create git.joeac.net nginx log directory - ansible.builtin.file: - path: /var/log/nginx/git.joeac.net - state: directory - -- name: Restart nginx daemon and configure to start on boot - when: 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 ( 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 /srv/git/* safe in system-wide git config - register: gitconfig - community.general.git_config: - name: safe.directory - add_mode: add - value: /srv/git/* - -- name: Restart git daemon and configure to start on boot - when: gitd_conf 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 ) - ansible.builtin.service: - name: git-daemon - enabled: true - state: started diff --git a/roles/git/templates/conf.d/git-daemon b/roles/git/templates/conf.d/git-daemon deleted file mode 100644 index c50b66b..0000000 --- a/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/roles/git/templates/nginx/git.joeac.net.conf b/roles/git/templates/nginx/git.joeac.net.conf deleted file mode 100644 index e09a655..0000000 --- a/roles/git/templates/nginx/git.joeac.net.conf +++ /dev/null @@ -1,42 +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; - - access_log /var/log/nginx/git.joeac.net/access.log; - error_log /var/log/nginx/git.joeac.net/error.log; - - location ~ /(.+)/(HEAD|info/refs|objects|git-upload-pack|git-receive-pack) { - if (-f /srv/git/$1/git-daemon-export-ok) { - set $auth_basic "private-write repository"; - } - if (!-f /srv/git/$1/git-daemon-export-ok) { - set $auth_basic "private repository"; - } - if ($arg_service != git-receive-pack) { - set $auth_basic off; - } - auth_basic $auth_basic; - auth_basic_user_file .htpasswd; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend; - fastcgi_param PATH_INFO $uri; - fastcgi_param GIT_PROJECT_ROOT /srv/git; - fastcgi_param GIT_HTTP_EXPORT_ALL 1; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param HOME /srv/git; - fastcgi_pass unix:{{ fcgiwrap_socket }}; - } - - 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:{{ fcgiwrap_socket }}; - } -} |
