diff --git a/docker/services/ceph-ansible/ceph-base.yaml b/docker/services/ceph-ansible/ceph-base.yaml index 52893cca4f..7d7848a2a8 100644 --- a/docker/services/ceph-ansible/ceph-base.yaml +++ b/docker/services/ceph-ansible/ceph-base.yaml @@ -382,24 +382,23 @@ outputs: content: | {%- set ceph_groups = ['mgr', 'mon', 'osd', 'mds', 'rgw', 'nfs', 'rbdmirror', 'client'] -%} {%- for ceph_group in ceph_groups -%} - {%- if 'ceph_' ~ ceph_group in groups %} + {%- if 'ceph_' ~ ceph_group in groups -%} + {%- set ceph_group_hosts = groups['ceph_' ~ ceph_group] | difference(blacklisted_hostnames) -%} + {%- if ceph_group_hosts|length > 0 %} {{ ceph_group ~ 's:' }} hosts: - {% for host in groups['ceph_' ~ ceph_group] -%} - {%- if hostvars.raw_get(host)['ansible_hostname'] is defined -%} - {%- if hostvars.raw_get(host)['ansible_hostname'] not in blacklisted_hostnames -%} - {{ hostvars.raw_get(host)['ansible_hostname'] }}: + {% for host in ceph_group_hosts -%} + {{ host }}: ansible_user: {{ hostvars.raw_get(host)['ansible_ssh_user'] | default('root') }} ansible_host: {{ hostvars.raw_get(host)['ansible_host'] | default(host) }} ansible_become: true - {% if hostvars.raw_get(host)['ansible_connection'] | default('') == 'local' -%} + {% if hostvars.raw_get(host)['ansible_connection'] | default('') == 'local' -%} ansible_connection: local - {% endif -%} - {% endif -%} - {% endif -%} - {%- endfor -%} + {%- endif %} + {% endfor -%} + {%- endif -%} {%- endif -%} {%- endfor %} - name: set ceph-ansible group vars all