Hello,
I just started with salt and I often use several source paths for a certain file so taht I can have different versions of the same file for different os variants or os releases.
A state file for a file /root/bin/myfile then might look like this:
/root/bin/myscript:
file.managed:
-source:
- salt://packageupdates/files/{{ grains['host'] }}/root/bin/myscript
- salt://packageupdates/files/{{ grains['os_family'] }}/{{ grains['osfullname'] }}/{{ grains['osrelease'] }}/root/bin/myscript
- salt://packageupdates/files/{{ grains['os_family'] }}/{{ grains['osfullname'] }}/root/bin/myscript
- salt://packageupdates/files/root/bin/myscript
Now I would like to modify the last part of source path by inserting a variable that
contains the name of the state which is usually the filepath and name. This way I could avoid the need to write the filename and path at each end of the source line:
- salt://packageupdates/files/{{ grains['os_family'] }}/{{
grains['osfullname'] }}/{{ grains['osrelease'] }}/{{ statename }}
The question is, is there a variable for the filename (here: /root/bin/myscript) I can use as a reference like indicated by {{ statename }} from above? Is there somewhere a list of similar variables documented?
Thanks a lot
Rainer