-
Notifications
You must be signed in to change notification settings - Fork 1
/
ome-provision-mx-template.yml
executable file
·91 lines (85 loc) · 2.87 KB
/
ome-provision-mx-template.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
---
- hosts: mx-chassis
connection: local
name: Provision Host
gather_facts: False
vars:
ansible_managed: "Created by Ansible on {{ '%Y-%m-%d %H:%M:%S' | strftime }}"
template_name: "002Test"
template_identity_pool: "mx840c Test"
device_servicetag: "F1SW673"
vars_files:
- vault.yml
tasks:
- name: Delete template
dellemc.openmanage.ome_template:
hostname: "{{ hostname }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
command: "delete"
template_name: "{{ template_name }}"
tags:
- import
- name: Create template from device
dellemc.openmanage.ome_template:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
command: "create"
device_service_tag: "{{ device_servicetag }}"
attributes:
Name: "{{ template_name }}"
Description: "{{ ansible_managed }}"
register: output
tags:
- import
- debug:
var: output
- name: Wait for template to be created
dellemc.openmanage.ome_template_info:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
template_id: "{{ output.return_id }}"
register: output_job
failed_when: output_job.template_info[hostname].Status == 2070
changed_when: output_job.template_info[hostname].Status == 2060
until: output_job.template_info[hostname].Status in [2060, 2070, 2090, 2100, 2101, 2102, 2103]
retries: 90
delay: 10 # 15 Minutes
tags:
- import
- debug:
var: output_job
- name: Assign VLANs to template
dellemc.openmanage.ome_template_network_vlan:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
template_name: "{{ template_name }}"
nic_identifier: "NIC in Mezzanine 1A"
untagged_networks:
- port: 1
untagged_network_name: PGNet
- port: 2
untagged_network_name: PGNet
tagged_networks:
- port: 1
tagged_network_names:
- "VLAN 1002"
- "VLAN 1003"
- port: 2
tagged_network_names:
- "VLAN 1002"
- "VLAN 1003"
tags:
- vlan
- name: Attach identity pool to template
dellemc.openmanage.ome_template_identity_pool:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
template_name: "{{ template_name }}"
identity_pool_name: "{{ template_identity_pool }}"
tags:
- identity_pool