setting highstate automatically

2,070 views
Skip to first unread message

Beau Cronin

unread,
Jan 26, 2012, 12:57:46 PM1/26/12
to salt-...@googlegroups.com
Hi there,

We are currently investigating salt for use in a web service that uses an elastic pool of workers to perform compute jobs.  As part of our architecture, it would be great if new worker machines could have their state set automatically when they are brought up.  We're on EC2, using cloudconfig to install salt and start salt-minion; this part works well.

I haven't seen anything about this in the docs or the list archive.  Is this a use case that others have encountered? Is there a salt-ic way of accomplishing this, or should we piece together our own solution?

Suggestions and pointers very much appreciated.

Best,

Beau

Thomas S Hatch

unread,
Jan 26, 2012, 1:20:02 PM1/26/12
to salt-...@googlegroups.com
Hi Beau,

Yes, running state.highstate on the minion automatically is the way to go, Salt does not provide a daemon to run repeatedly on the minion for highstate, the suggested way to do it would be to have a cron that runs periodically or add an init script that runs salt-call state.highstate at boot. You could also of course run state.highstate from the master once the minion checks in for the first time as well.

- Thomas S Hatch

Christer Edwards

unread,
Jan 26, 2012, 1:30:20 PM1/26/12
to salt-...@googlegroups.com
On Thu, Jan 26, 2012 at 11:20 AM, Thomas S Hatch <that...@gmail.com> wrote:
> Yes, running state.highstate on the minion automatically is the way to go,
> Salt does not provide a daemon to run repeatedly on the minion for
> highstate, the suggested way to do it would be to have a cron that runs
> periodically or add an init script that runs salt-call state.highstate at
> boot. You could also of course run state.highstate from the master once the
> minion checks in for the first time as well.

Sounds like this would work great:

# crontab
@reboot salt-call state.highstate

Beau Cronin

unread,
Jan 26, 2012, 1:45:25 PM1/26/12
to salt-...@googlegroups.com
Perfect.  We're using upstart to manage salt-minion, so I'll add the salt-call to the upstart conf.

Thanks, gents!

Jeff Bauer

unread,
Jan 26, 2012, 2:02:57 PM1/26/12
to salt-...@googlegroups.com
On Thu, Jan 26, 2012 at 10:45:25AM -0800, Beau Cronin wrote:
> Perfect. We're using upstart to manage salt-minion, so I'll add the salt-call
> to the upstart conf.

Beau,

My upstart script:

https://gist.github.com/1617054

Pretty basic, but any comments or suggestions are welcome.

Jeff Bauer
Rubicon, Inc.

Evan Borgstrom

unread,
Jan 27, 2012, 6:42:55 PM1/27/12
to salt-...@googlegroups.com
Hi,

One of the things I really liked about mcollective was RIP's
puppetcommander module[1].

I've done a rough port of it over to Salt and have just pushed it up to my
github:

https://github.com/fatbox/saltcommander/


It's still quite crude and probably needs a lot of polish but it's working
for us right now (mind you it's running in a screen session). Just run the
python file on your salt master as root.

This weekend I hope to get some time to spend on polishing a lot of our
new salt deployment and I'll probably tackle this as well.

-E


[1] =
https://github.com/puppetlabs/mcollective-plugins/blob/master/agent/puppetd
/commander/puppetcommanderd

Thomas S Hatch

unread,
Jan 27, 2012, 6:47:05 PM1/27/12
to salt-...@googlegroups.com
This would be a great tool to have in the main body of Salt, it could be integrated very cleanly as a salt runner (http://saltstack.org/ref/runners/).

Let me know how it works out and we can add it back into Salt itself

Jeff Schroeder

unread,
Jan 27, 2012, 6:56:13 PM1/27/12
to salt-...@googlegroups.com

Additionally, once the job support stuff is fleshed out / tested a bit
more, and then a scheduler is built ontop of it, this would be trivial
to implement. Either way, awesome!

--
Jeff Schroeder

Don't drink and derive, alcohol and analysis don't mix.
http://www.digitalprognosis.com

Christopher Johnston

unread,
Jan 28, 2012, 12:51:40 PM1/28/12
to salt-...@googlegroups.com, salt-...@googlegroups.com
Awesome!
Reply all
Reply to author
Forward
0 new messages