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?

  • are the files similar enough that you could template them? How different are they between the hosts? – Zoredache Oct 14 '18 at 3:52
  • No, I cannot template them. Some are binary and some may be totally different. – adontz Oct 14 '18 at 4:16
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.