





















这是一个创建于 3379 天前的主题,其中的信息可能已经有所发展或是发生改变。
有个目录(内有文件,子目录, link)在控制机上,要复制到目标机上,咋就辣么难呢?
Playbook:
- hosts: testvbox
become: true
tasks:
- name: Copy Paraview lib files
src: /etc/ansible/files/ParaView-5.3.0-Qt5-OpenGL2-MPI-Linux-64bit/lib/
dest: /usr/local/lib/
archive: no
links: yes
报错:
TASK [Copy Paraview lib files] *************************************************
fatal: [192.168.123.165]: FAILED! => {"changed": false, "cmd": "/usr/bin/rsync --delay-updates -F --compress --links --rsh 'ssh -S none -o StrictHostKeyChecking=no' --rsync-path=\"sudo rsync\" --out-format='<<CHANGED>>%i %n%L' \"/etc/ansible/files/ParaView-5.3.0-Qt5-OpenGL2-MPI-Linux-64bit/lib/\" \"[email protected]:/usr/local/lib/\"", "failed": true, "msg": "sudo: no tty present and no askpass program specified\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]\n", "rc": 12}
to retry, use: --limit @/etc/ansible/test.retry
试了 copy 模块也失败了!
呼唤老司机!
1 hzlez 2017 年 3 月 15 日no tty present and no askpass program specified |
2 hzlez 2017 年 3 月 15 日@hzlez sorry , 按快了。 |
3 weiweiwitch 2017 年 3 月 15 日ansible 有个问题。如果你需要切换到更高权限的账户来执行命令,那么你需要设置 nopasswd 到这个账户,否则会出现你遇到的这种问题。 比如在 Ubuntu 那种使用 sudo 来执行管理命令的,你需要在 /etc/sudoers 的 sudo 那行改成%sudo ALL=(ALL:ALL) NOPASSWD:ALL 在 CentOS 那种使用 su 来切换到 root 的。你直接使用 root 来连。 |
4 dynaguy 2017 年 3 月 15 日其实这个 playbook 前面还有很多 task,都执行了,包括这个: 所以我不认为是权限问题。/usr/local/bin/可以写,而 /usr/local/lib/不能写,那也太诡异了! 这个成功执行的 copy, src 目录下只有几个文件,没有子目录和 link 。觉得问题在这里,但没有解决办法。愁 ing. 我会试试 @weiweiwitch 的建议,再报! |
6 nosun 2017 年 6 月 21 日遇到同样的问题,@weiweiwitch 的方法试了无效 |
8 dynaguy 2017 年 6 月 22 日@nosun 好几个月了,又翻了一下我的解决办法,希望有帮助。 ``` - name: Modify /etc/sudoers - name: Copy Paraview bin files - name: Copy Paraview lib files - name: Restore /etc/sudoers ``` |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。