Skip to content

Bugfixes#1960

Open
ivarmu wants to merge 3 commits into
theforeman:developfrom
automationiberia:fix_two_issues
Open

Bugfixes#1960
ivarmu wants to merge 3 commits into
theforeman:developfrom
automationiberia:fix_two_issues

Conversation

@ivarmu
Copy link
Copy Markdown

@ivarmu 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 }}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't those identical in the result?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :-)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Comment thread roles/auth_sources_ldap/tasks/main.yml
Comment thread roles/auth_sources_ldap/tasks/main.yml Outdated
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) }}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server_type free_ipa also supports this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you reffer only to ldap_group_membership or also to use_netgroups?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants