-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnightmarionne.yml
298 lines (234 loc) · 12.1 KB
/
nightmarionne.yml
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
######################################################################
#
# BSD Boxes
#
######################################################################
- name: Replace old hostname with new hostname (requires Ansible >= 2.4)
replace:
path: /usr/local/etc/pkg/repos/pfSense.conf
regexp: 'enabled: no'
replace: 'enabled: yes'
- name: NIGHTMARIONNE | Install Puppet | BSD
community.general.pkgng:
name: sysutils/puppet7
state: present
- name: NIGHTMARIONNE | Configure Agent Name | BSD
shell: "/opt/puppetlabs/bin/puppet config set certname {{ ansible_all_ipv4_addresses[0] }} --section main"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Configure Agent Name | BSD
shell: "/opt/puppetlabs/bin/puppet config set certname {{ ansible_all_ipv4_addresses[0] }} --section agent"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Configure Server | BSD
shell: "puppet config set server nightmarionne.skillissue.fyi --section main"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Configure Server | BSD
shell: "puppet config set server nightmarionne.skillissue.fyi --section agent"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Configure Server Port | BSD
shell: "puppet config set serverport 443 --section main"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Configure Server Port | BSD
shell: "puppet config set serverport 443 --section agent"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Configure Interval | BSD
shell: "puppet config set runinterval 5m --section main"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Configure Interval | BSD
shell: "puppet config set runinterval 5m --section agent"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Ensure Cache Backup | BSD
shell: "puppet config set usecacheonfailure true --section main"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Ensure Cache Backup | BSD
shell: "puppet config set usecacheonfailure true --section agent"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Start Service | BSD
shell: "puppet ssl bootstrap"
when: ansible_os_family == 'FreeBSD'
- name: NIGHTMARIONNE | Start Service | BSD
shell: "puppet resource service puppet ensure=running enable=true"
when: ansible_os_family == 'FreeBSD'
# - name: Add IP Address to Hosts
# lineinfile:
# dest: "/etc/hosts"
# line: '129.21.49.190 nightmarionne.skillissue.fyi'
# state: present
# when: ansible_os_family == 'FreeBSD'
######################################################################
#
# Windows Boxes
#
######################################################################
- name: NIGHTMARIONNE | Download Puppet Agent | Windows
ansible.builtin.get_url:
url: http://downloads.puppetlabs.com/windows/puppet-agent-x64-latest.msi
dest: "C:\\ProgramData\\puppet.msi"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Install Puppet | Windows
win_command: "msiexec /qn /norestart /i C:\\ProgramData\\puppet.msi"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Configure Agent Name | Windows
win_command: "C:\\Program Files\\Puppet Labs\\Puppet\\bin\\puppet config set certname {{ ansible_all_ipv4_addresses[0] }} --section main"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Configure Agent Name | Windows
win_command: "C:\\Program Files\\Puppet Labs\\Puppet\\bin\\puppet config set certname {{ ansible_all_ipv4_addresses[0] }} --section agent"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Configure Server | Windows
win_command: "C:\\Program Files\\Puppet Labs\\Puppet\\bin\\puppet config set server nightmarionne.skillissue.fyi --section main"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Configure Server | Windows
win_command: "C:\\Program Files\\Puppet Labs\\Puppet\\bin\\puppet config set server nightmarionne.skillissue.fyi --section agent"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Configure Server Port | Windows
win_command: "C:\\Program Files\\Puppet Labs\\Puppet\\bin\\puppet config set serverport 443 --section main"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Configure Server Port | Windows
win_command: "C:\\Program Files\\Puppet Labs\\Puppet\\bin\\puppet config set serverport 443 --section agent"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Configure Interval | Windows
win_command: "C:\\Program Files\\Puppet Labs\\Puppet\\bin\\puppet config set runinterval 5m --section main"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Configure Interval | Windows
win_command: "C:\\Program Files\\Puppet Labs\\Puppet\\bin\\puppet config set runinterval 5m --section agent"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Ensure Cache Backup | Windows
win_command: "C:\\Program Files\\Puppet Labs\\Puppet\\bin\\puppet config set usecacheonfailure true --section main"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Get Certificate | Windows
win_command: "C:\\Program Files\\Puppet Labs\\Puppet\\bin\\puppet ssl bootstrap"
when: ansible_os_family == 'Windows'
- name: NIGHTMARIONNE | Start Service | Windows
ansible.windows.win_service:
name: puppet
start_mode: delayed
state: started
when: ansible_os_family == 'Windows'
# - name: Add IP Address to Hosts
# lineinfile:
# dest: "C:\\Windows\\System32\\drivers\\etc\\hosts"
# line: '129.21.49.190 nightmarionne.skillissue.fyi'
# state: present
# when: ansible_os_family == 'Windows'
######################################################################
#
# Linux Boxes
#
######################################################################
- name: NIGHTMARIONNE | Define Linux Distros
set_facts:
rhel_based: ["RedHat", "CentOS"]
linux_distros: ["RedHat", "CentOS", "Fedora", "Scientific", "CloudLinux", "OracleLinux", "Amazon", "XenServer", "Debian", "Ubuntu", "SUSE", "SLED", "SLES", "Gentoo", "Archlinux", "Mandrake", "Alpine"]
- name: NIGHTMARIONNE | Install Puppet | Debian 11
ansible.builtin.apt:
deb: http://apt.puppet.com/puppet-release-bullseye.deb
when: ansible_os_family == 'Debian' and ansible_distribution_major_version == 11
- name: NIGHTMARIONNE | Install Puppet | Debian 10
ansible.builtin.apt:
deb: http://apt.puppet.com/puppet-release-buster.deb
when: ansible_os_family == 'Debian' and ansible_distribution_major_version == 10
- name: NIGHTMARIONNE | Install Puppet | Debian 9
ansible.builtin.apt:
deb: http://apt.puppet.com/puppet-release-stretch.deb
when: ansible_os_family == 'Debian' and ansible_distribution_major_version == 9
- name: NIGHTMARIONNE | Install Puppet | Ubuntu 22
ansible.builtin.apt:
deb: http://apt.puppet.com/puppet-release-jammy.deb
when: ansible_os_family == 'Ubuntu' and ansible_distribution_major_version == 22
- name: NIGHTMARIONNE | Install Puppet | Ubuntu 20
ansible.builtin.apt:
deb: http://apt.puppet.com/puppet-release-focal.deb
when: ansible_os_family == 'Ubuntu' and ansible_distribution_major_version == 20
- name: NIGHTMARIONNE | Install Puppet | Ubuntu 18
ansible.builtin.apt:
deb: http://apt.puppet.com/puppet-release-bionic.deb
when: ansible_os_family == 'Ubuntu' and ansible_distribution_major_version == 18
- name: NIGHTMARIONNE | Install Puppet | Ubuntu 16
ansible.builtin.apt:
deb: http://apt.puppet.com/puppet-release-xenial.deb
when: ansible_os_family == 'Ubuntu' and ansible_distribution_major_version == 16
- name: NIGHTMARIONNE | Install Puppet | RHEL 9
ansible.builtin.yum:
name: http://yum.puppet.com/puppet-release-el-9.noarch.rpm
when: ansible_os_family in rhel_based and ansible_distribution_major_version == 9
- name: NIGHTMARIONNE | Install Puppet | RHEL 8
ansible.builtin.yum:
name: http://yum.puppet.com/puppet-release-el-8.noarch.rpm
when: ansible_os_family in rhel_based and ansible_distribution_major_version == 9
- name: NIGHTMARIONNE | Install Puppet | RHEL 7
ansible.builtin.yum:
name: http://yum.puppet.com/puppet-release-el-7.noarch.rpm
when: ansible_os_family in rhel_based and ansible_distribution_major_version == 9
- name: NIGHTMARIONNE | Install Puppet | RHEL 6
ansible.builtin.yum:
name: http://yum.puppet.com/puppet-release-el-6.noarch.rpm
when: ansible_os_family in rhel_based and ansible_distribution_major_version == 9
- name: NIGHTMARIONNE | Install Puppet | Fedora 36
ansible.builtin.yum:
name: http://yum.puppet.com/puppet-release-fedora-36.noarch.rpm
when: ansible_os_family == "Fedora" and ansible_distribution_major_version == 36
- name: NIGHTMARIONNE | Install Puppet | Fedora 34
ansible.builtin.yum:
name: http://yum.puppet.com/puppet-release-fedora-34.noarch.rpm
when: ansible_os_family == "Fedora" and ansible_distribution_major_version == 34
- name: NIGHTMARIONNE | Install Puppet | Fedora 32
ansible.builtin.yum:
name: http://yum.puppet.com/puppet-release-fedora-32.noarch.rpm
when: ansible_os_family == "Fedora" and ansible_distribution_major_version == 32
- name: NIGHTMARIONNE | Install Puppet | Fedora 31
ansible.builtin.yum:
name: http://yum.puppet.com/puppet-release-fedora-31.noarch.rpm
when: ansible_os_family == "Fedora" and ansible_distribution_major_version == 31
- name: NIGHTMARIONNE | Install Puppet | Fedora 30
ansible.builtin.yum:
name: http://yum.puppet.com/puppet-release-fedora-30.noarch.rpm
when: ansible_os_family == "Fedora" and ansible_distribution_major_version == 30
- name: NIGHTMARIONNE | Install Puppet Agent | Yum
ansible.builtin.yum:
name: puppet-agent
when: ansible_os_family in rhel_based or ansible_os_family == "Fedora"
- name: NIGHTMARIONNE | Install Puppet Agent | Apt
ansible.builtin.apt:
name: puppet-agent
when: ansible_os_family in ["Debian", "Ubuntu"]
- name: NIGHTMARIONNE | Configure Agent Name | Linux
shell: "/opt/puppetlabs/bin/puppet config set certname {{ ansible_all_ipv4_addresses[0] }} --section main"
when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Configure Agent Name | Linux
shell: "/opt/puppetlabs/bin/puppet config set certname {{ ansible_all_ipv4_addresses[0] }} --section agent"
when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Configure Server | Linux
shell: "/opt/puppetlabs/bin/puppet config set server nightmarionne.skillissue.fyi --section main"
when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Configure Server | Linux
shell: "/opt/puppetlabs/bin/puppet config set server nightmarionne.skillissue.fyi --section agent"
when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Configure Server Port | Linux
shell: "/opt/puppetlabs/bin/puppet config set serverport 443 --section main"
when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Configure Server Port | Linux
shell: "/opt/puppetlabs/bin/puppet config set serverport 443 --section agent"
when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Configure Interval | Linux
shell: "/opt/puppetlabs/bin/puppet config set runinterval 5m --section main"
when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Configure Interval | Linux
shell: "/opt/puppetlabs/bin/puppet config set runinterval 5m --section agent"
when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Ensure Cache Backup | Linux
shell: "/opt/puppetlabs/bin/puppet config set usecacheonfailure true --section main"
when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Ensure Cache Backup | Linux
shell: "/opt/puppetlabs/bin/puppet config set usecacheonfailure true --section agent"
when: ansible_os_family in linux_distros
# - name: Add IP Address to Hosts
# lineinfile:
# dest: /etc/hosts
# line: '129.21.49.190 nightmarionne.skillissue.fyi'
# state: present
# when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Get Certificate | Linux
shell: "/opt/puppetlabs/bin/puppet ssl bootstrap"
when: ansible_os_family in linux_distros
- name: NIGHTMARIONNE | Start Service | Linux
shell: "/opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true"
when: ansible_os_family in linux_distros