|
|
|
|
|
|
|
|
|
|
|
service network restart
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Updating system time"
|
|
yum -y install ntpdate
|
|
systemctl enable --now ntpd
|
|
/usr/sbin/hwclock --systohc
|
|
|
|
|
|
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# update all the base packages from the updates repository
|
|
if [ -f /usr/bin/dnf ]; then
|
|
dnf -y update
|
|
else
|
|
yum -t -y update
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "blacklist amodule" >> /etc/modprobe.d/blacklist.conf
|
|
|
|
|
|
|
|
|
|
if [ -f /usr/bin/dnf ]; then
|
|
dnf -y install puppet
|
|
else
|
|
yum -t -y install puppet
|
|
fi
|
|
|
|
cat > /etc/puppet/puppet.conf << EOF
|
|
[main]
|
|
vardir = /var/lib/puppet
|
|
logdir = /var/log/puppet
|
|
rundir = /var/run/puppet
|
|
ssldir = \$vardir/ssl
|
|
|
|
[agent]
|
|
pluginsync = true
|
|
report = true
|
|
certname = snapshot-ipv4-dhcp-el7
|
|
|
|
EOF
|
|
|
|
|
|
puppet_unit=puppet
|
|
/usr/bin/systemctl list-unit-files | grep -q puppetagent && puppet_unit=puppetagent
|
|
/usr/bin/systemctl enable ${puppet_unit}
|
|
|
|
# export a custom fact called 'is_installer' to allow detection of the installer environment in Puppet modules
|
|
export FACTER_is_installer=true
|
|
# passing a non-existent tag like "no_such_tag" to the puppet agent only initializes the node
|
|
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag --no-daemonize
|
|
|
|
|
|
|
|
cat << EOF > /root/ansible_provisioning_call.sh
|
|
#!/bin/sh
|
|
|
|
echo "Calling Ansible AWX/Tower provisioning callback..."
|
|
/usr/bin/curl -v -k -s --data "host_config_key=" https:///api/v2/job_templates//callback/
|
|
echo "DONE"
|
|
EOF
|
|
chmod +x /root/ansible_provisioning_call.sh
|
|
/root/ansible_provisioning_call.sh
|
|
|
|
sync
|
|
|
|
PATH=/usr/bin:/usr/sbin:/bin:/sbin:$PATH shutdown -r +1
|
|
|
|
exit 0
|