Skip hosts group in ceph-ansible inventory when all are blacklisted
Ensures the hosts group is not created in the ceph-ansible inventory if all nodes of a given group are blacklisted. Closes-Bug: 1798044 Change-Id: Ibf25e28d02cee6308f3e9a2660e001ba73d756c0
This commit is contained in:
parent
635068aad4
commit
5bcfb71146
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user