User on the target VM - Ansible

0 votes
I want to check the user name/id of the target vm in my ansible set up. Is that possible?
Jan 28 in Ansible by Nisha

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Yes @Nisha, You can run a shell command and the print the output. Use a yaml file like this:

  - name: "Run shell command"
    shell: /usr/bin/id
    register: result

  - name: Print the value of result
    debug: var=result
answered Jan 28 by Kavya

Related Questions In Ansible

0 votes
1 answer
0 votes
3 answers
0 votes
1 answer

How can I create a new user using ansible ploybook?

You're switching from the root user. Root ...READ MORE

answered Mar 29, 2018 in Ansible by DareDev
• 6,520 points
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Install Ansible on centOS

Hey @Ali, Installing Ansible is a piece ...READ MORE

answered Jan 8 in Ansible by Kiara
0 votes
1 answer

Configuring SSH Access to the Ansible Hosts

Hey @Shakira, follow these steps: Execute the following ...READ MORE

answered Jan 17 in Ansible by Sam

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.