From 95b47f8b09d97a2c1a16cd5d11dc24191b98f68f Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:42:28 -0400 Subject: [PATCH] Fix a few more extraneous splits Just use this_node if applicable, or the raw node.hostname. --- roles/base/templates/etc/network/interfaces.d/ipmi.j2 | 6 +++--- roles/pvc/handlers/main.yml | 4 ++-- roles/pvc/tasks/ceph/bootstrap.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/base/templates/etc/network/interfaces.d/ipmi.j2 b/roles/base/templates/etc/network/interfaces.d/ipmi.j2 index 6cca726..1fa912e 100644 --- a/roles/base/templates/etc/network/interfaces.d/ipmi.j2 +++ b/roles/base/templates/etc/network/interfaces.d/ipmi.j2 @@ -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.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'] }} + pre-up ipmitool lan set 1 ipaddr {{ ipmi['hosts'][this_node]['address'] }} + pre-up ipmitool lan set 1 netmask {{ ipmi['hosts'][this_node]['netmask'] }} + pre-up ipmitool lan set 1 defgw ipaddr {{ ipmi['hosts'][this_node]['gateway'] }} diff --git a/roles/pvc/handlers/main.yml b/roles/pvc/handlers/main.yml index 6d7fb51..1c8bfeb 100644 --- a/roles/pvc/handlers/main.yml +++ b/roles/pvc/handlers/main.yml @@ -34,11 +34,11 @@ # Note that this only applies to coordinators; hypervisor-only nodes restart immediately in # parallel, and the first two of three handlers do not apply to hypervisor-only nodes. - name: restart ceph-mon - shell: "{% if is_coordinator %}sleep {{ 30 * (hostvars[inventory_hostname].ansible_local.host_id|int - 1) }} && systemctl restart ceph-mon@{{ inventory_hostname.split('.')[0] }}.service{% endif %}" + shell: "{% if is_coordinator %}sleep {{ 30 * (hostvars[inventory_hostname].ansible_local.host_id|int - 1) }} && systemctl restart ceph-mon@{{ this_node }}.service{% endif %}" ignore_errors: true - name: restart ceph-mgr - shell: "{% if is_coordinator %}sleep {{ 30 * (hostvars[inventory_hostname].ansible_local.host_id|int - 1) }} && systemctl restart ceph-mgr@{{ inventory_hostname.split('.')[0] }}.service{% endif %}" + shell: "{% if is_coordinator %}sleep {{ 30 * (hostvars[inventory_hostname].ansible_local.host_id|int - 1) }} && systemctl restart ceph-mgr@{{ this_node }}.service{% endif %}" ignore_errors: true - name: restart pvcnoded diff --git a/roles/pvc/tasks/ceph/bootstrap.yml b/roles/pvc/tasks/ceph/bootstrap.yml index cdaf596..9bc182c 100644 --- a/roles/pvc/tasks/ceph/bootstrap.yml +++ b/roles/pvc/tasks/ceph/bootstrap.yml @@ -21,7 +21,7 @@ with_items: - "[global]" - "fsid = {{ fsid }}" - - "mon initial members = {% for node in pvc_nodes if node.is_coordinator %}{{ node.hostname.split('.')[0] }}{% if not loop.last %},{% endif %}{% endfor %}" + - "mon initial members = {% for node in pvc_nodes if node.is_coordinator %}{{ node.hostname }}{% if not loop.last %},{% endif %}{% endfor %}" - "mon host = {% for host in pvc_nodes if host.is_coordinator %}{{ host.storage_ip }}{% if not loop.last %},{% endif %}{% endfor %}" - name: create temporary directory @@ -45,7 +45,7 @@ command: ceph-authtool /tmp/ceph-bootstrap/ceph.mon.keyring --import-keyring /tmp/ceph-bootstrap/ceph.osd.bootstrap.keyring - name: create monmap - command: monmaptool --create --fsid {{ fsid }} {% for node in pvc_nodes if node.is_coordinator %}--add {{ node.hostname.split('.')[0] }} {{ node.storage_ip }} {% endfor %} /tmp/ceph-bootstrap/monmap + command: monmaptool --create --fsid {{ fsid }} {% for node in pvc_nodes if node.is_coordinator %}--add {{ node.hostname }} {{ node.storage_ip }} {% endfor %} /tmp/ceph-bootstrap/monmap - name: copy initial ceph.conf to the boostrap directory copy: