-
Notifications
You must be signed in to change notification settings - Fork 3
/
iseee.yaml
530 lines (437 loc) · 18.5 KB
/
iseee.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
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
---
#------------------------------------------------------------------------------
# ISE Eternal Evaluation (ISEEE) Main Playbook
#
# Example commands:
# ansible-playbook iseee.yaml --ask-pass # Use `--ask-pass` option for SSH keys password
# ansible-playbook iseee.yaml -v # 💡 verbosity == 1 to show all task output automatically
# ansible-playbook iseee.yaml --tags provision --ask-pass
# ansible-playbook iseee.yaml --tags provision,patch,restore --ask-pass
# ansible-playbook iseee.yaml --tags licensing
# ansible-playbook iseee.yaml --tags password_reset --ask-pass # Ask for SSH key password
# ansible-playbook iseee.yaml --tags extend
#------------------------------------------------------------------------------
- name: ISE Eternal Evaluation (ISEEE)
hosts: localhost # 💡 Use `localhost` for provisioning playbook
gather_facts: no
vars:
vars_files:
- vars/ssh_key.yaml
- vars/ise_common.yaml
- vars/iseee.yaml
pre_tasks:
- name: Assert Required Environment Variables
delegate_to: localhost
vars:
env_vars:
- AWS_REGION
- PROJECT
- ISE_REST_USERNAME
- ISE_REST_PASSWORD
- ISE_RADIUS_SECRET
- ISE_TACACS_SECRET
- ISE_GUEST_SPONSOR_USERNAME
- ISE_GUEST_SPONSOR_PASSWORD
- ISE_VERIFY
- ISE_WAIT_ON_RATE_LIMIT
- ISE_USES_API_GATEWAY
- ISE_DEBUG
# - SSH_DIRECTORY
# - SSH_KEY
# - SSH_KEY_PASSPHRASE
# - MERAKI_ORG_NAME
# - MERAKI_ORG_ID
loop: "{{ env_vars }}"
ansible.builtin.assert:
that:
- lookup('env', item) # is defined does not work
fail_msg: |
X Please verify (`env`) and `export` or `set` the required environment variable {{ item }} in your terminal:
export {{ item }}=__________
success_msg: |
✔ Environment variable {{ item }} exists
- name: debug vars
ansible.builtin.debug:
msg: |
ansible_host: "{{ ansible_host }}"
inventory_hostname: "{{ inventory_hostname }}"
ansible_playbook_python: "{{ ansible_playbook_python }}"
ise_nodes: "{{ ise_nodes }}"
# roles:
# tasks:
# - ansible.builtin.import_playbook: iseee.ssh.yaml
# tags: [ssh]
# - ansible.builtin.import_playbook: iseee.provision.yaml
# tags: [provision]
# - ansible.builtin.import_playbook: iseee.deploy.yaml
# tags: [deploy]
# - ansible.builtin.import_playbook: iseee.facts.yaml
# tags: [facts]
# - ansible.builtin.import_playbook: iseee.patch.yaml
# tags: [patch, hotpatch]
# - ansible.builtin.import_playbook: iseee.certificates.yaml
# tags: [cert, certs, certificate, certificates]
# - ansible.builtin.import_playbook: iseee.licensing.yaml
# tags: [eval, evaluation, license, licensing]
# - ansible.builtin.import_playbook: iseee.configure.yaml
# tags: [config, configure, configuration]
# - ansible.builtin.import_playbook: iseee.backup.yaml
# tags: [backup]
# - ansible.builtin.import_playbook: iseee.extend.yaml
# tags: [extend, extension, renew]
# - ansible.builtin.import_playbook: iseee.restore.yaml
# tags: [restore]
# - ansible.builtin.import_playbook: iseee.password_reset.yaml
# tags: [pwreset, password, reset]
# - ansible.builtin.import_playbook: iseee.destroy.yaml
# tags: [destroy, terminate]
#------------------------------------------------------------------------------
# Cisco Identity Services Engine (ISE) Main Playbook
#
# Example commands:
# ansible-playbook ise.yaml --tags provision --ask-pass
# ansible-playbook -i inventory/dcloud_ise_sandbox.yaml --limit ise ise.yaml --tags backup
# ansible-playbook -i inventory/dcloud_ise_sandbox.yaml --limit ise ise.yaml --tags restore
# ansible-playbook ise.yaml --tags show --limit ise
# ansible-playbook ise.yaml --tags show -v # 💡 verbosity == 1 to show all task output automatically
#------------------------------------------------------------------------------
# - name: ISE Provisioning Playbook
# hosts: localhost
# gather_facts: no
# vars:
# # required for initial provisioning
# ise_username: "{{ lookup('env','ISE_REST_USERNAME') | default( omit ) }}"
# ise_password: "{{ lookup('env','ISE_REST_PASSWORD') | default( omit ) }}"
# # ise_backup_encryption_key: "{{ lookup('env','ISE_BACKUP_ENCRYPTION_KEY') }}"
# vars_files:
# - vars/ise_common.yaml
# - vars/ssh_key.yaml
# - vars/iseee.yaml
tasks:
#------------------------------------------------------------------------------
# Provisioning
#------------------------------------------------------------------------------
- ansible.builtin.import_role:
name: ssh_key_local # 💡 Provision an SSH key for this project
tags: [ssh, provision, provisioning]
- ansible.builtin.import_role:
name: aws_ec2_ssh_keypair_upload # upload SSH key for EC2 instances
tags: [provision, provisioning]
- ansible.builtin.import_role:
name: aws_ec2_vpc # AWS VPC
tags: [provision, provisioning]
- ansible.builtin.import_role:
name: aws_ec2_ise_security_groups # security group(s) for ISE
tags: [provision, provisioning]
- ansible.builtin.import_role:
name: aws_ec2_ise_nodes
vars:
# ise_nodes: "{{ ise_nodes }}"
tags: [provision, provisioning]
- ansible.builtin.import_role:
name: aws_ec2_show # see what we provisioned
tags: [provision, provisioning]
- ansible.builtin.import_role:
name: aws_ec2_r53_public_dns_entry # add ISE nodes to AWS R53 DNS
tags: [provision, provisioning]
# Provision other AWS EC2 instances from Ansible roles ...
# - ubuntu_vsftpd_⚠
# - meraki_vmx_aws_⚠
# - meraki_mx_⚠
# - meraki_mr_ssid_.corp_⚠
# - meraki_mr_ssid_.iot_ipsk_⚠
- ansible.builtin.import_role:
name: refresh_inventory # 💡 must refresh inventory for next playbook!
tags: [provision, provisioning]
- name: Banner | ISE Boot Time Notification
vars:
banner_name: hourglass
banner_line_2: ISE boot times vary by release and instance size.
banner_line_3: Expect to wait at least 25 minutes...
ansible.builtin.import_role:
name: banner
tags: [provision, provisioning]
- name: Banner | ISE Provisioned Notification
vars:
banner_name: cisco_secure_ise_logo_small
banner_text: ISE is Provisioned!
ansible.builtin.import_role:
name: banner
tags: [provision, provisioning]
- name: ISE Runtime Playbook
hosts: iseee
gather_facts: no
vars:
# required for initial provisioning
ise_username: "{{ lookup('env','ISE_REST_USERNAME') | default( omit ) }}"
ise_password: "{{ lookup('env','ISE_REST_PASSWORD') | default( omit ) }}"
vars_files:
- vars/ise_common.yaml
- vars/ssh_key.yaml
- vars/iseee.yaml
tasks:
#------------------------------------------------------------------------------
# Extend
#------------------------------------------------------------------------------
# - ansible.builtin.import_playbook: iseee.extend.yaml
# tags: [extend, extension, renew]
#------------------------------------------------------------------------------
# Deploy
#------------------------------------------------------------------------------
- ansible.builtin.import_role:
name: ise_login_await # ISE SSH & HTTPS for CLI & GUI Login Page
tags: [deploy, deployment, restore]
- ansible.builtin.import_role:
name: ise_apis_enabled # ISE ERS & OpenAPIs enabled
tags: [deploy, deployment, restore]
- ansible.builtin.import_role:
name: ise_facts # gather ISE version, patch, & node state info
tags: [deploy, deployment]
- ansible.builtin.import_role:
name: ise_facts_table # summarize ISE nodes' facts in a table
tags: [deploy, deployment]
- ansible.builtin.import_role:
name: ise_repository_localdisk # configure LOCALDISK repository
tags: [deploy, deployment]
- ansible.builtin.import_role:
name: ise_repository_from_env # configure repository & set `ise_repository_name`
tags: [deploy, deployment]
# Roles & Services: Join deployment and assign node roles, services, node groups, ...
- ansible.builtin.import_role:
name: ise_node_standalone
tags: [deploy, deployment, standalone]
- ansible.builtin.import_role:
name: ise_node_deployment_⚠
tags: [deploy, deployment]
- ansible.builtin.import_role:
name: ise_node_ppan
tags: [deploy, deployment]
- ansible.builtin.import_role:
name: ise_nodes_deploy_from_tags_⚠
tags: [deploy, deployment]
- name: Banner | ISE Deployed Notification
vars:
banner_name: cisco_secure_ise_logo_small
banner_text: ISE is Deployed!
ansible.builtin.import_role:
name: banner
tags: [deploy, deployment]
#------------------------------------------------------------------------------
# Certificates
#------------------------------------------------------------------------------
# - ansible.builtin.import_playbook: ise.certificates.yaml
# tags: [cert, certs, certificate, certificates]
- name: Banner | ISE Certificates Not Implemented
vars:
banner_name: warning
banner_text: Not Implemented!
ansible.builtin.import_role:
name: banner
tags: [cert, certs, certificate, certificates]
# - ise_trusted_certificates_show_⚠
# - ise_system_certificate_show_⚠
# - ise_system_certificate_saved_⚠
# - ise_trusted_certificates_saved_⚠
# - ise_system_certificate_imported_⚠
# - ise_trusted_certificates_imported_⚠
# - ise_system_certificate_deleted_⚠
# - name: ISE is Certificated!
# role: banner
# vars:
# banner_name: cisco_secure_ise_logo_small
# banner_text: ISE is Certificated!
#------------------------------------------------------------------------------
# Patch
#------------------------------------------------------------------------------
- ansible.builtin.import_role:
name: ise_facts
tags: [facts, patch]
- ansible.builtin.import_role:
name: ise_facts_table
tags: [facts, patch]
- ansible.builtin.import_role:
name: ise_node_patch
tags: [patch]
- ansible.builtin.import_role:
name: ise_node_hotpatch
tags: [patch, hotpatch]
#------------------------------------------------------------------------------
# Configure
#------------------------------------------------------------------------------
# - name: Include vars from a file
# delegate_to: localhost
# ansible.builtin.include_vars:
# file: .configs/pseudoco/endpointgroup.yaml
- name: Find and list files in a specified directory
delegate_to: localhost
ansible.builtin.find:
paths: ".configs/pseudoco/"
file_type: file
use_regex: true
register: dir_files
tags: [config, configure]
# - name: Print list of files found
# delegate_to: localhost
# ansible.builtin.debug:
# msg: |
# {{ dir_files.files | community.general.json_query('[*].path') }}
- name: Include vars from a file
delegate_to: localhost
ansible.builtin.set_fact:
files_to_load: "{{ dir_files.files | community.general.json_query('[].path') }}"
tags: [config, configure]
- name: Include vars from a file
delegate_to: localhost
loop: "{{ files_to_load }}"
ansible.builtin.include_vars:
file: "{{ item }}"
tags: [config, configure]
# Identity Stores
# - ise_microsoft_active_directory_⚠
# - ise_microsoft_entra_id_⚠
# - ise_pxgrid_direct_⚠
# Network Device Groups & Network Devices
# - ise_network_device_groups
# - ise_network_devices
# Identity Groups & Users
# - ise_identity_groups
# - ise_internal_users
# Endpoint Groups & Endpoints
# - ise_endpoint_groups
# - ise_endpoints
# TrustSec
# - ise_sgacls_⚠
# - ise_sgts_⚠
# - ise_trustsec_matrix_default_⚠
# Guest Portals
# - Hotspot Portal
# - SelfReg Portal
# - Sponsor Portal
# Device Admin Policies
# Network Access Policies
# - name: ISE Policy Wired MAB
# vars:
# ansible.builtin.import_role:
# name: ise_policy_wired_mab_⚠
# tags: [config, configure, policy]
# - name: ISE Policy Wireless IOT
# vars:
# ansible.builtin.import_role:
# name: ise_policy_iot_wireless_⚠
# tags: [config, configure, policy]
# -
# pxGrid
# - name: pxGrid Configuration (ISE 2.4+)
# vars:
# ansible.builtin.import_role:
# name: ise_pxgrid_settings
# tags: [config, configure, pxgrid]
- name: Banner | ISE Configured!
vars:
banner_name: cisco_secure_ise_logo_small
banner_text: ISE is Configured!
# 💡 Use single-quotes (') for banner text; \'s in "'s are a special char delimiter!
banner_line_2: " ____ __ _ _ _ "
banner_line_3: " / ___| ___ _ __ / _|(_) __ _ _ _ _ __ ___ __| || |"
banner_line_4: ' | | / _ \ | `_ \ | |_ | | / _` || | | || `__|/ _ \ / _` || |'
banner_line_5: " | |___| (_) || | | || _|| || (_| || |_| || | | __/| (_| ||_|"
banner_line_6: ' \____|\___/ |_| |_||_| |_| \__, | \__,_||_| \___| \__,_|(_)'
banner_line_7: " |___/ "
ansible.builtin.import_role:
name: banner
tags: [config, configure]
#------------------------------------------------------------------------------
# Backup
# vars:
# ise_repository_name: "{{ lookup('env','ISE_REPOSITORY_NAME') }}"
# ise_backup_encryption_key: "{{ lookup('env','ISE_BACKUP_ENCRYPTION_KEY') }}"
# ise_backup_name_prefix: "ISEEE_{{ DT_ISO8601 | strftime }}"
#------------------------------------------------------------------------------
- ansible.builtin.import_role:
name: ise_config_backup_now
tags: [backup]
#------------------------------------------------------------------------------
# Restore
# ise_repository_name: "{{ lookup('env','ISE_REPOSITORY_NAME') }}"
# ise_backup_encryption_key: "{{ lookup('env','ISE_BACKUP_ENCRYPTION_KEY') }}"
# ise_restore_filename: ISE_330_reset.tar.gpg # ⚠ must exist on ISE repository!
#------------------------------------------------------------------------------
# # Run these roles in case this is invoked after Provisioning
# - ise_login_await # ISE SSH & HTTPS for CLI & GUI Login Page
# - ise_apis_enabled # ISE ERS & OpenAPIs enabled
# - ise_repository # Configure repository & set `ise_repository_name`
# - name: Restore
# ansible.builtin.import_role:
# name: ise_config_restore # requires `ise_restore_filename` & `ise_backup_encryption_key`
# tags: [restore]
# - name: Restore ISEEE
# when: ise_restore_filename is undefined
# vars:
# filter: '^ISEEE.+\.gpg$' # ISEEE configuration backups
# ansible.builtin.import_role:
# name: ise_repository_filenames
# tags: [restore]
- name: Restore ISE from a Specific Filename
vars:
ise_repository_name: "{{ lookup('env','ISE_REPOSITORY_NAME') }}"
ise_backup_encryption_key: "{{ lookup('env','ISE_BACKUP_ENCRYPTION_KEY') }}"
# ise_restore_filename: ISE_330_reset.tar.gpg # ⚠ must exist on ISE repository!
ansible.builtin.import_role:
name: ise_config_restore
tags: [restore]
- name: ISEEE Restored | {{ ise_restore_filename }} ⮕ {{ inventory_hostname}} ({{ ansible_host }})
vars:
banner_name: cisco_secure_ise_logo_small
# 💡 Use single-quotes (') for banner text; \'s in "'s are a special char delimiter!
banner_line_3: " ____ _ _ _ "
banner_line_4: '| _ \ ___ ___ | |_ ___ _ __ ___ __| || |'
banner_line_5: '| |_) |/ _ \/ __|| __|/ _ \ | `__|/ _ \ / _` || |'
banner_line_6: '| _ <| __/\__ \| |_| (_) || | | __/| (_| ||_|'
banner_line_7: '|_| \_\\___||___/ \__|\___/ |_| \___| \__,_|(_)'
banner_text: ISEEE is Restored! {{ ise_restore_filename }} ⮕ {{ inventory_hostname}} ({{ ansible_host }})
ansible.builtin.import_role:
name: banner
tags: [restore]
- ansible.builtin.import_role:
name: ise_task_monitor_⚠
tags: [task, tasks, monitor]
#------------------------------------------------------------------------------
# Licensing
#------------------------------------------------------------------------------
- ansible.builtin.import_role:
name: ise_licensing_status
tags: [eval, evaluation, license, licensing]
#------------------------------------------------------------------------------
# Password Reset
# 💡 Requires CLI option `--ask-pass` to prompt for SSH key password:
# ansible-playbook iseee.password_reset.yaml --ask-pass
#------------------------------------------------------------------------------
- ansible.builtin.import_role:
name: ise_cli_password_reset
tags: [pwreset, password, reset]
#------------------------------------------------------------------------------
# Reload
#------------------------------------------------------------------------------
- ansible.builtin.import_role:
name: ise_cli_reload
tags: [reload]
- ansible.builtin.import_role:
name: ise_login_await
tags: [reload, wait] # run after reload
- ansible.builtin.import_role:
name: press_enter_to_continue
tags: [pause]
#------------------------------------------------------------------------------
# Show
#------------------------------------------------------------------------------
- name: ISE Show
ansible.builtin.import_role:
name: ise_show
tags: [show]
#------------------------------------------------------------------------------
# Destroy / Terminate
#------------------------------------------------------------------------------
- name: AWS Project Termination
ansible.builtin.import_role:
name: aws_project_termination
tags: [destroy, terminate, termination]