hello,
Yes, you can get available users or user details in system by using ansible playbooks. For this you need to use the command / win_command module.
"The command module takes the command name followed by a list of space-delimited arguments and executes the given command on all selected nodes."
If you are trying to retrieve user or user details on a linux system, you may use below playbooks:
1. To get available users in system
- name: get available users in system
command: cut -d: -f1 /etc/passwd
register: AvailableUsers
- debug: msg="{{ AvailableUsers.stdout }}"
2. To get a spcific user details.
- name: get specific user details in system
command: id username
register: SpecificUserDetails
- debug: msg="{{ SpecificUserDetails.stdout }}"
If you are trying to retrieve user or user details on a windows system, you may use below playbooks:
1. To get available users in system
- name: get available users in system
win_command: net user
register: AvailableUsers
- debug: msg="{{ AvailableUsers.stdout }}"
2. To get a spcific user details.
- name: get specific user details in system
win_command: net user username
register: SpecificUserDetails
- debug: msg="{{ SpecificUserDetails.stdout }}"
Thanks
Soniya