2

I have installed SaltStack in my system (Ubuntu 12.04). for example If i want to run sudo apt-get update or wget to other machines like 4 to 5 machines using Salt. How should i want to configure my SaltStack to work on this machines.

krs
  • 223
  • 1
  • 5

1 Answers1

2

It is not clear to me how you are setting up infrastructure so I will assume that you are setting up the simple use case where your current Ubuntu 12.04 machine is the salt master and all the other machines are minions. In that case, have you tried reading the official documentation here?

Basically, on each system that you want to be controlled by the salt-master you would install salt-minion. Then you would edit the /etc/salt/minion file on each of the systems to point to the salt master. On a default minion configuration file you could run the following command.

sed -i 's/^#master: salt/master: IP_OF_YOUR_MASTER/'

What this command basically does is it looks for the commented out option "#master: salt" and replaces it with an uncommented option that points to where you master is.

Restart your salt-minion and then on the salt-master run

salt-key -A 

To accept each of your minion's keys. You can then run a ping from the salt-master to test connectivity from your master to your minions.

salt "*" test.ping --show-timeout 
Jason Zhu
  • 821
  • 7
  • 10
  • sed -i 's/^#master: salt/master: IP_OF_YOUR_MASTER/ please let me know IP_OF_YOUR_MASTER/ is IP_OF_MY_MACHINE right? and let me know what is s/^#master and whether it is a command or needs to be edited. Thanks in advance – krs Jan 10 '14 at 06:10
  • How do i want to configure the /etc/salt/minion to point out the salt master – krs Jan 10 '14 at 06:33
  • You would want to configure the /etc/salt/minion to point to machine that you have salt-master installed. So let's say on 10.1.10.2 you ran the command "yum install salt-master" and on 10.1.10.3 you ran the command "yum install salt-minion". Then on the /etc/salt/minion of 10.1.10.3 you would run the command "sed -i 's/^#master: salt/master: 10.1.10.2" so that the minions points to the master. You would then restart the services and run salt-key -L on the master. – Jason Zhu Jan 10 '14 at 16:15
  • "sed -i 's/^#master: salt/master:192.168.2.30" -bash: sed -i 's/^#master: salt/master:10.1.10.2: No such file or directory – krs Jan 13 '14 at 11:23
  • You have to put the location of the minion file in order to run the command. In your case it would be sed -i 's/^#master: salt/master:192.168.2.30/" /etc/salt/minion – Jason Zhu Jan 13 '14 at 16:17
  • this is the /etc/salt/minion 0f 192.168.2.27 #### Primary configuration settings ##### # Per default the minion will automatically include all config files # from minion.d/*.conf (minion.d is a directory in the same directory # as the main minion config file). #default_include: minion.d/*.conf # Set the location of the salt master server, if the master server cannot be # resolved, then the minion will fail to start. master: 192.168.2.30 "sed -i 's/^#master: salt/master:192.168.2.30" # Set whether the minion should connect to the master via IPv6 #ipv6: False – krs Jan 15 '14 at 09:15
  • What is your question? – Jason Zhu Jan 15 '14 at 13:44
  • i need to install a package contains like vim,mongodb,svn,python etc. how do i create package contain these things? let me know – krs Jan 27 '14 at 06:20
  • Please open a new question as the question in your above comment does not have anything to do with configuring salt. – Jason Zhu Jan 27 '14 at 13:05