'How to symlink with a Salt state?

Currently, I am using 2 folders to store the data.

/var/data : mongodb
/srv/data : redis 

I have unify both the directories. I have to switch to /srv/data.

My question is, I have to create a salt state to create unix link /srv/data/mongodb -> /var/data/mongodb . So that data won't move.



Solution 1:[1]

https://docs.saltproject.io/en/latest/ref/states/all/salt.states.file.html#salt.states.file.symlink

/srv/data/mongodb:
  file.symlink:
    - target: /var/data/mongodb

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 OrangeDog