summaryrefslogtreecommitdiffstats
path: root/roles/cgit/tasks/main.yml
blob: c5eeea3b6ead6d14184ffac40453a81030acd367 (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
---
- name: "Install packages"
  become: true
  ansible.builtin.package:
    name:
      - cgit
      - lighttpd
      - openssh
    state: present

- name: "Create git group"
  become: true
  ansible.builtin.group:
    name: "{{ cgit_ssh_user }}"
    system: true

- name: "Create git user"
  become: true
  ansible.builtin.user:
    name: "{{ cgit_ssh_user }}"
    group: "{{ cgit_ssh_user }}"
    shell: "/usr/bin/git-shell"
    home: "{{ cgit_repos_dir }}"
    create_home: true
    system: true

- name: "Create repos directory"
  become: true
  ansible.builtin.file:
    path: "{{ cgit_repos_dir }}"
    state: directory
    owner: "{{ cgit_ssh_user }}"
    group: "{{ cgit_ssh_user }}"
    mode: "0755"

- name: "Deploy cgitrc"
  become: true
  ansible.builtin.template:
    src: "cgitrc.j2"
    dest: "/etc/cgitrc"
    owner: "root"
    group: "root"
    mode: "0644"

- name: "Deploy lighttpd config"
  become: true
  ansible.builtin.template:
    src: "cgit.lighttpd.conf.j2"
    dest: "/etc/lighttpd/lighttpd.conf"
    owner: "root"
    group: "root"
    mode: "0644"
  notify: "Restart lighttpd"

- name: "Enable and start services"
  become: true
  ansible.builtin.service:
    name: "{{ item }}"
    enabled: true
    state: started
  loop:
    - lighttpd
    - sshd