-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsns-firmware-update.yaml
63 lines (53 loc) · 1.79 KB
/
sns-firmware-update.yaml
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
---
- hosts: localhost
connection: local
vars:
download_folder: "{{ lookup('env', 'HOME') }}/Downloads"
version: 3.7.2
arch: amd64
model: M-VM
appliance:
host: 10.60.3.75
user: admin
password: adminadmin
sslverifyhost: False
tasks:
- name: Get appliance information
sns_command:
appliance: "{{ appliance }}"
command: SYSTEM PROPERTY
register: sysprop
- name: Extract version
sns_getconf:
result: "{{ sysprop.result }}"
section: Result
token: Version
register: myversion
- name: Check for HA cluster
sns_command:
appliance: "{{ appliance }}"
command: HA INFO
register: hainfo
- name: Check if firmware is not already installed
fail: msg="Firmware already installed"
when: "version == myversion.value"
- name: Check if appliance firmware is not more recent
fail: msg="Firmware on appliance is more recent"
when: "myversion.value is version(version, '>')"
- name: Check if firmware update is already downloaded
stat:
path: "{{ download_folder }}/fwupd-{{ version }}-SNS-{{ arch }}-{{ model }}.maj"
register: firmware_file
- name: Download firmware from mystormshield
get_url:
url: "http://data.stormshield.eu/data2/sns/Firmwares/{{ version }}/fwupd-{{ version }}-SNS-{{ arch }}-{{ model }}.maj"
dest: "{{ download_folder }}"
when: firmware_file.stat.exists == False
- debug:
msg: "Updating firmware from {{ myversion.value }} to {{ version }}"
- name: Update appliance
include: sns-firmware-update-single-task.yaml
when: "hainfo.ret == 200"
- name: Update cluster
include: sns-firmware-update-cluster-task.yaml
when: "hainfo.ret == 100"