| 1 |
--- |
| 2 |
|
| 3 |
- hosts: ucs |
| 4 |
connection: local |
| 5 |
gather_facts: false |
| 6 |
|
| 7 |
vars: |
| 8 |
org: AnsibleOrg |
| 9 |
|
| 10 |
tasks: |
| 11 |
- name: Test that we have a UCS hostname, UCS username, and UCS password |
| 12 |
fail: |
| 13 |
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' |
| 14 |
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined |
| 15 |
vars: |
| 16 |
|
| 17 |
|
| 18 |
login_info: &login_info |
| 19 |
hostname: "{{ ucs_hostname }}" |
| 20 |
username: "{{ ucs_username }}" |
| 21 |
password: "{{ ucs_password }}" |
| 22 |
|
| 23 |
- name: Add UCS Organization |
| 24 |
cisco.ucs.ucs_org: |
| 25 |
<<: *login_info |
| 26 |
org_name: "{{ org }}" |
| 27 |
parent_org_path: root |
| 28 |
description: "Org {{ org }}" |
| 29 |
state: present |
| 30 |
delegate_to: localhost |
| 31 |
|
| 32 |
- name: Add Scrub Policy |
| 33 |
cisco.ucs.ucs_scrub_policy: |
| 34 |
<<: *login_info |
| 35 |
state: present |
| 36 |
org_dn: "org-root/org-{{ org }}" |
| 37 |
description: Scrub All Policy |
| 38 |
name: all_scrub |
| 39 |
bios_settings_scrub: "yes" |
| 40 |
disk_scrub: "yes" |
| 41 |
flex_flash_scrub: "yes" |
| 42 |
persistent_memory_scrub: "yes" |
| 43 |
delegate_to: localhost |
| 44 |
|
| 45 |
- name: Check Scrub Policy |
| 46 |
cisco.ucs.ucs_scrub_policy: |
| 47 |
<<: *login_info |
| 48 |
state: present |
| 49 |
org_dn: "org-root/org-{{ org }}" |
| 50 |
description: Scrub All Policy |
| 51 |
name: all_scrub |
| 52 |
bios_settings_scrub: "yes" |
| 53 |
disk_scrub: "yes" |
| 54 |
flex_flash_scrub: "yes" |
| 55 |
persistent_memory_scrub: "yes" |
| 56 |
delegate_to: localhost |
| 57 |
check_mode: True |
| 58 |
|
| 59 |
- name: Add Scrub Policy |
| 60 |
cisco.ucs.ucs_scrub_policy: |
| 61 |
<<: *login_info |
| 62 |
state: present |
| 63 |
description: Scrub All Policy |
| 64 |
name: all_scrub |
| 65 |
bios_settings_scrub: "yes" |
| 66 |
disk_scrub: "yes" |
| 67 |
flex_flash_scrub: "yes" |
| 68 |
persistent_memory_scrub: "yes" |
| 69 |
delegate_to: localhost |
| 70 |
|
| 71 |
- name: Idempotent Scrub Policy |
| 72 |
cisco.ucs.ucs_scrub_policy: |
| 73 |
<<: *login_info |
| 74 |
state: present |
| 75 |
description: Scrub All Policy |
| 76 |
name: all_scrub |
| 77 |
bios_settings_scrub: "yes" |
| 78 |
disk_scrub: "yes" |
| 79 |
flex_flash_scrub: "yes" |
| 80 |
persistent_memory_scrub: "yes" |
| 81 |
delegate_to: localhost |
| 82 |
|
| 83 |
- name: Check Create/Update Scrub Policy |
| 84 |
cisco.ucs.ucs_scrub_policy: |
| 85 |
<<: *login_info |
| 86 |
state: present |
| 87 |
org_dn: "org-root/org-{{ org }}" |
| 88 |
name: BD_scrub |
| 89 |
description: Scrub BIOS and Disk Policy |
| 90 |
bios_settings_scrub: "yes" |
| 91 |
disk_scrub: "yes" |
| 92 |
flex_flash_scrub: "no" |
| 93 |
persistent_memory_scrub: "no" |
| 94 |
delegate_to: localhost |
| 95 |
check_mode: true |
| 96 |
|
| 97 |
- name: Create/Update Scrub Policy |
| 98 |
cisco.ucs.ucs_scrub_policy: |
| 99 |
<<: *login_info |
| 100 |
state: present |
| 101 |
org_dn: "org-root/org-{{ org }}" |
| 102 |
name: BD_scrub |
| 103 |
description: Scrub BIOS and Disk Policy |
| 104 |
bios_settings_scrub: "yes" |
| 105 |
disk_scrub: "yes" |
| 106 |
flex_flash_scrub: "no" |
| 107 |
persistent_memory_scrub: "no" |
| 108 |
delegate_to: localhost |
| 109 |
|
| 110 |
- name: Delete Scrub Policy |
| 111 |
cisco.ucs.ucs_scrub_policy: |
| 112 |
<<: *login_info |
| 113 |
state: absent |
| 114 |
name: all_scrub |
| 115 |
delegate_to: localhost |
| 116 |
|
| 117 |
- name: Remove UCS Organization |
| 118 |
cisco.ucs.ucs_org: |
| 119 |
<<: *login_info |
| 120 |
org_name: "{{ org }}" |
| 121 |
parent_org_path: root |
| 122 |
state: absent |
| 123 |
delegate_to: localhost |