Copy symbolic link to another location with?

I have a symlink and you want to create a new symbolic link that points to the same location as the first symbolic points. I know that I can use cp -d /path/to/symlink /new/path/to/symlink . But how to do this with an available module?

I tried copy: src=/path/to/symlink dest=/new/path/to/symlink follow=yes , but instead of copy: src=/path/to/symlink dest=/new/path/to/symlink follow=yes symbolic link, I created a new symbolic link. Any ideas?

+5
source share
1 answer

You have two options.

1) Create a new Symlink using file .

 - name: Create symlink file: src=/path/to/symlink dest=/new/path/to/symlink state=link 

2) Run your working command to copy the symbolic link using the shell , it will do the same.

 - name: Create symlink shell: cp -d /path/to/symlink /new/path/to/symlink 
+4
source

Source: https://habr.com/ru/post/1203513/


All Articles