Unify and standardize inventory_hostname

This was causing some confusing conflicts, so create a new fact called
"this_node" which is inventory_hostname.split('.')[0], i.e. the short
name, and use that everywhere instead of an FQDN or true inventory
hostname.
This commit is contained in:
2023-09-01 15:42:28 -04:00
parent 5de3ab0c3a
commit d24cb8a8ef
11 changed files with 47 additions and 37 deletions

View File

@ -15,9 +15,14 @@
when: newhost_check.changed
tags: always
# Set this_node fact
- set_fact:
this_node: "{{ inventory_hostname.split('.')[0] }}"
tags: always
# Set coordinator state fact
- set_fact:
is_coordinator: "{% for node in pvc_nodes if node.hostname == inventory_hostname %}{{ node.is_coordinator }}{% endfor %}"
is_coordinator: "{% for node in pvc_nodes if node.hostname == this_node %}{{ node.is_coordinator }}{% endfor %}"
tags: always
#

View File

@ -1,5 +1,5 @@
iface ipmi inet manual
pre-up ipmitool lan set 1 ipsrc static
pre-up ipmitool lan set 1 ipaddr {{ ipmi['hosts'][inventory_hostname]['address'] }}
pre-up ipmitool lan set 1 netmask {{ ipmi['hosts'][inventory_hostname]['netmask'] }}
pre-up ipmitool lan set 1 defgw ipaddr {{ ipmi['hosts'][inventory_hostname]['gateway'] }}
pre-up ipmitool lan set 1 ipaddr {{ ipmi['hosts'][inventory_hostname.split('.')[0]]['address'] }}
pre-up ipmitool lan set 1 netmask {{ ipmi['hosts'][inventory_hostname.split('.')[0]]['netmask'] }}
pre-up ipmitool lan set 1 defgw ipaddr {{ ipmi['hosts'][inventory_hostname.split('.')[0]]['gateway'] }}