5

I'd like to download a grains file from external source during the state.highstate is run. The file is not supposed to change usually - I'm only using this mainly for the initial provisioning.

So it seems like I just want a file.managed state that will put the right contents into _grains (I'm using a standalone client) and then call saltutil.sync_grains. But how do I call a function? It's going to be a state with watch configured, but I don't see a state that would help me do that.

viraptor
  • 1,296
  • 6
  • 21
  • 41
  • Arrrgh, ignore my close vote, I misread the entire question. Sorry. – pauska Aug 04 '13 at 21:38
  • @pauska no worries :) – viraptor Aug 04 '13 at 22:06
  • I don't suppose you could mention the software you're using here... – Chris S Aug 05 '13 at 01:36
  • 1
    It's [SaltStack](http://saltstack.com/community.html) – dawud Aug 05 '13 at 06:25
  • @ChrisS It's in the title and in the tag -> "salt". I capitalised it in the title now. – viraptor Aug 05 '13 at 08:14
  • noramly i will restart salt when this happens and i sometimes will have my salt process in supervisor so that it will come back on its own. and then i also have salt start from cron. since only one version of salt will run it works well fix supervisor and kill the cron one remotly and supervisor should start salt under its own control. – WojonsTech Aug 05 '13 at 09:39

1 Answers1

1

saltutil.sync_grains - it is module call, not state. You need run this module with state "module" https://docs.saltproject.io/en/latest/ref/states/all/salt.states.module.html#module-salt.states.module But you can just start minion only after deployng right configuration (see salt-cloud). For dynamic parametrizing best practice is pillar: https://docs.saltproject.io/en/latest/topics/tutorials/pillar.html

Paul Tobias
  • 740
  • 1
  • 8
  • 11
dzift
  • 61
  • 2
  • and you can take full control of grains with this modult http://salt.readthedocs.org/en/latest/ref/modules/all/salt.modules.grains.html#module-salt.modules.grains – dzift Aug 10 '13 at 04:59