我正在编写一本剧本,以便从portage安装一个包:
---
- hosts: '1.2.3.4'
sudo: True
become_user: admin_x
- tasks:
- name: "install nspr"
portage: package=dev-libs/nspr state=present
这失败了,告诉我我没有sudo权限:
ansible-playbook foo.yml --limit 1.2.3.4 -k --ask-sudo-pass
我已经看到你应该使用“成为”,但其文档是pretty much a gap。有人能举例说明如何正确地做到这一点吗?
答案 0 :(得分:1)
我用:
deploy.yml:
- name: Todo something
hosts: all
become: yes
become_user: root
become_method: su
执行playbook时,会传递密码,如额外的var。
--extra-vars='ansible_become_pass=password'