<p>You don't need to be a privileged user (in your local machine) in order to execute Ansible playbook.</p>
<p>When using <code>become</code>, Ansible allows you to ‘become’ another user, different from the user that logged into the machine (remote user).</p>
<p>For more details see <a href="https://docs.ansible.com/ansible/latest/user_guide/become.html" rel="nofollow noreferrer">Understanding Privilege Escalation</a></p>
<p>In your inventory of hosts <code>/etc/ansible/host</code> you have specified a group of IPs with root user while you are specifying a <code>remote_user: ronenal</code> in your playbook.</p>
<p>So you need to run ansible-playbook with --ask-become-pass or -K.</p>

CC BY-SA 4.0
2019-08-22T12:50:47.127Z
Thanks. I added become_user to the playbook file and it resolved the issue.
Ronen
CC BY-SA 4.0
2019-08-20T14:48:13.193Z
2021-05-29T11:42:39.973Z
2021-05-29T11:42:39.973Z
Fodil
<p>I agree with Fodil, but I would also recommend using <strong>psexec</strong> for working with windows. Ansible has a command <strong>"win_psexec"</strong> that helps to use escalated privileges without using <strong>Become</strong>. </p>

CC BY-SA 4.0
2019-10-18T16:38:22.810Z
2019-10-18T16:38:22.810Z
Montrez Cox
<p>I'm new with Ansible so hope to find answers here.
I'm trying to run some playbook but getting an error:</p>

<pre><code>fatal: [10.65.30.117]: FAILED! =&gt; {
  "msg": "Timeout (12s) waiting for privilege escalation prompt: "
}
</code></pre>

<p>Here are the steps which I performed:</p>

<ol>
<li>I installed Ansible 2.6.17 on RHEL 6.8 using root user.</li>
<li>I update /etc/ansible/host with new group of IPs (with root user)</li>
<li>I created playbook file (with some other user) with the following content:</li>
</ol>

<pre><code>  name: sample_playbook
  hosts: [ansible_clients]
  remote_user: ronenal
  become: true
  tasks:
     - name: create file
       file:
         path: /tmp/ansible.log
         state: touch
         mode: u=rw,g=r,o=r
</code></pre>

<p>When I execute <code>ansible-playbook -sample_playbook.yml</code> I'm getting the above error.</p>

<p>I set <code>ANSIBLE_DEBUG=1</code> and it looks like it related to sudo command.
The user which I use is not in the sudoers list.</p>

<p>My questions:</p>

<ol>
<li>Is it required to be a privileged user in order to execute Ansible playbook?</li>
<li>if no, what am I doing wrong?</li>
<li>if yes, is that mean that I need to add this user to the sudoers users list?</li>
</ol>

<ansible><windows>
Waiting for privilege escalation prompt
Ronen
# Waiting for privilege escalation prompt

(Asked by: username_0 on 2019-08-20)

I'm new with Ansible so hope to find answers here.
I'm trying to run some playbook but getting an error:
fatal: [10.65.30.117]: FAILED! => {
  "msg": "Timeout (12s) waiting for privilege escalation prompt: "
}

Here are the steps which I performed:

I installed Ansible 2.6.17 on RHEL 6.8 using root user.
I update /etc/ansible/host with new group of IPs (with root user)
I created playbook file (with some other user) with the following content:

  name: sample_playbook
  hosts: [ansible_clients]
  remote_user: ronenal
  become: true
  tasks:
     - name: create file
       file:
         path: /tmp/ansible.log
         state: touch
         mode: u=rw,g=r,o=r

When I execute ansible-playbook -sample_playbook.yml I'm getting the above error.
I set ANSIBLE_DEBUG=1 and it looks like it related to sudo command.
The user which I use is not in the sudoers list.
My questions:

Is it required to be a privileged user in order to execute Ansible playbook?
if no, what am I doing wrong?
if yes, is that mean that I need to add this user to the sudoers users list?

**Tags:** ansible, windows


---

## 2 answers

### Answer by username_1 on 2019-08-20. Score: 2 | Accepted answer

You don't need to be a privileged user (in your local machine) in order to execute Ansible playbook.

When using `become`, Ansible allows you to ‘become’ another user, different from the user that logged into the machine (remote user).

For more details see [Understanding Privilege Escalation](https://docs.ansible.com/ansible/latest/user_guide/become.html)

In your inventory of hosts `/etc/ansible/host` you have specified a group of IPs with root user while you are specifying a `remote_user: ronenal` in your playbook.

So you need to run ansible-playbook with --ask-become-pass or -K.

> **Comments:**
> **username_0**: Thanks. I added become_user to the playbook file and it resolved the issue.  

---

### Answer by username_2 on 2019-10-18. Score: 1

I agree with username_1, but I would also recommend using **psexec** for working with windows. Ansible has a command **"win\_psexec"** that helps to use escalated privileges without using **Become**.


---

