summaryrefslogtreecommitdiff
path: root/roles/gitolite/http/tasks/main.yml
blob: afd3dd8d12032dadc5785338b97b47a4ec27aae0 (plain) (blame)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
- name: install cgit and fcgiwrap
  apt:
    name:
    - cgit
    - python3-pygments
    - fcgiwrap
    state: present

### TODO: this might break stuff..
- name: mask default fcgiwrap systemd units
  loop:
  - socket
  - service
  systemd:
    name: "fcgiwrap.{{ item }}"
    state: stopped
    masked: yes

- name: install fcgiwrap systemd units
  loop: "{{ gitolite_instances | dict2items | selectattr('value.http', 'defined') | product(['socket', 'service']) }}"
  loop_control:
    label: "{{ item.0.key }}.{{ item.1 }}"
  template:
    src: "fcgiwrap.{{ item.1 }}.j2"
    dest: "/etc/systemd/system/fcgiwrap-gitolite-{{ item.0.key }}.{{ item.1 }}"

- name: make sure fcgiwrap systemd socket unit is enabled and started
  loop: "{{ gitolite_instances | dict2items | selectattr('value.http', 'defined') }}"
  loop_control:
    label: "{{ item.key }}"
  systemd:
    daemon_reload: yes
    name: "fcgiwrap-gitolite-{{ item.key }}.socket"
    state: started
    enabled: yes

- name: generate cgitrc
  loop: "{{ gitolite_instances | dict2items | selectattr('value.http', 'defined') }}"
  loop_control:
    label: "{{ item.key }}"
  template:
    src: cgitrc.j2
    dest: "{{ gitolite_base_path }}/{{ item.key }}/cgitrc"

- name: create base directory for custom logos
  when: (gitolite_instances | dict2items | selectattr('value.http.logo', 'defined') | length) > 0
  file:
    path: /usr/local/share/cgit
    state: directory

- name: copy logo file
  loop: "{{ gitolite_instances | dict2items | selectattr('value.http.logo', 'defined') }}"
  loop_control:
    label: "{{ item.key }}"
  copy:
    src: "{{ item.value.http.logo }}"
    dest: "/usr/local/share/cgit/{{ item.key }}.png"

- name: install nginx vhost
  loop: "{{ gitolite_instances | dict2items | selectattr('value.http', 'defined') }}"
  loop_control:
    loop_var: gitolite_instance
    label: "{{ gitolite_instance.key }}"
  include_tasks: nginx-vhost.yml