diff options
Diffstat (limited to 'roles/git/tasks/main.yml')
| -rw-r--r-- | roles/git/tasks/main.yml | 77 |
1 files changed, 37 insertions, 40 deletions
diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index 67083f7..033400e 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -11,32 +11,9 @@ ansible.builtin.group: name: git -- name: Add git user +- name: Append 'git' group to nginx 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 }}" + name: nginx groups: - git append: true @@ -45,21 +22,33 @@ ansible.builtin.file: path: /media/seagate/git state: directory - owner: git + 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: git + owner: nginx group: git state: link mode: "750" - name: Configure fcgiwrap daemon register: fcgiwrap_conf + vars: + fcgiwrap_socket: /run/fcgiwrap.sock + fcgiwrap_user: nginx + fcgiwrap_group: nginx ansible.builtin.template: src: conf.d/fcgiwrap dest: /etc/conf.d/fcgiwrap @@ -85,11 +74,21 @@ path: /etc/nginx/http.d/default.conf state: absent -- name: Install cgit nginx site config +- 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/cgit.conf - dest: /etc/nginx/http.d/cgit.conf + src: nginx/git.joeac.net.conf + dest: /etc/nginx/http.d/git.joeac.net.conf owner: nginx group: nginx mode: "660" @@ -134,24 +133,22 @@ 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: 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 or gitd_gitconfig is changed + 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 or gitd_gitconfig is changed ) + when: not ( gitd_conf is changed ) ansible.builtin.service: name: git-daemon enabled: true |
