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, 2019 in Ansible by Nisha

1 answer to this question.

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, 2019 by Kavya

Related Questions In Ansible

0 votes
1 answer
+1 vote
3 answers
0 votes
1 answer
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,850 points
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,400 points
0 votes
1 answer
0 votes
1 answer

Install Ansible on centOS

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

answered Jan 8, 2019 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, 2019 in Ansible by Sam