【发布时间】:2017-09-08 07:24:22
【问题描述】:
我正在尝试使用我的 ansible playbook 运行“文件夹创建”命令。 (代码如下)
创建需要sudo登录才能执行。
我按如下方式运行剧本:
ansible-playbook myfile.yml --ask-pass
这会提示输入远程机器的用户帐户密码。 ssh 连接建立,但命令失败,权限被拒绝,因为它没有使用超级用户密码。
如何解决我的问题?
hosts: GSP
tasks:
- name: "make build directory"
command: mkdir -p /home/build/
become: true
become_user: root
- name: "change permissions on the directory"
command: chmod 777 -R /home/
become: true
become_user: root
【问题讨论】:
标签: ansible ansible-2.x