-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathserver_firmware.yml
55 lines (55 loc) · 1.98 KB
/
server_firmware.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
---
#
# The hosts group used is provided by the group variable or defaulted to 'Intersight_Servers'.
# You can specify a specific host (or host group) on the command line:
# ansible-playbook ... -e group=<your host group>
# e.g., ansible-playbook server_profiles.yml -e group=TME_Demo
#
- hosts: "{{ group | default('Intersight_Servers') }}"
connection: local
gather_facts: false
vars:
# Create an anchor for api_info that can be used throughout the file
api_info: &api_info
api_private_key: "{{ api_private_key }}"
api_key_id: "{{ api_key_id }}"
api_uri: "{{ api_uri | default(omit) }}"
validate_certs: "{{ validate_certs | default(omit) }}"
state: "{{ state | default(omit) }}"
tasks:
# Edit FW to be used as needed for server type below
- set_fact:
remote_file: ucs-c220m4-huu-4.0.2f.iso
when: model is search("UCSC-C220-M4.*")
- set_fact:
remote_file: ucs-c240m4-huu-4.0.2f.iso
when: model is search("UCSC-C240-M4.*")
- set_fact:
remote_file: ucs-c240m5-huu-4.0.4f.iso
when: model is search("UCSC-C240-M5.*")
# Update server firmware with a post based on server moid
- name: Update server firmware
intersight_rest_api:
<<: *api_info
resource_path: /firmware/Upgrades
query_params:
$filter: "Server.Moid eq '{{ server_moid }}'"
update_method: post
# nw_upgrade_full supported in UI, nw_upgrade_mount_only has partial API support
api_body: {
"NetworkShare": {
"MapType": "nfs",
"Upgradeoption": "nw_upgrade_mount_only",
"NfsServer": {
"RemoteIp": "172.28.224.77",
"RemoteShare": "/mnt/SHARE/ISOS/HUU/4.0",
"RemoteFile": "{{ remote_file }}"
}
},
"UpgradeType": "network_upgrade",
"Server": {
"Moid": "{{ server_moid }}"
}
}
delegate_to: localhost
when: server_moid is defined