Conversation
ivarmu
commented
Mar 12, 2026
- Fix the lifecycle_environments role so the loop is correctly defined
- The auth_sources_ldap role is sending incompatible parameters when the server_type is active_directory
| state: "{{ item.state | default('present') }}" | ||
| with_items: | ||
| - "{{ foreman_lifecycle_environments }}" | ||
| loop: "{{ foreman_lifecycle_environments }}" |
There was a problem hiding this comment.
Aren't those identical in the result?
There was a problem hiding this comment.
with_items is replaced by loop and should be updated. It's equivalent, but here was badly written (although it was working nice, curiously). The correct form would be:
with_items: "{{ foreman_lifecycle_environments }}"In the original code, it was looping over the list contained into the first element of the provided list... like making an auto-flatten of the input list...
I prefer to have that fixed :-)
There was a problem hiding this comment.
Yes, with_items does an implicit flatten: https://docs.ansible.com/projects/ansible/latest/playbook_guide/playbooks_loops.html#comparing-loops
I was just looking whether this fixes a bug (as in: bad behavior) or just cleans up things :)
| ldap_filter: "{{ item.ldap_filter | default(omit) }}" | ||
| use_netgroups: "{{ item.use_netgroups | default(omit) }}" | ||
| use_netgroups: "{{ omit if item.server_type is match('active_directory') else item.use_netgroups | default(omit) }}" | ||
| ldap_group_membership: "{{ omit if item.server_type is not match('posix') else item.ldap_group_membership | default(omit) }}" |
There was a problem hiding this comment.
server_type free_ipa also supports this
There was a problem hiding this comment.
Did you reffer only to ldap_group_membership or also to use_netgroups?