-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsite.yml
1145 lines (1055 loc) · 31.3 KB
/
site.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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
#####################
## IMPORTANT NOTES:
##
## The `untagged` tag is used to run the `common` plays.
## It is implicitly defined by ansible for any plays that do not have tags assigned in the playbook.
##
## The `untagged` plays are mostly meant for target host plays where the ansible machine credential
## has already been set up.
##
## exception use cases include plays that are:
## - run on the ansible controller/localhost and do not include non-controller/localhost target hosts
## - API related: (1) cloud API, (2) vcenter/vmware API, etc,
## - initial ansible user and/or ssh-key setup plays for ansible to connect to newly created hosts
##
## E.g., specific play tags in site.yml that meet these criteria include
## (1) bootstrap-vcenter
## (2) bootstrap-vm
## (3) bootstrap-ansible-user
## and others
##
## All such plays do not require the common plays to run.
##
## The job template/pipeline responsible for launching each play tag should specify
## whether to include the `untagged` tag based on the use-case.
##
## Using this `untagged` tag convention allows for all the aforementioned use cases to be included
## in a single site.yml
##
- name: Pre-check | Perform connectivity (ping) tests to determine nodes to add to group 'node_offline'
hosts: all,!ansible_localhost,!node_offline
tags: always
ignore_unreachable: true
gather_facts: false
vars:
ansible_python_interpreter: "{{ os_python_interpreter }}"
ansible_user: "{{ bootstrap_user }}"
ansible_password: "{{ bootstrap_user_password }}"
roles:
- role: ansible_ping_test
when:
- not ping_exclude|d(False)|bool
- inventory_hostname in ansible_play_hosts
## ref: https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html
## ref: https://grokbase.com/t/gg/ansible-project/149c6gcb6f/is-there-a-way-to-dynamically-target-subsets-of-an-inventory-group-based-on-facts
## ref: https://github.com/ansible/ansible/issues/20360
- name: Apply common groups and vars
hosts: all,!ansible_localhost,!node_offline
tags: always
# gather_facts: false
vars:
ansible_python_interpreter: "{{ os_python_interpreter }}"
ansible_user: "{{ bootstrap_user }}"
ansible_password: "{{ bootstrap_user_password }}"
roles:
- role: apply_common_groups
when:
- not apply_common_groups_exclude|d(False)|bool
- inventory_hostname in ansible_play_hosts
- name: Display apply_common_groups derived group vars
hosts: os_linux,os_windows,!node_offline
tags:
- always
- display-common-vars
- display-network-vars
vars:
ansible_python_interpreter: "{{ os_python_interpreter }}"
ansible_user: "{{ bootstrap_user }}"
ansible_password: "{{ bootstrap_user_password }}"
tasks:
- name: Validate that the apply_common_group group derived variables are set correctly in the apply_common_groups_(machine|os|network)_* groups
ansible.builtin.debug:
msg:
- dc_machine_type={{ dc_machine_type|d('') }}
- dc_os_family={{ dc_os_family|d('') }}
- dc_os_family_shortname={{ dc_os_family_shortname|d('') }}
- dc_os_distribution={{ dc_os_distribution|d('') }}
- dc_os_dist_version={{ dc_os_dist_version|d('') }}
# - "dc_network_site={{ dc_network_site|d('') }}"
# - "dc_network_location={{ dc_network_location|d('') }}"
# - "dc_network_segment={{ dc_network_segment|d('') }}"
- name: "Display important collection versions"
hosts: os_linux,!node_offline
tags:
- always
- display-collection-versions
vars:
ansible_python_interpreter: "{{ os_python_interpreter }}"
ansible_user: "{{ bootstrap_user }}"
ansible_password: "{{ bootstrap_user_password }}"
tasks:
- name: "Display important collection versions" # noqa run-once[task]
run_once: true
ansible.builtin.debug:
msg:
- "ansible.controller version={{ lookup('community.general.collection_version', 'ansible.controller') }}"
- "ansible.posix version={{ lookup('community.general.collection_version', 'ansible.posix') }}"
- "ansible.tower version={{ lookup('community.general.collection_version', 'ansible.tower') }}"
- "ansible.utils version={{ lookup('community.general.collection_version', 'ansible.utils') }}"
- "ansible.windows version={{ lookup('community.general.collection_version', 'ansible.windows') }}"
- "community.crypto version={{ lookup('community.general.collection_version', 'community.crypto') }}"
- "community.docker version={{ lookup('community.general.collection_version', 'community.docker') }}"
- "community.general version={{ lookup('community.general.collection_version', 'community.general') }}"
- "community.postgresql version={{ lookup('community.general.collection_version', 'community.postgresql') }}"
- "community.vmware version={{ lookup('community.general.collection_version', 'community.vmware') }}"
- "community.windows version={{ lookup('community.general.collection_version', 'community.windows') }}"
- "confluent.platform version={{ lookup('community.general.collection_version', 'confluent.platform') }}"
- "cyberark.conjur version={{ lookup('community.general.collection_version', 'cyberark.conjur') }}"
- "cyberark.pas version={{ lookup('community.general.collection_version', 'cyberark.pas') }}"
- "microsoft.ad version={{ lookup('community.general.collection_version', 'microsoft.ad') }}"
- name: Display controller vars
hosts: ansible_localhost
tags:
- display-controller-vars
tasks:
- name: Display controller vars - excluding sensitive and/or global scope keys (e.g., '.*token.*', '.*password.*', '.*private_key.*', etc)
ansible.builtin.debug:
var: vars | dict2items
| rejectattr('key', 'match', '.*vault.*')
| rejectattr('key', 'match', '.*token.*')
| rejectattr('key', 'match', '.*password.*')
| rejectattr('key', 'match', '.*private_key.*')
| list | items2dict
- name: Display controller environment variables
hosts: ansible_localhost
tags:
- display-ansible-env
- display-envvars
- debug-envvars
- debug-env-vars
tasks:
- name: Display ansible_env - excluding sensitive and/or global scope keys (e.g., '.*TOKEN.*', '.*PASSWORD.*', '.*PRIVATE_KEY.*', etc)
ansible.builtin.debug:
var: ansible_env | dict2items
| rejectattr('key', 'match', '.*TOKEN.*')
| rejectattr('key', 'match', '.*PASSWORD.*')
| rejectattr('key', 'match', '.*PRIVATE_KEY.*')
| list | items2dict
# ## Debugging purposes: print all environment variables
# ## ref: https://gryzli.info/2017/12/21/ansible-debug-print-variables/
# - name: "Display controller environment variables"
# tasks:
# - name: Print env var debug information
# ansible.builtin.debug:
# var: environment
- name: Display hostvars
hosts: all,!node_offline
become: false
gather_facts: true
tags:
- display-hostvars
- debug-hostvars
- display-hostvars
tasks:
## ref: https://stackoverflow.com/questions/53264221/in-ansible-how-to-filter-a-dictionary-based-on-regex-pattern-on-the-keys
- name: Display host variables - excluding sensitive and/or global scope keys (e.g., `.*vault.*`, '.*private_key.*', 'groups', '.*password.*', etc)
ansible.builtin.debug:
var: hostvars[inventory_hostname] | dict2items
| rejectattr('key', 'match', '.*vault.*')
| rejectattr('key', 'match', '.*password.*')
| rejectattr('key', 'match', '.*private_key.*')
| rejectattr('key', 'match', 'groups')
| rejectattr('key', 'match', 'dcc_network_global_config')
| list | items2dict
- name: Display cert info
hosts: all,!ansible_localhost,!node_offline
ignore_unreachable: true
ignore_errors: true
# gather_facts: false
tags:
- bootstrap-cacerts
- bootstrap-signing-certs
- bootstrap-keyring
- deploy-cacerts
tasks:
- name: Print cert chain information
ansible.builtin.debug:
var: "{{ item }}"
loop:
- ca_domains_dynamic
- ca_service_routes_list
- ca_intermediate_certs_config
- ca_intermediate_certs_list_dynamic
- ca_intermediate_certs_list
- ca_internal_domains_dynamic
- ca_routes_dynamic
- name: Display bind controller info
hosts: bind_controller,!node_offline
tags:
- bootstrap-bind
- deploy-vm
ignore_unreachable: true
ignore_errors: true
tasks:
- name: Print domain vars
ansible.builtin.debug:
var: "{{ item }}"
loop:
- bind_zone_hosts_dynamic
##
## Deploy VMs
##
- name: Deploy Virtual Machines
# hosts: ansible_localhost
hosts: vmware_control_node
tags:
- bootstrap-vm
- deploy-vm
gather_facts: false
become: true
roles:
- role: bootstrap_govc
- role: deploy_vm
##
## Reporting plays
##
- name: Get linux os configs
hosts: os_linux,!node_offline,!ansible_localhost
tags:
- fetch-linux-os-configs
gather_facts: false
roles:
- role: fetch_linux_os_configs
- name: Report inventory facts
# hosts: os_windows,!node_offline
hosts: os_windows,os_linux,!node_offline
gather_facts: false
tags:
- report-inventory-facts
roles:
- role: report_inventory_facts
##
## Bootstrap linux component plays
##
- name: Bootstrap linux ansible user
hosts: os_linux,!node_offline
gather_facts: false
become: true
tags:
- bootstrap-ansible-user
- bootstrap-ansible
vars:
ansible_python_interpreter: "{{ os_python_interpreter }}"
ansible_user: "{{ bootstrap_user }}"
ansible_password: "{{ bootstrap_user_password }}"
tasks:
- name: Bootstrap ansible user
ansible.builtin.include_role:
name: bootstrap_ansible_user
- name: Bootstrap ansible venv
# vars:
# ansible_python_interpreter: "{{ os_python_interpreter }}"
ansible.builtin.include_role:
name: bootstrap_pip
#- name: Bootstrap linux ansible user
# hosts: os_linux,!node_offline
# gather_facts: false
# become: true
# remote_user: "{{ bootstrap_user }}"
# tags:
# - bootstrap-ansible-user
# - bootstrap-ansible
# vars:
## ansible_python_interpreter: "{{ os_python_interpreter }}"
# # ansible_ssh_user: "{{ bootstrap_user }}"
# ansible_user: "{{ bootstrap_user }}"
# ansible_password: "{{ bootstrap_user_password }}"
# ansible_ssh_common_args: |
# -o StrictHostKeyChecking=no \
# -o UserKnownHostsFile=/dev/null \
# -o PreferredAuthentications=password \
# -o PubkeyAuthentication=no
# # ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
# roles:
# - role: bootstrap_linux_user
# bootstrap_linux_user__list:
# - "{{ bootstrap_ansible_user }}"
## ref: [see firewall notes here](./docs/ansible-firewall-example.md)
- name: Bootstrap linux firewall
hosts: os_linux,!node_offline
become: true
tags:
- bootstrap-firewall
- bootstrap-linux-firewall
- bootstrap-linux-firewalld
roles:
- role: bootstrap_linux_firewalld
firewalld_action: install
## ref: [see firewall notes here](./docs/ansible-firewall-example.md)
- name: Configure linux firewall
hosts: os_linux,!node_offline
become: true
tags:
- configure-firewall
- configure-linux-firewall
roles:
- role: bootstrap_linux_firewalld
firewalld_action: configure
- name: Bootstrap linux packages
hosts: os_linux,!node_offline
become: true
tags:
- bootstrap-packages
- bootstrap-linux-package
roles:
- role: bootstrap_linux_package
- name: Bootstrap java
hosts: os_linux,!node_offline
become: true
tags:
- bootstrap-java
- bootstrap-linux-java
roles:
- role: bootstrap_java
- name: Bootstrap linux upgrade
hosts: os_linux,!node_offline
become: true
tags:
- bootstrap-linux-upgrade
- bootstrap-os-upgrade
- bootstrap-os-update
roles:
- role: bootstrap_linux_upgrade
##
## bootstrap logrotate
##
- name: Bootstrap logrotate
hosts: os_linux,!node_offline
tags:
- bootstrap-logrotate
- bootstrap-linux-logrotate
become: true
roles:
- role: bootstrap_logrotate
##
## bootstrap mounts
##
- name: Bootstrap mounts
hosts: os_linux,!node_offline
tags:
- bootstrap-mounts
- bootstrap-linux-mounts
become: true
roles:
- role: bootstrap_linux_mount
- name: Bootstrap linux ntp
hosts: os_linux,!node_offline
become: true
tags:
- bootstrap-ntp
- bootstrap-linux-ntp
roles:
- role: bootstrap_ntp
- name: Bootstrap nfs services
hosts: os_linux,!node_offline
become: true
tags:
- bootstrap-nfs
- bootstrap-linux-nfs
roles:
- role: bootstrap_nfs_service
- role: bootstrap_linux_firewalld
firewalld_action: configure
- name: Bootstrap linux crons
hosts: os_linux,!node_offline
become: true
tags:
- bootstrap-cron
- bootstrap-linux-cron
roles:
- role: bootstrap_linux_cron
- name: Bootstrap webmin
hosts: os_linux,!node_offline
become: true
tags:
- bootstrap-webmin
- bootstrap-linux-webmin
roles:
- role: bootstrap_webmin
## ref: https://www.nathancurry.com/blog/22-ansible-pxeboot-vms/
## ref: https://github.com/lj020326/homelab.ansible
- name: Configure nameservers
hosts: nameserver,!node_offline
become: true
tags:
- bootstrap-nameserver
- bootstrap-bind
- bind-node
- deploy-vm
roles:
# - role: chronyclient
- role: bootstrap_bind
# - role: ansible-role-dhcp
- role: bootstrap_linux_firewalld
firewalld_action: configure
tags: [firewall-config-nameserver]
- name: Bootstrap kvm hosts
hosts: kvm_host,!node_offline
gather_facts: false
become: true
tags:
- bootstrap-kvm
roles:
- role: bootstrap_kvm
##
## make sure this is running as bootstrap user
## get pwd for this user using the --ask-pass directive,
## and not the --ask-become-pass which is used for the sudo once logged in
##
## ref: https://stackoverflow.com/questions/41771725/ansible-2-1-2-playbook-pass-ssh-password-and-sudo-password-as-command-line-args
## ref: https://8gwifi.org/docs/ansible-sudo-ssh-password.jsp
##
- name: Display bootstrap user info
hosts: all,!node_offline
become: false
gather_facts: false
tags:
- bootstrap-ansible-user
- bootstrap-ansible
# vars:
# ansible_python_interpreter: "{{ os_python_interpreter }}"
tasks:
- name: Display bootstrap_user
ansible.builtin.debug:
var: bootstrap_user
- name: Display ansible_user
ansible.builtin.debug:
var: ansible_user
- name: Display bootstrap_user_password
ansible.builtin.debug:
var: bootstrap_user_password
verbosity: 1
- name: Display ansible_user
ansible.builtin.debug:
var: ansible_user
- name: Bootstrap linux users
hosts: os_linux,!node_offline
gather_facts: true
become: true
remote_user: "{{ bootstrap_user }}"
vars:
# ansible_ssh_user: "{{ bootstrap_user }}"
ansible_user: "{{ bootstrap_user }}"
ansible_password: "{{ bootstrap_user_password }}"
ansible_ssh_common_args: -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
tags:
# - bootstrap-linux
- bootstrap-linux-user
- bootstrap-user
roles:
- role: bootstrap_linux_user
##
## Bootstrap linux plays
##
- name: Bootstrap ansible venv
hosts: os_linux,!node_offline
tags:
- bootstrap-ansible-venv
- bootstrap-pip
- bootstrap-linux-docker
- bootstrap-linux
- bootstrap-docker
- vm-template
- vm-template-linux
become: true
vars:
ansible_python_interpreter: "{{ os_python_interpreter }}"
bootstrap_pip__env_force_rebuild: false
roles:
- role: bootstrap_pip
- name: Bootstrap linux
hosts: os_linux,!node_offline
gather_facts: false
tags:
- bootstrap-linux
- bootstrap-node-core
- bootstrap-node
become: true
roles:
- role: bootstrap_linux
- name: Bootstrap linux core
hosts: os_linux,!node_offline
tags:
- bootstrap-linux-core
become: true
roles:
- role: bootstrap_linux_core
- name: Bootstrap linux to new deployed vm instance
hosts: vmware_new_vm_linux
# gather_facts: false
tags: deploy-vm
become: true
roles:
- role: apply_common_groups
- role: bootstrap_linux
##
## Bootstrap windows plays
##
- name: Bootstrap windows to new deployed vm instance
hosts: vmware_new_vm_windows
tags: deploy-vm
become: true
roles:
- role: bootstrap_windows
- name: Bootstrap windows
hosts: os_windows,!node_offline
# hosts: windows,!node_offline
tags:
- bootstrap-windows
- bootstrap-windows-user
- bootstrap-node
# become: true
# become_method: runas
roles:
- role: bootstrap_windows
## ref: https://www.redhat.com/en/blog/integrating-ansible-jenkins-cicd-process
- name: Bootstrap CI/CD node
hosts: cicd_node,!node_offline,!ansible_localhost
tags:
- bootstrap
- bootstrap-cicd
- bootstrap-cicd-node
- cicd-node
become: true
roles:
- role: bootstrap_linux_firewalld
firewalld_action: configure
- role: bootstrap_linux_package
- role: bootstrap_linux_mount
- role: bootstrap_maven
- role: bootstrap_git
- role: bootstrap_ansible
- role: bootstrap_packer
- role: bootstrap_nodejs
# - role: bootstrap_jenkins_swarm_agent
- role: bootstrap_jenkins_agent
- role: bootstrap_inspec
- role: bootstrap_govc
- role: bootstrap_ovftool
- name: Bootstrap Jenkins Agents
hosts: jenkins_agent,!node_offline
tags:
- bootstrap-jenkins-agent
- deploy-jenkins-agent
become: true
roles:
- role: bootstrap_linux_package
- role: bootstrap_jenkins_agent
- role: bootstrap_git
- role: bootstrap_ansible
- role: bootstrap_govc
- role: bootstrap_inspec
- role: bootstrap_packer
- name: Bootstrap iscsi clients
hosts: iscsi_client,!node_offline
tags:
- bootstrap
- bootstrap-iscsi
- bootstrap-iscsi-client
- iscsi-client
become: true
roles:
- role: bootstrap_iscsi_client
- name: Bootstrap ntp servers
hosts: ntp_server,!node_offline
tags:
- bootstrap-ntp
- bootstrap-ntp-server
become: true
roles:
- role: bootstrap_ntp
- name: Bootstrap ntp clients
hosts: ntp_network,!ntp_server,!node_offline
tags:
- bootstrap-ntp
- bootstrap-ntp-client
become: true
roles:
- role: bootstrap_ntp
## ref: https://blog.ktz.me/combining-zfs-with-other-filesystems-using-mergerfs/
## ref: https://selfhostedhome.com/combining-different-sized-drives-with-mergerfs-and-snapraid/
- name: Setup mergerfs nodes
hosts: mergerfs,!node_offline
tags:
- mergerfs
- bootstrap-mergerfs
become: true
roles:
- role: bootstrap_snapraid
- role: bootstrap_hddtemp
# - role: bootstrap_telegraf
ignore_errors: true
# - role: sanoid
# - role: syncoid
- role: bootstrap_mergerfs
- name: Install veeam-agent
hosts: veeam_agent,!node_offline
become: true
tags:
- bootstrap-veeam
- bootstrap-veeam-agent
- setup-veeam-agent
- install-veeam-agent
roles:
- role: bootstrap_veeam_agent
- role: bootstrap_linux_firewalld
firewalld_action: configure
tags: [firewall-config-veeamagent]
- name: Configure veeam-agent jobs
hosts: veeam_agent,!node_offline
become: true
tags:
- config-veeam-agent
# - bootstrap-veeam
# - bootstrap-veeam-agent
roles:
- role: bootstrap_veeam_agent_config
- name: Bootstrap postfix server
hosts: postfix_server,!node_offline
tags:
- bootstrap-postfix
- bootstrap-postfix-server
become: true
roles:
- role: bootstrap_postfix
- name: Bootstrap postfix client
hosts: postfix_network,!postfix_server,!node_offline
tags:
- bootstrap-postfix
- bootstrap-postfix-client
become: true
roles:
- role: bootstrap_postfix
- name: Bootstrap sshd
hosts: os_linux,!node_offline
gather_facts: false
tags:
- bootstrap-linux-sshd
- bootstrap-sshd
become: true
roles:
- role: bootstrap_sshd
- name: Bootstrap ldap client
hosts: ldap_client,!node_offline
tags:
- bootstrap-ldap
- bootstrap-ldap-client
become: true
roles:
- role: bootstrap_ldap_client
- name: Bootstrap ansible node
hosts: ansible_controller,!node_offline
tags:
- bootstrap
- bootstrap-admin
- bootstrap-ansible
become: true
roles:
- role: bootstrap_git
- role: bootstrap_ansible
- role: bootstrap_linux_locale
#- name: Bootstrap pip
# hosts: os_linux,!node_offline
# tags:
# - bootstrap-pip
# become: true
# roles:
# - role: bootstrap_pip
## setup step-ca pki, create CA certs and install CA certs
- name: Configure Step-ca cli for step clients
hosts: step_ca_cli,!node_offline
become: true
tags:
- bootstrap-stepca
- bootstrap-stepca-cli
# - bootstrap-caroot
roles:
- role: bootstrap_stepca
## setup pki, create CA certs and install CA certs
##
## ref: https://www.tikalk.com/posts/2016/10/30/Running-Your-Own-Ansible-Driven-CA/
## ref: https://github.com/shelleg/ansible-role-ca/
- name: Setup ca_root and cacerts
hosts: ca_keystore,!node_offline
gather_facts: false
tags:
- bootstrap-certs
- bootstrap-cacerts
- bootstrap-signing-certs
- bootstrap-keyring
- bootstrap-pki
- renew-expired-cacerts
- caroot
- caroot-create
- ca-keyring
- casigners-create
become: true
roles:
- role: bootstrap_cfssl
- role: bootstrap_certs
tags: [cacerts-create]
- name: Deploy CA certs to cert_node
hosts: os_linux,!node_offline
gather_facts: false
tags:
- bootstrap-node
# - bootstrap-docker-stack
- cacerts
- cacerts-distribute
- cacerts-deploy
- cacerts-update
- deploy-cacerts
become: true
roles:
- role: deploy_cacerts
- name: Harden linux OS
hosts: os_linux,!node_offline
tags:
- harden-linux-os
- harden-linux
become: true
roles:
- role: harden_os_linux
## possibly need to install docker_service dependencies first
## ref: https://github.com/avinetworks/ansible-role-docker
## ref: https://github.com/lj020326/ansible-docker_service-dep/blob/main/tasks/main.yml
## ref: https://github.com/ansible/ansible/issues/29510
## ref: https://github.com/nickjj/ansible-docker
- name: Bootstrap docker nodes
hosts: docker,!node_offline
tags:
- bootstrap
- docker
- bootstrap-linux
- bootstrap-linux-docker
- bootstrap-docker
- bootstrap-registry
become: true
roles:
- role: bootstrap_docker
- name: Bootstrap docker swarm nodes
hosts: docker,!node_offline
tags:
- bootstrap-docker-swarm
- docker-swarm
become: true
roles:
- role: bootstrap_docker
bootstrap_docker__actions: [setup-swarm]
- name: Deploy docker registry certs
hosts: docker,!node_offline
tags:
- deploy-docker-registry-certs
- deploy-registry-certs
- deploy-cacerts
- cacerts-update
become: true
roles:
- role: bootstrap_docker_registry
bootstrap_docker_registry__actions: [deploy-certs]
###########################
# docker_registry install #
###########################
- name: Create, tag and push docker images (ldap, jenkins, etc) to registry
hosts: docker_image_builder,!node_offline
tags:
- bootstrap
- bootstrap-registry
- bootstrap-docker-images
- bootstrap-admin-node
- docker-build-images
- build-docker-images
become: true
roles:
- role: bootstrap_git
- role: docker_image_builder
##############
## bootstrap docker stack nodes
##############
- name: Bootstrap docker stack node
hosts: docker_stack,!node_offline
tags:
- bootstrap-docker-stack
- docker-stack
become: true
# vars:
# ansible_python_interpreter: "{{ ansible_virtualenv_docker_python_interpreter }}"
roles:
- role: bootstrap_docker_stack
- name: Bootstrap docker control plane node
hosts: docker_stack_control,!node_offline
tags:
- bootstrap-control-node
- docker-control-node
become: true
# vars:
# ansible_python_interpreter: "{{ ansible_virtualenv_docker_python_interpreter }}"
roles:
- role: bootstrap_docker_stack
- name: "Bootstrap docker admin node : mail, nfs, docker (traefik, portainer, watchdog, ldap, etc)"
hosts: docker_stack_admin,!node_offline
tags:
- bootstrap-admin-node
- docker-admin-node
become: true
# vars:
# ansible_python_interpreter: "{{ ansible_virtualenv_docker_python_interpreter }}"
roles:
- role: bootstrap_docker_stack
- name: Bootstrap docker media node
hosts: docker_stack_media,!node_offline
tags:
- bootstrap-media-node
- docker-media-node
become: true
# vars:
# ansible_python_interpreter: "{{ ansible_virtualenv_docker_python_interpreter }}"
roles:
- role: bootstrap_docker_stack
- name: Bootstrap docker ml node
hosts: docker_stack_ml,!node_offline
tags:
- bootstrap-ml-node
- docker-ml-node
become: true
# vars:
# ansible_python_interpreter: "{{ ansible_virtualenv_docker_python_interpreter }}"
roles:
- role: bootstrap_docker_stack
## ref: https://github.com/lae/ansible-role-proxmox
- name: Deploy ProxMox Cluster
hosts: proxmox,!node_offline
tags:
- bootstrap-proxmox
become: true
roles:
- role: bootstrap_proxmox
pve_group: proxmox
# pve_reboot_on_kernel_update: true
- name: Fetch OS images
hosts: ansible_localhost
gather_facts: false
tags:
- fetch-os-images
roles:
- role: fetch_os_images
- name: Bootstrap VMware ESXi servers
hosts: vmware_physical_esx_host,!node_offline
tags:
- bootstrap-vmware-esxi
- bootstrap-vcenter
- deploy-vsphere-dc
- deploy-vcenter
- vsphere-deploy-dc
- ping-exclude
gather_facts: false
roles:
- role: bootstrap_vmware_esxi
- role: bootstrap_vmware_esxi_hostconf
########################
## VSPHERE DC Setup role
########################
- name: Deploy VSphere Datacenter
hosts: vsphere_control_node
tags:
- bootstrap-vsphere
- deploy-vsphere-dc
- vsphere-deploy-dc
- ping-exclude
become: true
roles:
- role: bootstrap_vsphere_dc
- name: VMware Upgrade ESXi servers
hosts: vmware_physical_esx_host,!node_offline
tags:
- vmware-upgrade-esxi
gather_facts: false
roles:
- role: vmware_upgrade_esxi
- name: VMware Remount VM Datastores
# hosts: ansible_localhost
hosts: vmware_control_node
become: true
tags:
- vmware-remount-datastores
roles:
# - role: vmware_remount_datastores
- role: bootstrap_vmware_datastores
vars:
bootstrap_vmware_datastores__unmount_datastores_first: true
- name: VMware Mount VM Datastores
# hosts: ansible_localhost
hosts: vmware_control_node
become: true
tags:
- bootstrap-vmware-mounts
- vmware-mount-datastores
roles:
- role: bootstrap_vmware_datastores
- name: Bootstrap Openstack
hosts: openstack_kolla_node,!node_offline
tags:
- bootstrap
- bootstrap-openstack
become: true
roles:
- name: Configure openstack deploy node
role: bootstrap_openstack
- name: Bootstrap k8s cluster
hosts: k8s_cluster,!node_offline
tags:
- bootstrap
- bootstrap-k8s
become: true
roles:
- role: bootstrap_linux_firewalld
firewalld_action: configure
tags: [firewall-config-k8s]
## must first run the kolla-ansible (bootstrap-servers|prechecks|deploy)
- name: Bootstrap Openstack Cloud
hosts: openstack_kolla_node,!node_offline