Answers: <p>You are explicitly asking to be prompted for the privilege escalation password by running <code>-K</code> which according to the <a href="https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html" rel="nofollow noreferrer">docs</a> is:</p>
  <blockquote>
  <p>-K, --ask-become-pass
  ask for privilege escalation password</p>
  </blockquote>
  <p>Try running the <code>ansible-playbook</code> command without the <code>-K</code></p>
  
Answers: CC BY-SA 4.0
Answers: 2021-11-11T00:14:21.753Z
Answers: wow I guess I need to read my docs better. I had assumed K was the flag for passing in a .yml file
Answers: knowads
Answers: CC BY-SA 4.0
Answers: 2021-11-10T20:50:30.920Z
Answers: 2021-11-10T20:50:30.920Z
Answers: Brett Levene
Body: <p>I have a simple ansible playbook that copies a script and executes a script on an EC2 instance.</p>
  <pre><code>- name: Playbook Deploy jar
    hosts: all
    remote_user: ubuntu
    tasks:
      - name: Copy Provisioning Script
        copy:
          src: ./prod-setup.sh
          dest: .
          mode: '0755'
  
      - name: Execute the Provisioning script
        command: sh ./prod-setup.sh
  </code></pre>
  <p>The .pem file used to connect to the host is specified in the 'Hosts' file. There is no become user but everytime I run it, I am interactively queried for a become password.</p>
  <pre><code>$superuser: ansible-playbook -i hosts -K playbook.yml
  BECOME Password:
  </code></pre>
  <p>No Become password is set because there is no become user so literally pressing 'Enter' is sufficient to continue execution but this means I can't deploy this playbook as part of a script.</p>
  <p>I checked ansible.cfg and none of the settings have been overridden. There are no other config files. What else could be causing this? Is there a way to circumvent this?</p>
  
Tags: <ansible>
Title: Ansible Playbook always interactively asks for Become password, even though no become user is specified?
UserDisplayName: knowads
ThreadText: # Ansible Playbook always interactively asks for Become password, even though no become user is specified?
  
  (Asked by: username_0 on 2021-11-09)
  
  I have a simple ansible playbook that copies a script and executes a script on an EC2 instance.
  
  ```
  - name: Playbook Deploy jar
    hosts: all
    remote_user: ubuntu
    tasks:
      - name: Copy Provisioning Script
        copy:
          src: ./prod-setup.sh
          dest: .
          mode: '0755'
  
      - name: Execute the Provisioning script
        command: sh ./prod-setup.sh
  
  ```
  
  The .pem file used to connect to the host is specified in the 'Hosts' file. There is no become user but everytime I run it, I am interactively queried for a become password.
  
  ```
  $superuser: ansible-playbook -i hosts -K playbook.yml
  BECOME Password:
  
  ```
  
  No Become password is set because there is no become user so literally pressing 'Enter' is sufficient to continue execution but this means I can't deploy this playbook as part of a script.
  
  I checked ansible.cfg and none of the settings have been overridden. There are no other config files. What else could be causing this? Is there a way to circumvent this?
  
  **Tags:** ansible
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-11-10. Score: 2 | Accepted answer
  
  You are explicitly asking to be prompted for the privilege escalation password by running `-K` which according to the [docs](https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html) is:
  
  > -K, --ask-become-pass
  > ask for privilege escalation password
  
  Try running the `ansible-playbook` command without the `-K`
  
  > **Comments:**
  > **username_0**: wow I guess I need to read my docs better. I had assumed K was the flag for passing in a .yml file  
  
  ---
  
  