Use inventory_hostname for IPMI dict

This commit is contained in:
Joshua Boniface 2023-09-01 15:42:26 -04:00
parent 6104e0a5a5
commit a548bdcc6a
3 changed files with 9 additions and 9 deletions

View File

@ -35,19 +35,19 @@ ipmi:
username: "host" username: "host"
password: "" password: ""
hosts: hosts:
"pvchv1": "pvchv1": # Use the inventory hostname here
hostname: pvchv1-lom # A valid short name (e.g. from /etc/hosts) or an FQDN must be hostname: pvchv1-lom # A valid short name (e.g. from /etc/hosts) or an FQDN must be
# used here; PVC connects to this *hostname* for fencing. # used here; PVC connects to this *hostname* for fencing.
address: 192.168.100.101 address: 192.168.100.101
netmask: 255.255.255.0 netmask: 255.255.255.0
gateway: 192.168.100.1 gateway: 192.168.100.1
"pvchv2": "pvchv2": # Use the inventory hostname here
hostname: pvchv2-lom # A valid short name (e.g. from /etc/hosts) or an FQDN must be hostname: pvchv2-lom # A valid short name (e.g. from /etc/hosts) or an FQDN must be
# used here; PVC connects to this *hostname* for fencing. # used here; PVC connects to this *hostname* for fencing.
address: 192.168.100.102 address: 192.168.100.102
netmask: 255.255.255.0 netmask: 255.255.255.0
gateway: 192.168.100.1 gateway: 192.168.100.1
"pvchv3": "pvchv3": # Use the inventory hostname here
hostname: pvchv3-lom # A valid short name (e.g. from /etc/hosts) or an FQDN must be hostname: pvchv3-lom # A valid short name (e.g. from /etc/hosts) or an FQDN must be
# used here; PVC connects to this *hostname* for fencing. # used here; PVC connects to this *hostname* for fencing.
address: 192.168.100.103 address: 192.168.100.103

View File

@ -93,7 +93,7 @@ pvc_nodes:
upstream_ip: "192.168.100.11" upstream_ip: "192.168.100.11"
cluster_ip: "10.0.0.1" cluster_ip: "10.0.0.1"
storage_ip: "10.0.1.1" storage_ip: "10.0.1.1"
ipmi_host: "{{ ipmi['hosts']['pvchv1']['hostname'] }}" # Note the node hostname key in here ipmi_host: "{{ ipmi['hosts']['pvchv1']['hostname'] }}" # Note the node inventory hostname key in here
ipmi_user: "{{ ipmi['users']['pvc']['username'] }}" ipmi_user: "{{ ipmi['users']['pvc']['username'] }}"
ipmi_password: "{{ ipmi['users']['pvc']['password'] }}" ipmi_password: "{{ ipmi['users']['pvc']['password'] }}"
- hostname: "pvchv2" - hostname: "pvchv2"
@ -103,7 +103,7 @@ pvc_nodes:
upstream_ip: "192.168.100.12" upstream_ip: "192.168.100.12"
cluster_ip: "10.0.0.2" cluster_ip: "10.0.0.2"
storage_ip: "10.0.1.2" storage_ip: "10.0.1.2"
ipmi_host: "{{ ipmi['hosts']['pvchv2']['hostname'] }}" # Note the node hostname key in here ipmi_host: "{{ ipmi['hosts']['pvchv2']['hostname'] }}" # Note the node inventory hostname key in here
ipmi_user: "{{ ipmi['users']['pvc']['username'] }}" ipmi_user: "{{ ipmi['users']['pvc']['username'] }}"
ipmi_password: "{{ ipmi['users']['pvc']['password'] }}" ipmi_password: "{{ ipmi['users']['pvc']['password'] }}"
- hostname: "pvchv3" - hostname: "pvchv3"
@ -113,7 +113,7 @@ pvc_nodes:
upstream_ip: "192.168.100.13" upstream_ip: "192.168.100.13"
cluster_ip: "10.0.0.3" cluster_ip: "10.0.0.3"
storage_ip: "10.0.1.3" storage_ip: "10.0.1.3"
ipmi_host: "{{ ipmi['hosts']['pvchv3']['hostname'] }}" # Note the node hostname key in here ipmi_host: "{{ ipmi['hosts']['pvchv3']['hostname'] }}" # Note the node inventory hostname key in here
ipmi_user: "{{ ipmi['users']['pvc']['username'] }}" ipmi_user: "{{ ipmi['users']['pvc']['username'] }}"
ipmi_password: "{{ ipmi['users']['pvc']['password'] }}" ipmi_password: "{{ ipmi['users']['pvc']['password'] }}"

View File

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