{"id":669,"date":"2019-02-08T13:49:06","date_gmt":"2019-02-08T10:49:06","guid":{"rendered":"https:\/\/artem.services\/?p=597"},"modified":"2019-02-20T00:01:31","modified_gmt":"2019-02-19T21:01:31","slug":"saltstack-d1-83-d1-81-d1-82-d0-b0-d0-bd-d0-be-d0-b2-d0-ba-d0-b0","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=669&lang=en","title":{"rendered":"Saltstack &#8212; Installation"},"content":{"rendered":"<h4>Install Master<\/h4>\n<p><strong>CentOS 7<\/strong><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nyum install https:\/\/repo.saltstack.com\/yum\/redhat\/salt-repo-latest.el7.noarch.rpm\r\n\r\nyum install salt-master salt-minion salt-ssh salt-syndic salt-cloud salt-api\r\n<\/pre>\n<p>Add to autorun and run:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl enable salt-master\r\nsystemctl start salt-master\r\n<\/pre>\n<blockquote><p>Installation may require dependencies in the EPEL repository.<\/p><\/blockquote>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nyum install epel-release\r\n<\/pre>\n<p><!--more--><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Ubuntu &#8212; 18.04<\/strong><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nwget -O - https:\/\/repo.saltstack.com\/apt\/ubuntu\/18.04\/amd64\/latest\/SALTSTACK-GPG-KEY.pub | sudo apt-key add -\r\n\r\necho -e &quot;deb http:\/\/repo.saltstack.com\/apt\/ubuntu\/18.04\/amd64\/latest bionic main&quot; &amp;amp;gt; \/etc\/apt\/sources.list.d\/saltstack.list\r\n\r\napt update\r\n\r\napt install salt-master salt-minion salt-ssh salt-syndic salt-cloud salt-api\r\n<\/pre>\n<p>Add to autorun and run:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl enable salt-master\r\nsystemctl start salt-master\r\n<\/pre>\n<p>In <strong>Salt<\/strong>, the minions connect to the master, so it\u2019s enough to open <strong>TCP<\/strong> ports <strong>4505<\/strong>,<strong>4506<\/strong> on the master for <strong>Saltstack<\/strong> to work.<\/p>\n<p>&nbsp;<\/p>\n<h4>Minion installation<\/h4>\n<p><strong>CentOS<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nyum install salt-minion salt-ssh\r\n<\/pre>\n<p><strong>Ubuntu<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\napt install salt-minion salt-ssh\r\n<\/pre>\n<p>Add to autorun and run:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl enable salt-minion\r\nsystemctl start salt-minion\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4>Connection:<\/h4>\n<p>By default, the minions are looking for a wizard on the network named &quot;<strong>salt<\/strong>&quot;.<\/p>\n<p>To change, either in the file &quot;<strong>\/etc\/salt\/minion<\/strong>&quot; find the line:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#master: salt\r\n<\/pre>\n<p>Uncomment and change the name, or specify the IP address, then restart the minion, or write in the &quot;<strong>\/etc\/hosts<\/strong>&quot; record &quot;<strong>salt<\/strong>&quot; with the IP address of the master.<\/p>\n<p>On the wizard, see the requests to add:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsalt-key -L\r\nAccepted Keys:\r\nDenied Keys:\r\nUnaccepted Keys:\r\nip-172-31-22-119.ec2.internal\r\nRejected Keys:\r\n<\/pre>\n<p>And we see:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nUnaccepted Keys:\r\nip-172-31-22-119.ec2.internal\r\n<\/pre>\n<p>That one key is awaiting approval. To take all the keys at once, do:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsalt-key -A\r\n<\/pre>\n<blockquote><p>This is if you are sure that this is exactly your minions. If not, verify key prints.<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<h4>Examples of simple commands.<\/h4>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsalt '*' test.ping\r\n<\/pre>\n<p>We check the &quot;<strong>alive<\/strong>&quot; of all the minions, in response they should just send the answer &quot;<strong>True<\/strong>&quot;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nip-172-31-22-119.ec2.internal:\r\n    True\r\n<\/pre>\n<p>We execute the remote command on all the minions, in this case, this is the listing of the &quot;<strong>\/home<\/strong>&quot; directory<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsalt '*' cmd.run 'ls -l \/home\/'\r\n<\/pre>\n<p>Install the package &quot;<strong>vim<\/strong>&quot; on all minions<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsalt '*' pkg.install vim\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Install Master CentOS 7 Add to autorun and run: Installation may require dependencies in the EPEL repository.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[399],"tags":[401,403],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/669"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=669"}],"version-history":[{"count":3,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/669\/revisions"}],"predecessor-version":[{"id":672,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/669\/revisions\/672"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}