diff --git a/ansible/bios.yml b/ansible/bios.yml index d908049..1b284ed 100644 --- a/ansible/bios.yml +++ b/ansible/bios.yml @@ -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 diff --git a/ansible/monitoring.yml b/ansible/monitoring.yml index b2c44c7..5e17627 100644 --- a/ansible/monitoring.yml +++ b/ansible/monitoring.yml @@ -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 @@ -59,14 +68,19 @@ [ { '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', @@ -74,19 +88,10 @@ '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 {} + }}