Merge "Do not fail on non existent ansible group"

This commit is contained in:
Zuul 2018-06-15 11:36:21 +00:00 committed by Gerrit Code Review
commit 2075455dde
2 changed files with 2 additions and 2 deletions

View File

@ -97,7 +97,7 @@ outputs:
template: |
masters:
hosts:
{% for host in groups['ROLENAME'] -%}
{% for host in groups['ROLENAME'] | default([]) -%}
{{ hostvars.raw_get(host)['ansible_hostname'] }}:
ansible_user: {{ hostvars.raw_get(host)['ansible_user'] | default(hostvars.raw_get(host)['ansible_ssh_user']) | default('root') }}
ansible_host: {{ hostvars.raw_get(host)['ansible_host'] | default(host) }}

View File

@ -77,7 +77,7 @@ outputs:
template: |
nodes:
hosts:
{% for host in groups['ROLENAME'] -%}
{% for host in groups['ROLENAME'] | default([]) -%}
{{ hostvars.raw_get(host)['ansible_hostname'] }}:
ansible_user: {{ hostvars.raw_get(host)['ansible_user'] | default(hostvars.raw_get(host)['ansible_ssh_user']) | default('root') }}
ansible_host: {{ hostvars.raw_get(host)['ansible_host'] | default(host) }}