aboutsummaryrefslogtreecommitdiffstats
path: root/roles/cgit/tasks/main.yml
blob: ce9ecbecf4776ab624ed9c8e3220d4b631d49b6a (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
66
67
68
69
70
71
72
73
74
75
76
77
---

- name: install cgit packages
  ansible.builtin.package:
    name:
      - cgit
      - lowdown
    state: present

- name: create cgit cache directory
  ansible.builtin.file:
    path: "{{ cgit_chroot_dir }}/{{ cgit_cache_dir }}"
    owner: "{{ cgit_user }}"
    group: "{{ cgit_group }}"
    mode: "0750"
    state: directory

- name: generate cgit configuration files
  ansible.builtin.template:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    owner: 0
    group: 0
    mode: "0644"
  loop:
    - src: cgitrc.j2
      dest: "{{ cgit_chroot_dir }}/conf/cgitrc"
    - src: footer.html.j2
      dest: "{{ cgit_chroot_dir }}/conf/footer.html"
    - src: httpd.conf.j2
      dest: /etc/httpd.d/cgit.conf

- name: retrieve dependencies for lowdown
  ansible.builtin.shell: |
    set -o pipefail
    ldd $(command -v lowdown) | tr -s " " | grep "0 1 0" | cut -d " " -f 7
  register: cgit_result_lowdown_dependencies
  changed_when: false

- name: create dependencies directories in chroot
  ansible.builtin.file:
    path: "{{ cgit_chroot_dir }}{{ item | dirname }}"
    owner: 0
    group: 0
    mode: "0755"
    state: directory
  loop: "{{ cgit_result_lowdown_dependencies.stdout_lines }}"

- name: copy dependencies for lowdown
  ansible.builtin.copy:
    src: "{{ item }}"
    dest: "{{ cgit_chroot_dir }}/{{ item }}"
    mode: preserve
    remote_src: true
  loop: "{{ cgit_result_lowdown_dependencies.stdout_lines }}"

- name: copy utilities in httpd chroot
  ansible.builtin.copy:
    src: "{{ item }}"
    dest: "{{ cgit_chroot_dir }}/bin"
    mode: preserve
    remote_src: true
  loop: "{{ cgit_chroot_required_files }}"

- name: copy about-filter generator
  ansible.builtin.copy:
    src: about-filter.sh
    dest: "{{ cgit_chroot_dir }}/bin/about-filter.sh"
    owner: 0
    group: 0
    mode: "0755"

- name: start and enable slowcgi service
  ansible.builtin.service:
    name: slowcgi
    state: restarted
    enabled: true
remember that computers suck.