我遇到运行ansible-playbook的问题
见下面我的剧本
/lib
终端中的命令是:
---
- hosts: some_group
remote_user: someuser
become: true
become_method: sudo
tasks:
- name: Copy file to remote nodes
copy: src=/root/ansible/someimage dest=/home/someuser/
- name: Load exported file of nginx image
command: docker load -i /home/someuser/someimage
ansible版本是2.0.0.2
错误是:" stderr":"尝试在unix:///var/run/docker.sock连接到Docker守护程序套接字时获得权限被拒绝:
答案 0 :(得分:0)
确保您了解becoming an unprivileged user时的限制。我会尽量避免这种情况。
相反,您可以作为特权用户工作。您只需要修复权限。
---
- hosts: some_group
become: true
tasks:
- name: Copy file to remote nodes
copy: src=/root/ansible/someimage dest=/home/someuser/someimage
- name: Set permisions
file:
dest: /home/someuser/someimage
owner: someuser
group: someuser
mode: 0644
- name: Load exported file of nginx image
command: sudo someuser docker load -i /home/someuser/someimage