我试图创建一个符号链接,但无法解决此错误。请建议我一个解决方案,如何解决这个错误
代码:在/usr/local/bin文件夹中为/usr/local/bin/terraform-env/bin/* 创建符号链接我尝试使用/usr/local/bin/(带和不带斜杠)
- name: Move tfenv
file:
src: "/usr/local/bin/terraform-env/bin/{{ item.src }}"
dest: "/usr/local/bin/"
state: link
owner: root
group: root
mode: 755
force: yes
with_items:
- src: terraform
- src: tfenv
TASK [terraform : Move tfenv] **************************************************
task path: /opt/ansible/roles/terraform/tasks/main.yml:16
failed: [127.0.0.1] (item={'src': 'terraform'}) => {"changed": false, "gid": 0, "group": "root", "item": {"src": "terraform"}, "mode": "0755", "msg": "the directory /usr/local/bin/ is not empty, refusing to convert it", "owner": "root", "path": "/usr/local/bin/", "size": 4096, "state": "directory", "uid": 0}
failed: [127.0.0.1] (item={'src': 'tfenv'}) => {"changed": false, "gid": 0, "group": "root", "item": {"src": "tfenv"}, "mode": "0755", "msg": "the directory /usr/local/bin/ is not empty, refusing to convert it", "owner": "root", "path": "/usr/local/bin/", "size": 4096, "state": "directory", "uid": 0}
使用Ansible 2.8.3
1条答案
按热度按时间j2qf4p5b1#
目录/usr/local/bin/不为空,拒绝转换它
您尝试直接在现有目录上创建符号链接,而不是在该目录中创建一个条目来支持符号链接。以下更正的任务应该让你去: