ipa/client: Don't trip over undefined group vars

With set_facts, if an element of a list is undefined, the containing
fact variable becomes a string. Something Sirius Cybernetics Corporation
something something.

Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
Nils Philippsen 2021-02-16 19:20:29 +01:00
parent c394c808e6
commit 2e6819354f
4 changed files with 6 additions and 14 deletions

View file

@ -36,6 +36,6 @@
ipaadmin_password: "{{ ipa_server_admin_passwords[item[0]] }}" ipaadmin_password: "{{ ipa_server_admin_passwords[item[0]] }}"
action: member action: member
state: present state: present
host: "{{ item[4] | list }}" host: "{{ item[2] | list }}"
loop: "{{ ipa_server_host_user_groups_hosts }}" loop: "{{ ipa_server_host_groups_hosts }}"
when: ipa_server_host_user_groups_hosts is defined when: ipa_server_host_groups_hosts is defined

View file

@ -120,4 +120,4 @@
state: present state: present
group: "{{ ipa_server_host_groups_dict[item[0]][item[1]]['shell_groups'] }}" group: "{{ ipa_server_host_groups_dict[item[0]][item[1]]['shell_groups'] }}"
loop: "{{ ipa_server_host_groups }}" loop: "{{ ipa_server_host_groups }}"
when: ipa_server_host_groups is defined when: ipa_server_host_groups is defined and ipa_server_host_groups_dict[item[0]][item[1]]['shell_groups'] is defined

View file

@ -120,28 +120,22 @@
loop: "{{ ipa_server_all_groups_hosts_dict | dict2items }}" loop: "{{ ipa_server_all_groups_hosts_dict | dict2items }}"
when: ipa_server_all_groups_hosts_dict is defined when: ipa_server_all_groups_hosts_dict is defined
# ipa_server_host_user_groups_hosts -> # ipa_server_host_groups_hosts ->
# [ # [
# [ # [
# "ipa_server_1", # "ipa_server_1",
# "host_group_1", # "host_group_1",
# ["user_group_1", ...], # <-- shell access user groups
# ["user_group_2", ...], # <-- sudo access user groups
# ["host_1", ...], # ["host_1", ...],
# ], # ],
# [ # [
# "ipa_server_1", # "ipa_server_1",
# "host_group_2", # "host_group_2",
# ["user_group_3", ...],
# ["user_group_4", ...],
# ["host_2", ...], # ["host_2", ...],
# ], # ],
# ... # ...
# [ # [
# "ipa_server_2", # "ipa_server_2",
# "host_group_1", # "host_group_1",
# ["user_group_5", ...],
# ["user_group_6", ...],
# ["host_3", ...], # ["host_3", ...],
# ], # ],
# ... # ...
@ -155,8 +149,6 @@
[ [
item[0], item[0],
item[1], item[1],
ipa_server_host_groups_dict[item[0]][item[1]]['shell_groups'],
ipa_server_host_groups_dict[item[0]][item[1]]['sudo_groups'],
ipa_server_host_groups_dict[item[0]][item[1]]['hosts'] | list, ipa_server_host_groups_dict[item[0]][item[1]]['hosts'] | list,
] ]
] ]

View file

@ -31,4 +31,4 @@
runasusercategory: "all" runasusercategory: "all"
runasgroupcategory: "all" runasgroupcategory: "all"
loop: "{{ ipa_server_host_groups }}" loop: "{{ ipa_server_host_groups }}"
when: ipa_server_host_groups is defined when: ipa_server_host_groups is defined and ipa_server_host_groups_dict[item[0]][item[1]]['sudo_groups'] is defined