You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if the user previously successfully called ansible.builtin.getent with a valid key parameter, this results in a fact getent_passwd that has a length of 1 (only the user specified in the key is returned instead of ALL users).
However, the logic in the os_hardening role's task does not consider this possibility, since it simply skips the getent task if the fact getent_passwd is defined
- name: Read local linux user database
getent:
database: passwd
# creates a dict for each user containing UID/HOMEDIR etc...
when: getent_passwd is undefined # skip this task if "getent" has run before
this may cause unintended consequences later ;)
{
"msg": "'root_users' is undefined. 'root_users' is undefined",
"_ansible_no_log": false
}
Reproduction steps
run a `get_ent` task with a `key` before calling the `os_hardening` role
Current Behavior
{
"msg": "'root_users' is undefined. 'root_users' is undefined",
"_ansible_no_log": false
}
Expected Behavior
root_users is defined
OS / Environment
N/A
Ansible Version
N/A
Collection Version
8.6
Additional information
you should probably only skip the task if its not defined or has a length of 1
The text was updated successfully, but these errors were encountered:
Description
if the user previously successfully called
ansible.builtin.getent
with a validkey
parameter, this results in a factgetent_passwd
that has a length of 1 (only the user specified in thekey
is returned instead of ALL users).However, the logic in the os_hardening role's task does not consider this possibility, since it simply skips the
getent
task if the factgetent_passwd
is definedthis may cause unintended consequences later ;)
Reproduction steps
Current Behavior
Expected Behavior
root_users is defined
OS / Environment
N/A
Ansible Version
Collection Version
Additional information
you should probably only skip the task if its not defined or has a length of 1
The text was updated successfully, but these errors were encountered: