aboutsummaryrefslogtreecommitdiffstats
path: root/roles/jails/22_forge/tasks/main.yml
blob: 4fd426dd3602a437cb2685015b74c56e66024fcc (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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
- import_role:
    name: jail
    tasks_from: jail_setup

- name: Create git group
  group:
    name: git
    gid: 1000

- name: Create git user
  user:
    name: git
    uid: 1000
    group: git
    home: /home/git
    shell: /usr/local/bin/git-shell
    comment: "Git Server"
    create_home: false

- name: Deploy gitconfig for git user
  copy:
    content: |
      [init]
          defaultBranch = main
    dest: /home/git/.gitconfig
    owner: git
    group: git
    mode: "0644"

- name: Create /usr/local/etc/git directory
  file:
    path: /usr/local/etc/git
    state: directory
    owner: root
    group: wheel
    mode: "0755"

- name: Deploy gitconfig for www user (safe.directory for cgit/fcgiwrap)
  copy:
    content: |
      [safe]
          directory = *
    dest: /usr/local/etc/git/gitconfig-www
    owner: root
    group: wheel
    mode: "0644"

- name: Create git .ssh directory
  file:
    path: /home/git/.ssh
    state: directory
    owner: git
    group: git
    mode: "0700"

- name: Deploy authorized_keys
  copy:
    content: "{{ forge_authorized_keys }}\n"
    dest: /home/git/.ssh/authorized_keys
    owner: git
    group: git
    mode: "0600"

- name: Create git-shell-commands directory
  file:
    path: /home/git/git-shell-commands
    state: directory
    owner: git
    group: git
    mode: "0755"

- name: Deploy git-shell-commands
  copy:
    src: "{{ jail_role_dir }}/files/git-shell-commands/{{ item }}"
    dest: "/home/git/git-shell-commands/{{ item }}"
    owner: git
    group: git
    mode: "0755"
  loop:
    - help
    - new
    - ls
    - delete
    - rename
    - describe

- name: Create /usr/local/etc/cgit directory
  file:
    path: /usr/local/etc/cgit
    state: directory
    owner: root
    group: wheel
    mode: "0755"

- name: Deploy cgit head-include
  copy:
    src: "{{ jail_role_dir }}/files/head-include.html"
    dest: /usr/local/etc/cgit/head-include.html
    owner: root
    group: wheel
    mode: "0644"

- name: Deploy custom cgit.css
  copy:
    src: "{{ jail_role_dir }}/files/cgit.css"
    dest: /usr/local/www/cgit/cgit.css
    owner: root
    group: wheel
    mode: "0644"

- name: Deploy syntax-highlighting filter
  copy:
    src: "{{ jail_role_dir }}/files/syntax-highlighting.sh"
    dest: /usr/local/lib/cgit/filters/syntax-highlighting.sh
    owner: root
    group: wheel
    mode: "0755"

- name: Deploy custom md2html filter
  copy:
    src: "{{ jail_role_dir }}/files/md2html"
    dest: /usr/local/lib/cgit/filters/html-converters/md2html
    owner: root
    group: wheel
    mode: "0755"

- name: Deploy custom about-formatting filter
  copy:
    src: "{{ jail_role_dir }}/files/about-formatting.sh"
    dest: /usr/local/lib/cgit/filters/about-formatting.sh
    owner: root
    group: wheel
    mode: "0755"

- name: Deploy nginx config
  template:
    src: "{{ jail_role_dir }}/templates/usr_local_etc_nginx_nginx.conf.j2"
    dest: /usr/local/etc/nginx/nginx.conf
    owner: root
    group: wheel
    mode: "0644"
  notify: Reload nginx

- name: Deploy cgitrc
  template:
    src: "{{ jail_role_dir }}/templates/usr_local_etc_cgitrc.j2"
    dest: /usr/local/etc/cgitrc
    owner: root
    group: wheel
    mode: "0644"

- name: Deploy sshd_config
  template:
    src: "{{ jail_role_dir }}/templates/etc_ssh_sshd_config.j2"
    dest: /etc/ssh/sshd_config
    owner: root
    group: wheel
    mode: "0644"
  notify: Restart sshd

- import_role:
    name: jail
    tasks_from: jail_launch