ansible"目录/ usr / lib /不为空,拒绝转换它"

时间:2016-08-19 10:58:36

标签: python debian ansible

我尝试使用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}

1 个答案:

答案 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'}