| 1 |
--- |
| 2 |
- name: Dell OpenManage Ansible server interface profile workflow. |
| 3 |
hosts: ome |
| 4 |
gather_facts: false |
| 5 |
vars: |
| 6 |
retries_count: 100 |
| 7 |
polling_interval: 10 |
| 8 |
src_service_tag: 7GHH6H1 |
| 9 |
|
| 10 |
tasks: |
| 11 |
- name: Create a smart fabric. |
| 12 |
dellemc.openmanage.ome_smart_fabric: |
| 13 |
hostname: "{{ hostname }}" |
| 14 |
username: "{{ username }}" |
| 15 |
password: "{{ password }}" |
| 16 |
ca_path: "/path/to/ca_cert.pem" |
| 17 |
state: present |
| 18 |
name: "fabric1" |
| 19 |
description: "fabric desc" |
| 20 |
fabric_design: "2xMX9116n_Fabric_Switching_Engines_in_same_chassis" |
| 21 |
primary_switch_service_tag: "6H7J6Z2" |
| 22 |
secondary_switch_service_tag: "59HW8X2" |
| 23 |
override_LLDP_configuration: "Enabled" |
| 24 |
register: fabric_result |
| 25 |
delegate_to: localhost |
| 26 |
|
| 27 |
- name: Sleep for 300 seconds and continue with play |
| 28 |
ansible.builtin.wait_for: |
| 29 |
timeout: 300 |
| 30 |
when: not fabric_result.changed |
| 31 |
delegate_to: localhost |
| 32 |
|
| 33 |
- name: Create a template from a reference device service tag. |
| 34 |
dellemc.openmanage.ome_template: |
| 35 |
hostname: "{{ hostname }}" |
| 36 |
username: "{{ username }}" |
| 37 |
password: "{{ password }}" |
| 38 |
ca_path: "/path/to/ca_cert.pem" |
| 39 |
device_service_tag: "{{ src_service_tag }}" |
| 40 |
attributes: |
| 41 |
Name: "New_Template_2" |
| 42 |
Description: "New Template description" |
| 43 |
register: result |
| 44 |
failed_when: "'return_id' not in result" |
| 45 |
delegate_to: localhost |
| 46 |
|
| 47 |
- name: Get the job id using return id from template. |
| 48 |
dellemc.openmanage.ome_template_info: |
| 49 |
hostname: "{{ hostname }}" |
| 50 |
username: "{{ username }}" |
| 51 |
password: "{{ password }}" |
| 52 |
ca_path: "/path/to/ca_cert.pem" |
| 53 |
template_id: "{{ result.return_id }}" |
| 54 |
register: facts_result |
| 55 |
delegate_to: localhost |
| 56 |
|
| 57 |
- name: Get job details using job id from template task. |
| 58 |
dellemc.openmanage.ome_job_info: |
| 59 |
hostname: "{{ hostname }}" |
| 60 |
username: "{{ username }}" |
| 61 |
password: "{{ password }}" |
| 62 |
ca_path: "/path/to/ca_cert.pem" |
| 63 |
job_id: "{{ facts_result.template_info[hostname].TaskId }}" |
| 64 |
register: job_result |
| 65 |
failed_when: job_result.job_info.LastRunStatus.Name == 'Failed' |
| 66 |
changed_when: job_result.job_info.LastRunStatus.Name == 'Completed' |
| 67 |
until: job_result.job_info.LastRunStatus.Name == 'Completed' or job_result.job_info.LastRunStatus.Name == 'Failed' |
| 68 |
retries: "{{ retries_count }}" |
| 69 |
delay: "{{ polling_interval }}" |
| 70 |
delegate_to: localhost |
| 71 |
|
| 72 |
- name: Deploy template on multiple devices |
| 73 |
dellemc.openmanage.ome_template: |
| 74 |
hostname: "{{ hostname }}" |
| 75 |
username: "{{ username }}" |
| 76 |
password: "{{ password }}" |
| 77 |
ca_path: "/path/to/ca_cert.pem" |
| 78 |
command: "deploy" |
| 79 |
template_id: "{{ result.return_id }}" |
| 80 |
device_service_tag: |
| 81 |
- 6GHH6H1 |
| 82 |
- 6GHH6H2 |
| 83 |
register: deploy_result |
| 84 |
delegate_to: localhost |
| 85 |
|
| 86 |
- name: Sleep for 10 seconds and continue with play |
| 87 |
ansible.builtin.wait_for: |
| 88 |
timeout: 10 |
| 89 |
delegate_to: localhost |
| 90 |
|
| 91 |
- name: Track the deploy job till completion |
| 92 |
dellemc.openmanage.ome_job_info: |
| 93 |
hostname: "{{ hostname }}" |
| 94 |
username: "{{ username }}" |
| 95 |
password: "{{ password }}" |
| 96 |
ca_path: "/path/to/ca_cert.pem" |
| 97 |
job_id: "{{ deploy_result.return_id }}" |
| 98 |
register: deploy_job_result |
| 99 |
failed_when: "'job_info' not in deploy_job_result" |
| 100 |
until: deploy_job_result.job_info.LastRunStatus.Name == 'Completed' or deploy_job_result.job_info.LastRunStatus.Name == 'Failed' |
| 101 |
retries: "{{ retries_count }}" |
| 102 |
delay: "{{ polling_interval }}" |
| 103 |
delegate_to: localhost |
| 104 |
|
| 105 |
- name: Modify Server Interface Profile for the server using the service tag. |
| 106 |
dellemc.openmanage.ome_server_interface_profiles: |
| 107 |
hostname: "{{ hostname }}" |
| 108 |
username: "{{ username }}" |
| 109 |
password: "{{ password }}" |
| 110 |
ca_path: "/path/to/ca_cert.pem" |
| 111 |
device_service_tag: |
| 112 |
- 6GHH6H2 |
| 113 |
nic_teaming: NoTeaming |
| 114 |
nic_configuration: |
| 115 |
- nic_identifier: NIC.Mezzanine.1A-1-1 |
| 116 |
team: false |
| 117 |
untagged_network: 2 |
| 118 |
tagged_networks: |
| 119 |
names: |
| 120 |
- vlan |
| 121 |
delegate_to: localhost |
| 122 |
|
| 123 |
- name: Retrieves the server interface profiles of all the device using device service tag. |
| 124 |
dellemc.openmanage.ome_server_interface_profile_info: |
| 125 |
hostname: "{{ hostname }}" |
| 126 |
username: "{{ username }}" |
| 127 |
password: "{{ password }}" |
| 128 |
ca_path: "/path/to/ca_cert.pem" |
| 129 |
device_service_tag: |
| 130 |
- 6GHH6H2 |
| 131 |
delegate_to: localhost |