-
Notifications
You must be signed in to change notification settings - Fork 1
/
ome-provision-server.yml
executable file
·100 lines (92 loc) · 3.32 KB
/
ome-provision-server.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
92
93
94
95
96
97
98
99
100
---
- hosts: mx-sleds
connection: local
name: Provision Host
gather_facts: False
vars:
baseline_name: "MX_Sled_{{ service_tag }}"
catalog_name: "Dell.com"
template_name: "MX740c_New"
share_ip:
share_path:
vars_files:
- vault.yml
tasks:
- name: Power On Server
dellemc.openmanage.ome_powerstate:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
device_service_tag: "{{ service_tag }}"
power_state: "on"
- name: Create baseline
dellemc.openmanage.ome_firmware_baseline:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
baseline_name: "{{ baseline_name }}"
catalog_name: "{{ catalog_name }}"
device_service_tags:
- "{{ service_tag }}"
ignore_errors: true
- name: Wait for baseline creation
pause:
seconds: 10
- name: Update firmware using baseline
dellemc.openmanage.ome_firmware:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
baseline_name: "{{ baseline_name }}"
register: firmware_update
ignore_errors: True
- name: Wait on Firmware Update Job to Complete
dellemc.openmanage.ome_job_info:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
job_id: "{{ firmware_update.update_status.Id }}"
register: firmware_update_job
failed_when: firmware_update_job.job_info.LastRunStatus.Name == 'Failed'
changed_when: firmware_update_job.job_info.LastRunStatus.Name == 'Completed'
until: firmware_update_job.job_info.LastRunStatus.Name in ['Completed', 'Failed', 'Warning', 'Aborted', 'Paused', 'Stopped', 'Cancelled']
retries: 90
delay: 10 # 15 Minutes
when: firmware_update.changed == True
- name: Deploy Template
dellemc.openmanage.ome_template:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
command: "deploy"
template_name: "{{ template_name }}"
device_service_tag:
- "{{ service_tag }}"
attributes:
NetworkBootIsoModel:
BootToNetwork: true
ShareType: "NFS"
IsoPath: "/mnt/data/iso/CentOS7-Unattended.iso"
IsoTimeout: 1 # Hour
ShareDetail:
IpAddress: "{{ vault_share_host }}"
ShareName: "iso"
User: ""
Password: ""
register: output_deploy
- debug:
var: output_deploy
- name: Wait on Deploy Job to Complete
dellemc.openmanage.ome_job_info:
hostname: "{{ vault_ome_host }}"
username: "{{ vault_ome_username }}"
password: "{{ vault_ome_password }}"
job_id: "{{ output_deploy.return_id }}"
register: output_job
failed_when: output_job.job_info.LastRunStatus.Name == 'Failed'
changed_when: output_job.job_info.LastRunStatus.Name == 'Completed'
until: output_job.job_info.LastRunStatus.Name in ['Completed', 'Failed', 'Warning', 'Aborted', 'Paused', 'Stopped', 'Cancelled']
retries: 90
delay: 10 # 15 Minutes
- debug:
var: output_job