summaryrefslogtreecommitdiff
path: root/roles/git-http-backend/tasks/main.yml
blob: 9dccf601b4f2e47fd04eec6697022bbf339eb667 (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
- name: Install git
  community.general.apk:
    name: git

- name: Create git.joeac.net nginx include directory
  ansible.builtin.file:
    path: "{{ git_nginx_include_directory }}"
    state: directory
    owner: nginx
    group: nginx

- name: Install htpasswd file
  ansible.builtin.copy:
    src: htpasswd
    dest: /etc/nginx/.htpasswd
    owner: "{{ git_readwrite_user }}"
    group: "{{ git_readwrite_group }}"
    mode: "400"

- name: Install git-http-backend nginx directives
  register: nginx_conf
  vars:
    fcgiwrap_socket: /run/fcgiwrap.sock
  ansible.builtin.template:
    src: git-http-backend.conf
    dest: "{{ git_nginx_include_directory }}/git-http-backend.conf"
    owner: "{{ git_readwrite_user }}"
    group: "{{ git_readwrite_group }}"
    mode: "660"

- name: Restart nginx service if config changed
  when: nginx_conf is changed
  ansible.builtin.service:
    name: nginx
    state: restarted

- name: Mark git directory safe in system-wide git config
  community.general.git_config:
    name: safe.directory
    add_mode: add
    value: "{{ git_directory }}/*"