diff options
Diffstat (limited to 'roles/git-daemon')
| -rw-r--r-- | roles/git-daemon/tasks/main.yml | 35 | ||||
| -rw-r--r-- | roles/git-daemon/templates/conf.d/git-daemon | 3 |
2 files changed, 38 insertions, 0 deletions
diff --git a/roles/git-daemon/tasks/main.yml b/roles/git-daemon/tasks/main.yml new file mode 100644 index 0000000..5508b1e --- /dev/null +++ b/roles/git-daemon/tasks/main.yml @@ -0,0 +1,35 @@ +- name: Install git daemon + community.general.apk: + name: git-daemon-openrc + +- name: Create read-only git user + ansible.builtin.user: + name: "{{ git_readonly_user }}" + group: "{{ git_readonly_group }}" + +- name: Configure git daemon + register: gitd_conf + ansible.builtin.template: + src: conf.d/git-daemon + dest: /etc/conf.d/git-daemon + +- 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 + +- name: Mark git directory safe in system-wide git config + register: gitconfig + community.general.git_config: + name: safe.directory + add_mode: add + value: "{{ git_directory }}/*" diff --git a/roles/git-daemon/templates/conf.d/git-daemon b/roles/git-daemon/templates/conf.d/git-daemon new file mode 100644 index 0000000..8a757d1 --- /dev/null +++ b/roles/git-daemon/templates/conf.d/git-daemon @@ -0,0 +1,3 @@ +GITDAEMON_OPTS="--syslog --base-path={{ git_directory }}" +GIT_USER="{{ git_readonly_user }}" +GIT_GROUP="{{ git_readonly_group }}" |
