diff --git a/roles/pvc/handlers/main.yml b/roles/pvc/handlers/main.yml index 473f7d6..e03c411 100644 --- a/roles/pvc/handlers/main.yml +++ b/roles/pvc/handlers/main.yml @@ -33,14 +33,14 @@ # 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 {{ 15 * (hostvars[ansible_hostname].ansible_local.host_id|int - 1) }} && systemctl restart ceph-mon@{{ ansible_hostname }}.service{% endif %}" + shell: "{% if is_coordinator %}sleep {{ 15 * (hostvars[inventory_hostname].ansible_local.host_id|int - 1) }} && systemctl restart ceph-mon@{{ inventory_hostname.split('.')[0] }}.service{% endif %}" ignore_errors: true - name: restart ceph-mgr - shell: "{% if is_coordinator %}sleep {{ 15 * (hostvars[ansible_hostname].ansible_local.host_id|int - 1) }} && systemctl restart ceph-mgr@{{ ansible_hostname }}.service{% endif %}" + shell: "{% if is_coordinator %}sleep {{ 15 * (hostvars[inventory_hostname].ansible_local.host_id|int - 1) }} && systemctl restart ceph-mgr@{{ inventory_hostname.split('.')[0] }}.service{% endif %}" ignore_errors: true - name: restart pvcnoded - shell: "{% if is_coordinator %}sleep {{ 15 * (hostvars[ansible_hostname].ansible_local.host_id|int - 1) }} &&{% endif %} systemctl restart pvcnoded.service" + shell: "{% if is_coordinator %}sleep {{ 15 * (hostvars[inventory_hostname].ansible_local.host_id|int - 1) }} &&{% endif %} systemctl restart pvcnoded.service" ignore_errors: true when: bootstrap is not defined diff --git a/roles/pvc/tasks/ceph/bootstrap.yml b/roles/pvc/tasks/ceph/bootstrap.yml index 8e167e2..c3b7434 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 host in pvc_nodes if host.is_coordinator %}{{ host.hostname }}{% if not loop.last %},{% endif %}{% endfor %}" + - "mon initial members = {% for node in pvc_nodes if node.is_coordinator %}{{ node.hostname.split('.')[0] }}{% 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 }} {{ 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.split('.')[0] }} {{ node.storage_ip }} {% endfor %} /tmp/ceph-bootstrap/monmap - name: copy initial ceph.conf to the boostrap directory copy: