ansible playbook needs root pw

Chad Taddeo 1 Reputation point
2020-06-27T04:51:17.257+00:00

I understand I can become root on my centos vm by first typing sudo -i. This does not look to be helpful when trying to run a playbook for Ansible however. I am wondering how I would get the following to work. I created a playbook on a centos Ansible controller which is meant to reach out to multiple vms at once to run tasks. Within the host file that the playbook uses you put a login that will be used to remotely connect to the vm's. When running my playbook it keeps telling me I need to be logged in as root. So for this task, it looks like I need to put in the actual root pw into my playbook. So even though my prompt shows [root@AnsibleController ansible]#, when running the following command ...

[root@AnsibleController ansible]# sudo ansible-playbook ilovenano.yml

I get an error still saying - fatal: [52.255.151.192]: UNREACHABLE! => {"changed": false, "msg": "Invalid/incorrect password: Permission denied, please try again.", "unreachable": true}

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,810 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ronen Ariely 15,191 Reputation points
    2020-06-27T16:42:32.52+00:00

    Good day,

    There is no special forum for Ansible in the QnA system at this time. IT is true that it is directly related to the Azure Virtual Machine forum. but I think you will have much much better chance to get answer to this in the Ansible community, since this question is not unique for Azure. The answer is basically the same in other clouds solution.

    Check the official Ansible community here for more focus help about Ansible:

    https://www.ansible.com/community

    0 comments No comments

  2. Chad Taddeo 1 Reputation point
    2020-06-27T23:06:10.567+00:00

    So, is it the same with other cloud providers not to provide the root pw? I guess I am confused on the why when I am spinning the vm up for myself alone. Admittingly I dont have a ton of Linux experience, and this is my first experience with the cloud, so I am sure there is a good reason I am not understanding. That being said, what is the risk of me having the root pw to my own vm that no one else will be using? Even if I break it, I can just delete it and create another.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.