summaryrefslogtreecommitdiff
path: root/roles/git-daemon/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/git-daemon/tasks/main.yml')
-rw-r--r--roles/git-daemon/tasks/main.yml35
1 files changed, 35 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 }}/*"