1

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?

1 Answer 1

2

You are explicitly asking to be prompted for the privilege escalation password by running -K which according to the docs is:

-K, --ask-become-pass ask for privilege escalation password

Try running the ansible-playbook command without the -K

1
  • wow I guess I need to read my docs better. I had assumed K was the flag for passing in a .yml file
    – knowads
    Nov 11, 2021 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.