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
On Thursday, November 2, 2017 at 4:39:14 PM UTC+5:30, Ravikumar Wagh wrote:
>
> Is there any way to get available users in system or an spcific user
> details.
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/deffcfb4-ab3e-43a8-9044-569ef5f147dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.