Skip to content

Commit

Permalink
fix(lint): fixed the lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: sakethanne <[email protected]>
  • Loading branch information
Sakethanne authored and glimchb committed Oct 2, 2024
1 parent 1ce9aee commit 67c3dfe
Show file tree
Hide file tree
Showing 6 changed files with 380 additions and 175 deletions.
82 changes: 42 additions & 40 deletions ansible/bios.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2022 Dell Inc, or its subsidiaries.
---

- name:
- name: Run BIOS Configuration
hosts: hostbmcs
become: yes
become: true
tasks:
- name: Get Firmware Inventory
community.general.redfish_info:
Expand All @@ -16,7 +15,8 @@
register: result

- name: Debug print first firmware entry version
ansible.builtin.debug: var=result.redfish_facts.firmware.entries[0].Version
ansible.builtin.debug:
var: result.redfish_facts.firmware.entries[0].Version

- name: Get BIOS attributes
community.general.redfish_info:
Expand All @@ -28,64 +28,66 @@
register: result

- name: Debug print bios serial number
ansible.builtin.debug: msg={{ result.redfish_facts.bios_attribute.entries[0][1].SerialNumber | default(result.redfish_facts.bios_attribute.entries[0][1].SystemServiceTag) }}

ansible.builtin.debug:
msg: >
{{ result.redfish_facts.bios_attribute.entries[0][1].SerialNumber
| default(result.redfish_facts.bios_attribute.entries[0][1].SystemServiceTag) }}
# TODO: configre BIOS to be always on ( see lab/hardware/dh123) and any virtualization or hyper threading settings we might need

- name: Debug print bios attributes
ansible.builtin.debug: msg={{ result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer }}
ansible.builtin.debug:
msg: "{{ result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer }}"
when: result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer is defined

# Updating Bios attributes in host BMCs
- name: Set BIOS attributes
community.general.redfish_config:
category: Systems
resource_id: "{{ resource_id }}"
command: SetBiosAttributes
bios_attributes: "{{ bios_attributes }}"
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
category: Systems
resource_id: "{{ resource_id }}"
command: SetBiosAttributes
bios_attributes: "{{ bios_attributes }}"
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
register: bios_attribute

# DELL iDRAC ONLY: Updating BIOS settings requires creating a configuration job
# to schedule the BIOS update, so comment out below for non-Dell systems.

- name: Create BIOS configuration job (schedule BIOS setting update)
when:
- result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer is defined
- result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer == "Dell Inc."
when:
- result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer is defined
- result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer == "Dell Inc."
- bios_attribute.changed
community.general.idrac_redfish_command:
category: Systems
command: CreateBiosConfigJob
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
category: Systems
command: CreateBiosConfigJob
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
register: bios_config_job

- name: Reboot iDRAC systems to apply new BIOS settings
when:
- result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer is defined
- result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer == "Dell Inc."
when:
- result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer is defined
- result.redfish_facts.bios_attribute.entries[0][1].SystemManufacturer == "Dell Inc."
- bios_config_job.changed
community.general.redfish_command:
category: Systems
command: PowerReboot
resource_id: "{{ resource_id }}"
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
category: Systems
command: PowerReboot
resource_id: "{{ resource_id }}"
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"

# TODO: Merge two reboot tasks into one. find identifier for iLO in redfish bios attributes
# TODO: Merge two reboot tasks into one. find identifier for iLO in redfish bios attributes
- name: Reboot iLO systems to apply new BIOS settings
when:
when:
- bios_attribute.changed
- inventory_hostname == 'dh2bmc' or inventory_hostname == 'dh3bmc'
community.general.redfish_command:
category: Systems
command: PowerReboot
resource_id: "{{ resource_id }}"
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
category: Systems
command: PowerReboot
resource_id: "{{ resource_id }}"
baseuri: "{{ ansible_host }}"
username: "{{ ansible_user }}"
password: "{{ ansible_password }}"
44 changes: 22 additions & 22 deletions ansible/f5certs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@
ssl_key_location: "/etc/letsencrypt/live/{{domain_name}}/privkey.pem"

tasks:
- name: Setup provider
ansible.builtin.set_fact:
provider:
server: "{{ ansible_host }}"
user: "{{ ansible_user }}"
password: "{{ ansible_password }}"
server_port: "{{ server_port }}"
no_f5_teem: yes
validate_certs: "no"
- name: Setup provider
ansible.builtin.set_fact:
provider:
server: "{{ ansible_host }}"
user: "{{ ansible_user }}"
password: "{{ ansible_password }}"
server_port: "{{ server_port }}"
no_f5_teem: true
validate_certs: "no"

#SSL Upload and Modification of VIP to use New Certificate
- name: Upload New SSL cert upload
f5networks.f5_modules.bigip_ssl_certificate:
provider: "{{ provider }}"
name: "{{ cert_list_name }}"
content: "{{ lookup('file', ssl_cert_location ) }}"
delegate_to: localhost
# SSL Upload and Modification of VIP to use New Certificate
- name: Upload New SSL cert upload
f5networks.f5_modules.bigip_ssl_certificate:
provider: "{{ provider }}"
name: "{{ cert_list_name }}"
content: "{{ lookup('file', ssl_cert_location) }}"
delegate_to: localhost

- name: Upload New SSL key upload
f5networks.f5_modules.bigip_ssl_key:
provider: "{{ provider }}"
name: "{{ cert_list_name }}"
content: "{{ lookup('file', ssl_key_location ) }}"
delegate_to: localhost
- name: Upload New SSL key upload
f5networks.f5_modules.bigip_ssl_key:
provider: "{{ provider }}"
name: "{{ cert_list_name }}"
content: "{{ lookup('file', ssl_key_location) }}"
delegate_to: localhost
Loading

0 comments on commit 67c3dfe

Please sign in to comment.