Managing Salt with Salt

972 views
Skip to first unread message

Nate Smith

unread,
Mar 21, 2012, 10:17:36 AM3/21/12
to salt-...@googlegroups.com
Has anyone had success managing the minion and master configurations via Salt? I'm not clear how I can keep the configuration files 'managed' and have the minion process be restarted on modification to the configs.

David Bishop

unread,
Mar 21, 2012, 11:14:31 AM3/21/12
to salt-...@googlegroups.com
Very basic minion configs. Master should be self-explanatory. Feel free to add a -template: jinja to the /etc/salt/minion resource, and then templatize things from there.

$ cat minion.sls
salt-minion:
service:
- running
- watch:
- file: /etc/salt/minion

/etc/salt/minion:
file:
- managed
- owner: root
- group: root
- mode: 444
- source: salt://salt/files/salt-minion.config

$ cat files/salt-minion.config
master: salt.example.com

Thomas S Hatch

unread,
Mar 21, 2012, 12:32:00 PM3/21/12
to salt-...@googlegroups.com
The problem is that restarting the minion with the minion kills the process that is managing the minion...

One of our planned features for 0.9.9 is to alleviate this problem, the state.highstate function runs within a separate process, the plan is to demonize that process after it forks so that it can restart what was once it's parent process, the salt minion.

The issue for this is here:

Grier Johnson

unread,
Mar 21, 2012, 1:13:47 PM3/21/12
to salt-...@googlegroups.com
One way I'm getting around this problem is using a process minder
(runit, in this case, but daemontools works too) to monitor the
minions. You can then restart the minion through the process minder
(via salt) and the minion will restart and reconnect. It's been
working well so far.

--
Grier

Devon Stewart

unread,
Mar 21, 2012, 1:34:18 PM3/21/12
to salt-...@googlegroups.com, salt-...@googlegroups.com
Similarly, I'm using supervisord to manage salt; I just kill the process, supervisor starts it back up.

-Devon

Adam Nave

unread,
Apr 9, 2012, 5:26:22 PM4/9/12
to salt-...@googlegroups.com
It looks like this is fixed in 0.9.9 already. I just installed 0.9.8 from EPEL on CentOS 6. It seems like if you have the minion config file required but not watched, you can run highstate and then manually run something like salt '*' cmd.run 'service salt-minion restart' and it handles the restart gracefully. Not perfect, but a good stopgap if you're not running a process minder.

--Adam

Thomas S Hatch

unread,
Apr 9, 2012, 5:29:14 PM4/9/12
to salt-...@googlegroups.com
Yes, we have made a step towards better salting salt in 0.9.9, basically the highstate run gets demonized so that you can manage the minion daemon from a safe distance. Hopefully this gets us farther along here!

Alex Graham

unread,
Dec 3, 2013, 2:50:54 PM12/3/13
to salt-...@googlegroups.com, nwjs...@gmail.com
What's the word on this?

I'm running 17.1 on various OS's and seeing the same thing - salt-minion stops after modifying the files being watched by the process.

An example:
From my master, I run salt '[client name]' state.sls salt-minion
If there's no change to config, everything is fine.
If I change watched file, salt-minion is stopped - even if I'm just adding a remark.

Output shows what I would expect - changes to config file, service restarted, service running, etc., but test.ping returns nothing and the service is stopped on the minion.

Configs:
# cat init.sls
salt-minion:
  pkg:
    - latest
    - order: last

  service:
    - running
    - watch:
       - pkg: salt-minion
       - file: /etc/salt/minion
/etc/salt/minion:
  file.managed:
    - source: salt://salt-minion/minion_config.trim
    - mode: 640
    - user: root
    - group: root
    - require:
      - pkg: salt-minion
 
# cat minion_config.trim
master: [salt master FQDN]
backup_mode: minion

Colton Myers

unread,
Dec 4, 2013, 5:29:31 PM12/4/13
to salt-...@googlegroups.com, nwjs...@gmail.com
Is the minion just failing to restart itself, or do you think it's related to watching that file in particular?  Easy way to test this is to try watching a different file state not related to minion config.

--
Colton Myers


--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Alex Graham

unread,
Dec 5, 2013, 5:49:24 PM12/5/13
to salt-...@googlegroups.com, nwjs...@gmail.com
Same effect if I'm just watching a text file:
(this is now with v 0.17.2 on both master and minion)

# cat init.sls
salt-minion:
  pkg:
    - latest
    - order: last
  service:
    - running
    - watch:
       - pkg: salt-minion
#       - file: /etc/salt/minion
       - file: /etc/salt_test.txt

/etc/salt/minion:
  file.managed:
    - source: salt://salt-minion/minion_config.trim
    - mode: 640
    - user: root
    - group: root
    - require:
      - pkg: salt-minion

/etc/salt_test.txt:
  file.managed:
    - source: salt://salt-minion/salt_test.txt
    - mode: 640
    - user: root
    - group: root
    - require:
      - pkg: salt-minion

# cat salt_test.txt
test2

Colton Myers

unread,
Dec 6, 2013, 4:06:33 PM12/6/13
to salt-...@googlegroups.com, nwjs...@gmail.com
Then this falls under this issue:  https://github.com/saltstack/salt/issues/5721

Depending on the system and init system, salt has varying degrees of success with restarting itself.  It's something that's high on our list and we're working to improve it.

--
Colton Myers
Reply all
Reply to author
Forward
0 new messages