Project

General

Profile

Download (1.07 KB) Statistics
| Branch: | Tag: | Revision:
<%#
kind: snippet
name: saltstack_setup
description: this snippet will configure the Saltstack Minion
%>
<%
etc_path = (@host.operatingsystem.family == 'Freebsd') ? '/usr/local/etc/salt' : '/etc/salt'
bin_path = (@host.operatingsystem.family == 'Freebsd') ? '/usr/local/bin' : '/usr/bin'
%>

<% if @host.operatingsystem.family == 'Debian' -%>
apt-get update
apt-get install -y salt-minion
<% elsif @host.operatingsystem.family == 'Freebsd' -%>
pkg install -y py27-salt
<% elsif @host.operatingsystem.family == 'Redhat' -%>
yum -t -y install salt-minion
<% end -%>

cat > <%= etc_path %>/minion << EOF
<%= snippet 'saltstack_minion' %>
EOF

<% if @host.operatingsystem.family == 'Freebsd' -%>
echo 'salt_minion_enable="YES"' >>/etc/rc.conf
echo 'salt_minion_paths="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"' >>/etc/rc.conf
<% elsif @host.operatingsystem.family == 'Redhat' -%>
/sbin/chkconfig --level 345 salt-minion on
<% elsif @host.operatingsystem.family == 'Suse' -%>
/sbin/chkconfig salt-minion on -f
<% end -%>

<%= bin_path %>/salt-call --no-color --grains >/dev/null
(16-16/16)