Reputation: 7387
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?
Upvotes: 0
Views: 139
Reputation: 1136
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'
Upvotes: 1