Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the environment parameters setting in monitoring.yml file #64

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions ansible/bios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,9 @@
password: "{{ ansible_password }}"
register: bios_config_job

- name: Reboot iDRAC systems to apply new BIOS settings
- name: Reboot all 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."
- 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 }}"

# 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:
- bios_attribute.changed
- inventory_hostname == 'dh2bmc' or inventory_hostname == 'dh3bmc'
- bios_config_job.changed or bios_attribute.changed
community.general.redfish_command:
category: Systems
command: PowerReboot
Expand Down
45 changes: 25 additions & 20 deletions ansible/monitoring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
name: requests
version: "<2.32"

- name: Define telegraf environment variables (only if not mev or bf2)
when: inventory_hostname not in ['mev', 'bf2']
ansible.builtin.set_fact:
telegraf_env:
REDFISH_HOST: "{{ bmc_vars.ansible_host }}"
REDFISH_USER: "{{ bmc_vars.ansible_user }}"
REDFISH_PASSWORD: "{{ bmc_vars.ansible_password }}"
REDFISH_SYSTEM_ID: "{{ bmc_vars.resource_id }}"

- name: Run telegraf container on all hosts
community.docker.docker_container:
name: telegraf
Expand All @@ -59,34 +68,30 @@
[
{
'type': 'bind',
'source': inventory_hostname in ['bf2', 'mev'] and '/root/telegraf.d/telegraf.conf.inventory_hostname' or
'/root/telegraf.d',
'target': inventory_hostname in ['bf2', 'mev'] and '/etc/telegraf/telegraf.conf' or
'/etc/telegraf/telegraf.d',
'source': (
'/root/telegraf.d/telegraf.conf.' + inventory_hostname
if inventory_hostname in ['bf2', 'mev']
else '/root/telegraf.d'
),
'target': (
'/etc/telegraf/telegraf.conf'
if inventory_hostname in ['bf2', 'mev']
else '/etc/telegraf/telegraf.d'
),
'read_only': True
}
]
+ (
] + (
[
{
'type': 'bind',
'source': '/run/emu_param',
'target': '/run/emu_param',
'read_only': True
}
]
if inventory_hostname == 'bf2' else []
] if inventory_hostname == 'bf2' else []
)
}}

- name: Set telegraf container parameters on dh1, dh2, dh3, dh4
when:
- inventory_hostname != 'mev'
- inventory_hostname != 'bf2'
community.docker.docker_container:
name: telegraf
env:
REDFISH_HOST: "{{ bmc_vars.ansible_host }}"
REDFISH_USER: "{{ bmc_vars.ansible_user }}"
REDFISH_PASSWORD: "{{ bmc_vars.ansible_password }}"
REDFISH_SYSTEM_ID: "{{ bmc_vars.resource_id }}"
env: >
{{
telegraf_env if inventory_hostname not in ['mev', 'bf2'] else {}
}}
Loading