-
Notifications
You must be signed in to change notification settings - Fork 23
Fix CIS play skipping kolla user on non-Kolla hosts #2011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request fixes an issue where the CIS hardening playbook would fail on hosts that are not part of the Kolla inventory, because it tried to modify the kolla user which does not exist on those hosts. The fix introduces a condition to skip the task for the kolla user on such hosts.
The approach taken is to build a list of hosts in the Kolla inventory and check against it. While this works, I've suggested a more robust and idiomatic Ansible approach using the getent module to check for user existence directly on the target host. This simplifies the code and removes a dependency on inventory structure variables.
Signed-off-by: Bartosz Bezak <bartosz@stackhpc.com>
3f9c6f7 to
a712732
Compare
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly fixes an issue where the CIS hardening playbook would fail on hosts where the kolla user does not exist. The approach of using ansible.builtin.getent to gather user information and then conditionally running the chage command is clean and idiomatic for Ansible. The changes are logical and well-implemented. I have one suggestion to improve future maintainability.
5255c8f to
06047d1
Compare
06047d1 to
6c33726
Compare
For example non-hyperconverged Ceph nodes are not member of kolla inventory, at it fails there:
inspired by https://github.com/openstack/kayobe/blob/645a3074063f9df8c958c2b241d62b3fa4aef9ea/ansible/kolla-ansible-user.yml#L19