1--- 2# Example Playbook: cisco.ucs.ucs_storage_profile 3- hosts: ucs 4 connection: local 5 gather_facts: false 6 7 tasks: 8 - name: Test that we have a UCS hostname, UCS username, and UCS password 9 fail: 10 msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.' 11 when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined 12 vars: 13 # use "<<: *login_info" to substite the information below in each task 14 # this is not required, however it makes the playbook shorter. 15 login_info: &login_info 16 hostname: "{{ ucs_hostname }}" 17 username: "{{ ucs_username }}" 18 password: "{{ ucs_password }}" 19 20 - name: Add UCS Organization 21 cisco.ucs.ucs_org: 22 <<: *login_info 23 org_name: level1 24 parent_org_path: root 25 description: level1 org 26 state: present 27 delegate_to: localhost 28 29 - name: Configure Storage Profile 30 cisco.ucs.ucs_storage_profile: 31 <<: *login_info 32 name: DEE-StgProf 33 org_dn: org-root/org-level1 34 local_luns: 35 - name: Boot-LUN 36 size: '60' 37 disk_policy_name: DEE-DG 38 - name: Data-LUN 39 size: '200' 40 disk_policy_name: DEE-DG 41 42 - name: Remove Local LUN from Storage Profile 43 cisco.ucs.ucs_storage_profile: 44 <<: *login_info 45 name: DEE-StgProf 46 org_dn: org-root/org-level1 47 local_luns: 48 - name: Data-LUN 49 state: absent 50 51 - name: Remove Storage Profile 52 cisco.ucs.ucs_storage_profile: 53 <<: *login_info 54 name: DEE-StgProf 55 org_dn: org-root/org-level1 56 state: absent 57 58 - name: Remove UCS Organization 59 cisco.ucs.ucs_org: 60 <<: *login_info 61 org_name: level1 62 parent_org_path: root 63 state: absent 64 delegate_to: localhost 65