I was trying to install salt master and salt minions using salt-ssh.
In that I need to put the proper configurations on the remote machines. Both master and minions need the salt master's ip in the configuration file. I have done this in ansible using
interface: {{ hostvars[groups['salt_master'][0]]['inventory_hostname'] }}
Is there a way to read the roster file? What is the salt way to do this?
Your best bet would be to assign pillar variables for this.
cat /srv/pillar/top.sls
:
base:
'*':
- master_vars
cat /srv/pillar/master_vars.sls
:
master_ip: 192.xxx.xxx.xxx
Then in your config file you'd have something like this:
interface: {{ pillar.get('master_ip') }}