Running multiple Salt-minions on one machine

1,980 views
Skip to first unread message

Frank

unread,
Jan 16, 2015, 3:03:23 PM1/16/15
to salt-...@googlegroups.com
ello,

We are currently in the process of setting up a few new servers which are a bit "off-standard".
In normal cases, the servers are in our environment and fall under the authority of our Salt-master.
However, this setup involves a second party (lets call them Party B) which also uses Salt (yay!) and also needs to be able to use it.

We will be responsible for the highstates and will run the occasional commands (e.g. querying versions).
The other party uses Salt mainly for information gathering (e.g. software versions) and needs to be able to do that.

A few caveats:
  • Neither party has access to the other salt-master's or its configuration, keys or anything related to this
  • Both parties (can) use the Saltstack Stable PPA to get the latest packaged Salt-* packages
  • There should be no conflict between them. If both parties at one point both need to be highstating, it will be setup (in the Salt states/pillars) so that they won't overlap (e.g. managing /etc/hosts)

Searching trough the docs leads me to "multi-master", however this requires that the fileserver (and keys) needs to be synced. This isn't possible.

That leads me to the only alternative I could think of: multiple salt-minion processes.
But what would be the most practical option?

We could run the same minion binary with different options.
This would require a second init script to be created which the -c argument added and a second set of configs, keys etc. Sounds reasonable..

Another option would be running one "stock" (from the PPA) version and one in Virtualenv.
This is a bit more complex but does make it two separate entities allowing different versions (e.g. party A wants to use v2015.2 while party B is still at v2014.7.0 and doesn't want to update yet).

Is anyone using a similar setup? What would be the best approach here?

Thanks!

Christopher Baklid

unread,
Mar 18, 2016, 7:46:03 AM3/18/16
to Salt-users
+1 I'd like to know how to get multiple minions on the same machine set up aswell

Since salt uses detached ids it is possible to run multiple minions on the
same machine but with different ids, this can be useful for salt compute
clusters.

but there is no information on how to set it up

Seth House

unread,
Mar 18, 2016, 7:53:48 PM3/18/16
to salt users list
Running multiple minion daemons is as simple as creating two config
files and pointing each daemon to the appropriate config.

This is how I like to structure things because it keeps both
completely separate via the root_dir setting. Though it's certainly
not the only way to set this up:

for mid in minion1 minion2; do
mkdir -p /some/path/${mid}/{etc/salt/minion.d,var,srv,tmp}
cp /etc/salt/minion /some/path/${mid}/etc/salt
printf 'id: %s
root_dir: %s' "$mid" "/some/path/${mid}" \
> /some/path/${mid}/etc/salt/minion.d/mid.conf
done

Point each minion daemon to the right config with the -c flag:

salt-minion -c /some/path/minion1/etc/salt

You might want to copy and modify the init script for your platform to
start both. In the above configuration, you'll probably also want to
set the `file_roots` setting to somewhere under the srv directory for
each.

One last note, ZeroMQ has a file path length limit for the sockets it
uses. If you run afoul of that (there will be a warning message) set
the `sock_dir` setting to another directory with a shorter path. This
setting is relative to root_dir above.

Christopher Baklid

unread,
Mar 19, 2016, 5:16:15 AM3/19/16
to Salt-users, se...@eseth.com
This was exactly what I needed! I hope the OP got an answer too 

On windows I ran into this problem:

ZMQError: Address in use
Traceback (most recent call last):
 
File "C:\salt\bin\Scripts\salt-minion", line 26, in <module>
    salt_minion
()
 
File "C:\salt\bin\lib\site-packages\salt\scripts.py", line 117, in salt_minion
    minion
.start()
 
File "C:\salt\bin\lib\site-packages\salt\cli\daemons.py", line 277, in start
   
self.minion.tune_in()
 
File "C:\salt\bin\lib\site-packages\salt\minion.py", line 1680, in tune_in
    io_loop
=self.io_loop,
 
File "C:\salt\bin\lib\site-packages\salt\utils\event.py", line 823, in __init__
   
self.epub_sock.bind(epub_uri)
 
File "zmq/backend/cython/socket.pyx", line 489, in zmq.backend.cython.socket.Socket.bind (zmq\backend\cython\socket.c:4824)
 
File "zmq/backend/cython/checkrc.pxd", line 25, in zmq.backend.cython.checkrc._check_rc (zmq\backend\cython\socket.c:7055)
   
raise ZMQError(errno)
zmq
.error.ZMQError: Address in use

Which I fixed by adding these lines to the secondary minion

tcp_pub_port: 4512
tcp_pull_port: 4513

Thanks for the help Seth
Reply all
Reply to author
Forward
0 new messages