ansible“目录/ usr / lib /不是空的,拒绝转换它”

问题描述 投票:0回答:1

我正在尝试使用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}
python debian ansible
1个回答
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'}
© www.soinside.com 2019 - 2024. All rights reserved.