0

I am writing a playbook in order to install a package from portage:

---
- hosts: '1.2.3.4'
  sudo: True
  become_user: admin_x
- tasks:
    - name: "install nspr"
      portage: package=dev-libs/nspr state=present

This fails, telling me I do not not have sudo permissions:

ansible-playbook foo.yml --limit 1.2.3.4 -k --ask-sudo-pass

I have seen that you should use become, but the documentation for that is pretty much a gap. Could someone give me an example how to do this properly?

wishi
  • 7,188
  • 17
  • 64
  • 103

1 Answers1

1

I use:

deploy.yml:

- name: Todo something
  hosts: all
  become: yes
  become_user: root
  become_method: su

When you execute the playbook pass the password like a extra var.

--extra-vars='ansible_become_pass=password'
udondan
  • 57,263
  • 20
  • 190
  • 175
Raul Hugo
  • 1,146
  • 7
  • 14