I'm attempting to develop an Ansible playbook that uses the getent module to help manage various user accounts. I would like to be able to access the various values like UID, GID, password, etc. (what I think is a Python dictionary -- but am not sure that is accurate).
How do I read/access if a password is lockecd (e.g. ! or !!)?
How do I read/access the UID or GID for say this account: ntp:x:38:38::/etc/ntp:/sbin/nologin into a variable to be used for the next task?
Here is current playbook task so far. Can this be done if a playbook?
- name: "getent variables" getent: database: passwd key: ntp #root #uid split: ':' #fail_key: # register: getent_passwd - debug: var: getent_passwd