Hi ,
I have 3 directories in /tmp as follows:
Test_10.0.0
Test_11.0.0
Test_13.0.0
other directories in /tmp
Test
Prod
Dev
Now i want to create soft link of
Test_10.0.0 - Test
Test_11.0.0 - Prod
Test_13.0.0 - Dev
I want to create a playbook which does it.
Can anybody help in this regard
racke
(Stefan Hornburg)
2
Hi ,
I have 3 directories in /tmp as follows:
Test_10.0.0
Test_11.0.0
Test_13.0.0
other directories in /tmp
Test
Prod
Dev
Now i want to create soft link of
Test_10.0.0 - Test
Test_11.0.0 - Prod
Test_13.0.0 - Dev
I want to create a playbook which does it.
Can anybody help in this regard
From the docs:
- name: Create a symbolic link
file:
src: /file/to/link/to
dest: /path/to/symlink
owner: foo
group: foo
state: link
Regards
Racke
J111
(J)
3
Hi Rakesh,
I create the following play for you with a variable that you can loop and access the src and dest for the links.
---
- name: create softlink
hosts: servers
gather_facts: off
vars:
sf_links:
- src: /tmp/Test_10.0.0
dest: /tmp/Test
- src: /tmp/Test_11.0.0
dest: /tmp/Prod
- src: /tmp/Test_13.0.0
dest: /tmp/Dev
tasks:
- name: create softlinks
file:
src: "{{item.src}}"
dest: "{{item.dest}}"
state: link
loop: "{{sf_links}}"