Creating an Ubuntu 18.04 Server Foreman: Difference between revisions

Line 143: Line 143:


Host groups are used to quickly provision/configure servers of a specific type. For example, you can define a host group for Apache webservers that have all the correct modules installed for that specific type of server.
Host groups are used to quickly provision/configure servers of a specific type. For example, you can define a host group for Apache webservers that have all the correct modules installed for that specific type of server.
With all the previous configurations complete:
* Click Configure > Host groups > Create Host Group
* Use the following settings:
** Name: Basic
** Environment: production
** Puppet Master: puppet.bpopp.net
** Puppet CA: puppet.bpopp.net
* From the tabs:
** From Puppet Classes, add any desired modules for this host group
** From Network
*** Domain: bpopp.net
*** IPv4: bpopp.net
** From Operating System
*** Architecture: x86_64
*** Operating System: CentOS
*** Media: CentOS Mirror
*** PXELoader: PXELinux BIOS
*** Root Password: whatever

Revision as of 14:15, 24 August 2019

Install

Just do a basic install using ubuntu-18.04.3-live-server-amd64.iso

Prevent Floppy Errors

If your server does not have a floppy, Ubuntu will report errors. This can be prevented by preventing the loading of a floppy driver on the clients:

echo "blacklist floppy" | sudo tee /etc/modprobe.d/blacklist-floppy.conf
sudo rmmod floppy
sudo update-initramfs -u

Enable Netowrking

The first time I built my VM, networking didn't install correctly. If this happens, create a netplan in /etc/netplans (note that because it's YAML, indentation is important)

network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      dhcp4: true

Apply the netplan

sudo netplan apply

Verify that it worked

ifconfig

Host Name Setup

Ensure the Hostname is Set Correctly

sudo hostnamectl set-hostname puppet.bpopp.net

Modify the /etc/hosts file:

127.0.0.1 localhost
192.168.1.42 puppet.bpopp.net

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Install Foreman

Install Puppet

sudo apt-get -y install ca-certificates
cd /tmp && wget https://apt.puppet.com/puppet6-release-bionic.deb
sudo dpkg -i /tmp/puppet6-release-bionic.deb

There appear to be issues with puppet 6 and newer versions of foreman. Puppet 5 may work better:

wget https://apt.puppetlabs.com/puppet5-release-xenial.deb
sudo dpkg -i puppet5-release-xenial.deb
sudo apt update

Enable Foreman

echo "deb http://deb.theforeman.org/ bionic 1.22" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 1.22" | sudo tee -a /etc/apt/sources.list.d/foreman.list
sudo apt-get -y install ca-certificates
wget -q https://deb.theforeman.org/pubkey.gpg -O- | sudo apt-key add -

Install

sudo apt-get update && sudo apt-get -y install foreman-installer

Run

sudo foreman-installer \
 --enable-foreman-proxy \
 --foreman-proxy-tftp=true \
 --foreman-proxy-tftp-servername=192.168.1.42 \
 --foreman-proxy-dhcp=true \
 --foreman-proxy-dhcp-gateway=192.168.1.1 \
 --foreman-proxy-dhcp-nameservers="192.168.1.1" \
 --foreman-proxy-dhcp-range="192.168.1.150 192.168.1.175" \

Add the Puppetmaster as Host

Seems to be helpful to restart the puppetmaster after installing. To add the puppetmaster as a host, run this from the master:

sudo /opt/puppetlabs/bin/puppet agent --test

Now add our first module:

sudo /opt/puppetlabs/bin/puppet module install puppetlabs/ntp

Import the module from foreman:

  • Click Configure > Classes
  • Select "Any Organization" and "Any Location" from the menus in the menubar at the top
  • Click the "Import environments from puppet" button
  • Check the box next the module and click the "Update" button

Configure Foreman

  • Click Infrastructure > Subnets > Create Subnet
  • Use the following settings:
    • Name: bpopp.net
    • Network address: 192.168.1.0
    • Network Prefix: 24
    • Network Mask: 255.255.255.0
    • Gateway Address: 192.168.1.1
    • Primary DNS: 192.168.1.1
    • Boot Mode : DHCP
  • In the tabs:
    • Under Domain tab, select bpopp.net
    • Under Proxies tab, select the puppet.bpopp.net proxies for DHCP, TFTP, and HTTPBoot
    • From Locations and Organizations, select Default Location/Organization

Configure Operating Systems

For a CentOS box:

  • Click Hosts > Operating Systems > Create Operating System
  • Use the following settings:
    • Name: CentOS
    • Major Version: 7
    • Family: RedHat
    • Architecture: x86_64
  • From the tabs
    • In the partition table, select 'Kickstart default'
    • In the installation Media, select 'CentOS Mirror'

For a Debian box:

  • Click Hosts > Operating Systems > Create Operating System
  • Use the following settings:
    • Name: CentOS
    • Major Version: 7
    • Family: Debian
    • Release Name: stretch (important!)
    • Architecture: x86_64
  • From the tabs
    • In the partition table, select 'Preseed default'
    • In the installation Media, select 'Debian Mirror'

Create a Host Group

Host groups are used to quickly provision/configure servers of a specific type. For example, you can define a host group for Apache webservers that have all the correct modules installed for that specific type of server.

With all the previous configurations complete:

  • Click Configure > Host groups > Create Host Group
  • Use the following settings:
    • Name: Basic
    • Environment: production
    • Puppet Master: puppet.bpopp.net
    • Puppet CA: puppet.bpopp.net
  • From the tabs:
    • From Puppet Classes, add any desired modules for this host group
    • From Network
      • Domain: bpopp.net
      • IPv4: bpopp.net
    • From Operating System
      • Architecture: x86_64
      • Operating System: CentOS
      • Media: CentOS Mirror
      • PXELoader: PXELinux BIOS
      • Root Password: whatever