我尝试使用ansible创建符号链接:
file: src=/usr/lib/x86_64-linux-gnu/{{ item.src }}
dest=/usr/lib/
state=link force=yes
with_items:
- { src: 'libz.so'}
- { src: 'libfreetype.so'}
- { src: 'libjpeg.so'}
我得到了这个:
failed: [192.168.2.2] (item={u'dest': u'/usr/lib/', u'src': u'libz.so'}) => {"failed": true, "gid": 0, "group": "root", "item": {"dest": "/usr/lib/", "src": "libz.so"}, "mode": "0755", "msg": "the directory /usr/lib/ is not empty, refusing to convert it", "owner": "root", "path": "/usr/lib/", "size": 4096, "state": "directory", "uid": 0}
答案 0 :(得分:5)
您正尝试将整个/usr/lib
目录链接到该文件。
将{{ item.src }}
附加到您的目标
file: src=/usr/lib/x86_64-linux-gnu/{{ item.src }} dest=/usr/lib/{{ item.src }} state=link force=yes
with_items:
- { src: 'libz.so'}
- { src: 'libfreetype.so'}
- { src: 'libjpeg.so'}