|
<%#
|
|
kind: finish
|
|
name: FreeBSD (mfsBSD) finish
|
|
oses:
|
|
- FreeBSD 10.0
|
|
%>
|
|
<%
|
|
# safemode renderer does not support unary negation
|
|
pm_set = @host.puppetmaster.empty? ? false : true
|
|
puppet_enabled = pm_set || @host.param_true?('force-puppet')
|
|
salt_enabled = @host.params['salt_master'] ? true : false
|
|
proxy_string = @host.params['http-proxy'] ? "http://#{@host.params['http-proxy']}:#{@host.params['http-proxy-port']}" : ''
|
|
%>
|
|
export http_proxy='<%= proxy_string %>'
|
|
/bin/echo '<%= root_pass %>' | pw usermod root -H 0
|
|
cat >> /etc/rc.conf <<EOF
|
|
hostname="<%= @host %>"
|
|
sshd_enable="YES"
|
|
ntpd_enable="YES"
|
|
EOF
|
|
|
|
echo ifconfig_`ifconfig -l | cut -d ' ' -f 1`=DHCP >>/etc/rc.conf
|
|
|
|
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
|
|
|
|
/bin/hostname <%= @host.name %>
|
|
cp /usr/share/zoneinfo/<%= @host.params['time-zone'] || 'UTC' %> /etc/localtime
|
|
adjkerntz -a
|
|
ntpdate <%= @host.params['ntp-server'] || '0.freebsd.pool.ntp.org' %>
|
|
env ASSUME_ALWAYS_YES=YES pkg bootstrap
|
|
|
|
<% if puppet_enabled %>
|
|
pkg install -y puppet
|
|
echo 'puppet_enable="YES"' >>/etc/rc.conf
|
|
cat > /usr/local/etc/puppet/puppet.conf << EOF
|
|
<%= snippet 'puppet.conf' %>
|
|
EOF
|
|
|
|
/usr/local/bin/puppet agent --config /usr/local/etc/puppet/puppet.conf --onetime --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
|
<% end -%>
|
|
|
|
<% if salt_enabled %>
|
|
pkg install -y py27-salt
|
|
cat > /usr/local/etc/salt/minion << EOF
|
|
<%= snippet 'saltstack_minion' %>
|
|
EOF
|
|
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
|
|
# Running salt-call to trigger key signing
|
|
/usr/local/bin/salt-call --no-color --grains >/dev/null
|
|
<% end -%>
|
|
<%= snippet('remote_execution_ssh_keys') %>
|
|
exit 0
|