Skip to content

Instantly share code, notes, and snippets.

@jleskovar
Last active September 13, 2015 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jleskovar/a3f8802394bf5322ea69 to your computer and use it in GitHub Desktop.
Save jleskovar/a3f8802394bf5322ea69 to your computer and use it in GitHub Desktop.
#!/bin/bash -x
set -e
apt-get -y install ca-certificates
wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
dpkg -i puppetlabs-release-trusty.deb
echo "deb http://deb.theforeman.org/ trusty 1.9" > /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 1.9" >> /etc/apt/sources.list.d/foreman.list
wget -q http://deb.theforeman.org/pubkey.gpg -O- | apt-key add -
if ! ping -q -c1 $(hostname -f) | grep -v 127.0; then
echo "Expected \`hostname -f\` to resolve to non-local address. Verify /etc/hosts is correct and restart"
exit 1
fi
apt-get update && apt-get -y install foreman-installer
foreman-installer --foreman-admin-password=changeme
# Adjust TFTP_ADDRESS to work around bug in upstart tftpd-hpa script
[ -f /etc/default/tftpd-hpa ] && sed -i 's/TFTP_ADDRESS=.*/TFTP_ADDRESS=":69"/g' /etc/default/tftpd-hpa && service tftpd-hpa restart
echo "Performing \`puppet agent --test\` to send initial report to foreman. Please ignore any warnings about missing node"
puppet agent --test
# Don't function as a DNS server:
#port=0
# Log lots of extra information about DHCP transactions.
log-dhcp
# Set the root directory for files available via FTP.
tftp-root=/var/lib/tftpboot
# The boot filename.
dhcp-boot=/var/lib/tftpboot/pxelinux.0
# rootpath option, for NFS
#dhcp-option=17,/var/www/PXE
# kill multicast
dhcp-option=vendor:PXEClient,6,2b
# Disable re-use of the DHCP servername and filename fields as extra
# option space. That's to avoid confusing some old or broken DHCP clients.
dhcp-no-override
# PXE menu
#pxe-prompt="Press F8 for boot menu", 3
# The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86,
# Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI
pxe-service=X86PC, "Boot from network", pxelinux
# A boot service type of 0 is special, and will abort the
# net boot procedure and continue booting from local media.
#pxe-service=X86PC, "Boot from local hard disk", 0
# This range(s) is for the public interface, where dnsmasq functions
# as a proxy DHCP server providing boot information but no IP leases.
# Any ip in the subnet will do, so you may just put your server NIC ip here.
dhcp-range=10.1.1.0,proxy,255.255.255.0
#!/bin/bash
apt-get -qq --purge -y remove foreman foreman-installer foreman-proxy
rm -rf /var/lib/foreman /usr/share/foreman /usr/share/foreman-proxy/logs
rm -f /etc/apache2/conf.d/foreman.conf
apt-get -qq remove --purge -y puppet puppetmaster puppet-common puppetmaster-common puppetlabs-release
rm -rf /usr/lib/ruby/vendor_ruby/puppet /usr/share/puppet /var/lib/puppet /etc/puppet
rm -rf /etc/apache2/conf.d/puppet.conf
apt-get -qq remove --purge -y postgresql-*
apt-get -qq autoremove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment