How to assign saltstack pillar values from Jenkins comma separated input parameters? I have a Jenkins job with string parameter as target "server1,server2". Jenkins pipeline script is expected to execute the job on server1 and server2 respectively.
There is a common salt sls file that updates directory permissions and groups on both servers. The expectation is when the job is executed on server1, a group by name xx-server1-yy must be created and updated in server1, similarly a group xx-server2-yy be created in server2 only.
One sls file for Jenkins job on multiple servers with groups created specific to each server. What is the best approach?
You didn't say how the sls file is executed.


One way would be to pass pillars on command line:


salt '*' state.apply ftpsync pillar='{"ftpusername": "test", "ftppassword": "0ydyfww3giq8"}'



Or you can set the group name as a grain on the minion in advance.
Yet another way would be to set the group name as a jinja variable in the sls formula, depending on the hostname grain. Assuming your host names are set and standardized.