-
Notifications
You must be signed in to change notification settings - Fork 2
/
linux.yaml
278 lines (265 loc) · 6.62 KB
/
linux.yaml
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
---
# Setup - Groups
# Main - Common
- hosts: all:!pfsense
tasks:
# Install packages
- name: install common packages
package:
name: "{{ item.name }}"
state: present
with_items: "{{ common_packages }}"
tags: packages
- hosts: raspberry_pi:&ubuntu
tasks:
# Install packages
- name: install rasberry pi ubuntu packages
package:
name: "{{ item.name }}"
state: present
with_items: "{{ raspberry_pi_ubuntu_packages }}"
tags: packages
- name: remove default "ubuntu" user
user:
name: ubuntu
remove: yes
state: absent
- name: remove default "ubuntu" group
group:
name: ubuntu
state: absent
# Main - Standard Linux
- hosts: linux
roles:
# Install any available package updates
- role: robertdebock.update
vars:
update_reboot: no
tags:
- updates
- setup
# Reboot if necessary
- role: robertdebock.reboot
tags:
- updates
- setup
# Set up main user
- role: exterrestris.ansible_users
vars:
users:
- "{{ main_user }}"
tags:
- users
# Install/configure ZSH
- role: viasite-ansible.zsh
vars:
zsh_user: "{{ main_user.username }}"
tags: zsh
# Run ssh-agent automatically on login
- role: ssh_agent
vars:
user: "{{ main_user.username }}"
ssh_agent_source_files:
- '.bashrc'
- '.zshrc.local.pre-p10k'
ssh_agent_keys:
- ~/.ssh/id_ed25519
# Configure firewall
- role: weareinteractive.ufw
vars:
ufw_rules: "{{ common_ufw_rules }}"
tags: firewall
tasks:
# Install ZSH Powerlevel10k config
- name: copy p10k config
copy:
src: "p10k.zsh"
dest: "/home/{{ main_user.username }}/.p10k.zsh"
owner: "{{ main_user.username }}"
group: "{{ main_user.username }}"
mode: '0644'
tags: zsh
# Main - Groups
- hosts: proxmox
roles:
# Remove Proxmox 'unregisted' nag
- role: ironicbadger.ansible_role_proxmox_nag_removal
tags: proxmox
# Disable cluster services to prevent SSD wear
- role: proxmox_host
tags: proxmox
# Install SSL certificate
- role: exterrestris.proxmox_ssl
tags: ssl
tasks:
- name: install additional packages
package:
name: "{{ item.name }}"
state: present
with_items: "{{ proxmox_additional_packages }}"
tags: packages
- hosts: proxmox_vm:&linux
roles:
# Install qemu-guest-agent
- role: proxmox_vm
- hosts: zfs
roles:
# Install/configure ZFS pools
- role: mrlesmithjr.zfs
tags:
- disks
- zfs
# Install/configure ZFS snapshots/replication using Sanoid
- role: exterrestris.sanoid
tags:
- sanoid
- zfs
tasks:
- name: install additional packages
package:
name: "{{ item.name }}"
state: present
with_items: "{{ zfs_additional_packages }}"
tags: packages
- hosts: nas
roles:
# Set up groups needed for file permissions
- role: exterrestris.ansible_users
vars:
users: "{{ nas_additional_users }}"
groups_to_create: "{{ nas_common_groups + nas_additional_groups }}"
tags:
- users
# Mount ext4 disks
- role: mount_disks
# Install/configure mergerfs
- role: tigattack.mergerfs
tags:
- disks
- mergerfs
tasks:
# Add main user to groups created
- name: additional groups for main user
user:
name: "{{ main_user.username }}"
groups: "{{ nas_common_groups | map(attribute='name') }}"
append: yes
tags:
- users
# Install packages
- name: install common nas packages
package:
name: "{{ item.name }}"
state: present
with_items: "{{ nas_common_packages }}"
tags: packages
- hosts: traefik:!docker
roles:
# Install Traefik
- role: exterrestris.traefik
# Configure firewall
- role: weareinteractive.ufw
vars:
ufw_rules:
- "{{ traefik_ufw_rules }}"
tags:
- firewall
- traefik-firewall
# Install SSL certificate
- role: exterrestris.fetch_ssl
tags:
- traefik-ssl
- ssl
tags:
- traefik
- hosts: docker:!raspberry_pi
roles:
# Install Docker (x64)
- role: geerlingguy.docker
when: "'raspberry_pi' not in group_names"
# Install Docker/Docker Compose PIP packages (needed for Ansible to control Docker)
# - role: geerlingguy.pip
# vars:
# pip_install_packages:
# - name: docker
# - name: docker-compose
tags:
- docker
- docker-install
- hosts: docker:&raspberry_pi
roles:
# # Install PIP
# - role: geerlingguy.pip
# vars:
# pip_install_packages:
# - name: docker
# # geerlingguy.docker_arm will install docker-compose pip package
# Install Docker (arm)
- role: geerlingguy.docker_arm
when: "'raspberry_pi' in group_names"
tags: docker-install
- hosts: docker
roles:
# Set up users specific to containers
- role: exterrestris.ansible_users
vars:
users: "{{ container_users | map('combine', container_user_opts) }}"
tags:
- container-users
# Install Traefik
- role: exterrestris.traefik
tags:
- traefik
when: "'traefik' in group_names"
# Configure firewall
- role: weareinteractive.ufw
vars:
ufw_rules:
- "{{ traefik_ufw_rules }}"
- "{{ docker_ufw_rules }}"
tags:
- firewall
- docker-firewall
# Install SSL certificate
- role: exterrestris.fetch_ssl
tags:
- traefik
- traefik-ssl
- ssl
when: "'traefik' in group_names"
# Generate Docker Compose
- role: exterrestris.docker_compose
tags:
- docker-compose
- role: linuxserver_containers
tags:
- docker-compose
tags:
- docker
- hosts: nas
roles:
# Install/configure Samba shares/users
- role: vladgh.samba.server
tags:
- samba
# Configure firewall
- role: weareinteractive.ufw
vars:
ufw_rules: "{{ nas_ufw_rules }}"
tags: firewall
# Set up WSDD for network discovery
- role: exterrestris.wsdd
tags:
- wsdd
- samba
# Main - Host Specific
- hosts: memory_alpha
tasks:
# Add 'Scans' role to main user
- name: additional groups for main user
user:
name: "{{ main_user.username }}"
groups: "{{ scans_user.group }}"
append: yes
tags:
- users