Error:
FAILED! => {"changed": false, "failed": true, "gid": 0, "group": "root", "mode": "0755", "msg": "the directory /var/www/html/simpleRepoTwo/simpleRepoThree/release-20161213-1927/ is not empty, refusing to convert it", "owner": "root", "path": "/var/www/html/simpleRepoTwo/simpleRepoThree/release-20161213-1927/", "size": 4096, "state": "directory", "uid": 0}
i've also tried creating symlink in /home/ubuntu/ with different directories. force:yes did not work.
Here is the code
- name: Creating symlinks of Products
file:
src: /home/ubuntu/productName/
dest: /var/www/html/simpleRepoTwo/simpleRepoThree/release-{{release_folder}}/
state: link
force: yes
I want to create symlink of productName inside simpleRepoTwo/simpleRepoThree/release-20161213-1927
To create a symlink "/home/ubuntu/productName" to your folder "/var/www/html/simpleRepoTwo/simpleRepoThree/release-{{release_folder}}", you must set "/home/ubuntu/productName" in your parameter dest. Final '/' must not be used
About force parameter, use it in two cases:
- the source file does not exist (but will appear later)
- destination exists and is a file (so, we need to unlink the "path" file and create symlink to the "src" file in place of it).
Use this task
- name: Creating symlinks of Products
file:
src: /var/www/html/simpleRepoTwo/simpleRepoThree/release-{{release_folder}}
dest: /home/ubuntu/productName
state: link
To loop over items, use this task
- name: Creating symlinks of Products
file:
src: "/var/www/html/simpleRepoTwo/simpleRepoThree/release-{{ release_folder }}/{{ item.src }}"
dest: "/home/ubuntu/{{ item.dest }}"
state: link
with_items:
- src: p1
dest: p1
- src: p2
dest: p2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With