summaryrefslogtreecommitdiff
path: root/roles/git-daemon/tasks/main.yml
blob: 6b0724c28e1bc2181e1df93cf7549a51b5ca61c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
- 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 }}/*"

- name: Install script to update git-daemon
  ansible.builtin.copy:
    src: update_git-daemon
    dest: /usr/bin/update_git-daemon
    mode: "755"

- name: Install daily crontab to update git-daemon
  ansible.builtin.cron:
    special_time: daily
    name: Update git-daemon
    job: /usr/bin/update_git-daemon