- 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: 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: 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 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 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: 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 /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