-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.yml
More file actions
176 lines (165 loc) · 5.29 KB
/
Copy pathsetup.yml
File metadata and controls
176 lines (165 loc) · 5.29 KB
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
- name: Deploy Gateway
hosts: gateways
serial: "{{ deploy_serial | default(1) }}"
vars_files:
- group_vars/versions.yml
vars:
users:
- username: root
pre_tasks:
- name: Abort if target OS is not Debian 13
ansible.builtin.assert:
that:
- ansible_facts["distribution"] == "Debian"
- ansible_facts["distribution_major_version"] == "13"
fail_msg: >-
Unsupported target OS: {{ ansible_facts["distribution"] }} {{
ansible_facts["distribution_version"] }}. This playbook supports
Debian 13 only.
success_msg: "Target OS check passed: Debian 13"
tags:
- always
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
roles:
- {role: network, tags: "network"}
- {role: wireguardexit, tags: "wireguard, exit"}
- {role: ffshmon, tags: "wireguard, ffshmon"}
- {role: hostname, tags: "hostname"}
- {role: fail2ban, tags: "fail2ban"}
- {role: batman, tags: "batman-adv"}
- {role: batctl, tags: "batctl"}
- {role: fastd, tags: "fastd"}
- {role: radvd, tags: "radvd"}
- {role: dhcp, tags: "isc-dhcp4-server"}
- {role: bind, tags: "dns"}
- {role: respondd, tags: "respondd"}
- {role: node_exporter, tags: "node_exporter"}
- {role: letsencrypt, tags: "letsencrypt"}
- {role: nginx, tags: "node_exporter, nginx"}
- {role: tools, tags: "admin-tools"}
- {role: motd, tags: "motd"}
- {role: ohmyzsh, tags: "oh-my-zsh"}
- {role: ohmyzshtheme, tags: "oh-my-zsh"}
- {role: ssh, tags: "ssh keys"}
post_tasks:
- name: Check if reboot is required
ansible.builtin.stat:
path: /var/run/reboot-required
register: system_reboot_required
changed_when: false
tags:
- always
- name: Reboot if required
ansible.builtin.reboot:
msg: Reboot triggered by Ansible because /var/run/reboot-required exists.
reboot_timeout: 900
connect_timeout: 10
post_reboot_delay: 15
when:
- system_reboot_required.stat.exists
- not ansible_check_mode
tags:
- always
- name: Services Deployment
hosts: services
serial: "{{ deploy_serial | default(1) }}"
vars_files:
- group_vars/versions.yml
vars:
users:
- username: root
pre_tasks:
- name: Abort if target OS is not Ubuntu 24.04
ansible.builtin.assert:
that:
- ansible_facts["distribution"] == "Ubuntu"
- ansible_facts["distribution_version"] == "24.04"
fail_msg: >-
Unsupported target OS: {{ ansible_facts["distribution"] }} {{
ansible_facts["distribution_version"] }}. This playbook supports
Ubuntu 24.04 only.
success_msg: "Target OS check passed: Ubuntu 24.04"
tags:
- always
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
roles:
- {role: batman, tags: "batman-adv"}
- {role: batctl, tags: "batctl"}
- {role: firmware_release, tags: "firmware-release"}
- {role: firmware_selector, tags: "firmware-selector"}
- {role: meshviewer, tags: "meshviewer"}
post_tasks:
- name: Check if reboot is required
ansible.builtin.stat:
path: /var/run/reboot-required
register: system_reboot_required
changed_when: false
tags:
- always
- name: Reboot if required
ansible.builtin.reboot:
msg: Reboot triggered by Ansible because /var/run/reboot-required exists.
reboot_timeout: 900
connect_timeout: 10
post_reboot_delay: 15
when:
- system_reboot_required.stat.exists
- not ansible_check_mode
tags:
- always
- name: Deploy monitoring
hosts: monitoring
serial: "{{ deploy_serial | default(1) }}"
vars_files:
- group_vars/versions.yml
vars:
users:
- username: root
pre_tasks:
- name: Load monitoring secrets
ansible.builtin.include_vars:
file: group_vars/secrets.yml
name: vault_secrets
# pre_tasks:
# - name: Abort if target OS is not Ubuntu 24.04
# ansible.builtin.assert:
# that:
# - ansible_facts["distribution"] == "Ubuntu"
# - ansible_facts["distribution_version"] == "24.04"
# fail_msg: >-
# Unsupported target OS: {{ ansible_facts["distribution"] }} {{
# ansible_facts["distribution_version"] }}. This playbook supports
# Ubuntu 24.04 only.
# success_msg: "Target OS check passed: Ubuntu 24.04"
# tags:
# - always
# - name: Update apt cache
# ansible.builtin.apt:
# update_cache: true
roles:
- {role: blackbox_exporter, tags: "blackbox-exporter"}
- {role: grafana, tags: "grafana"}
- {role: prometheus, tags: "prometheus"}
post_tasks:
- name: Check if reboot is required
ansible.builtin.stat:
path: /var/run/reboot-required
register: system_reboot_required
changed_when: false
tags:
- always
- name: Reboot if required
ansible.builtin.reboot:
msg: Reboot triggered by Ansible because /var/run/reboot-required exists.
reboot_timeout: 900
connect_timeout: 10
post_reboot_delay: 15
when:
- system_reboot_required.stat.exists
- not ansible_check_mode
tags:
- always