1

There is some directory path, like /etc/opt/mysoft which contents should be different for each minion.

So for minion A it contains config.ini with come contents and for minion B it contains config.ini with different contents and additionally file img.png.

What are my options? Can I copy files from /srv/salt/{minon-something-here}/ directory? Can I map some minion identifier to branch in svnfs, gitfs or hgfs?

2
  • are the files similar enough that you could template them? How different are they between the hosts?
    – Zoredache
    Oct 14, 2018 at 3:52
  • No, I cannot template them. Some are binary and some may be totally different.
    – adontz
    Oct 14, 2018 at 4:16

1 Answer 1

0

Use - source: salt://mysoft/files/{{ grains['id'] }} in any of the file states (e.g. file.managed or file.recurse), then put the host specific files in /srv/salt/mysoft/files/{minion-id}/. You can also use different grain, like grains['fqdn'] and change the path appropriately.

Example:

/etc/opt/mysoft:
  file.recurse:
    - source: salt://mysoft/files/{{ grains['id'] }}

Files on master for minions with id foo and bar:

/srv/salt/mysoft/files/foo/config.ini
/srv/salt/mysoft/files/foo/img.png
/srv/salt/mysoft/files/bar/config.ini
/srv/salt/mysoft/files/bar/img.png

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .