Provisioning Openstack with Foreman and Packstack

This post will describe how to set up Foreman and provision an OpenStack environment via PackStack. We demonstrate this through OpenStack installation on two Nodes. Foreman 1.8 is used to install the Host System on the Nodes and PackStack to provision OpenStack.

Installing Foreman

First thing we do is installing Foreman on the management host inside a VM and we use Vagrant to have the installation part of Foreman already automated in case of redeployment. The requirements include: Vagrant and VirtualBox installed, as well as having the “Ubuntu/Trusty64” box added to Vagrant.

Execute the “vagrant init” command and open the Vagrant file with a text editor of your choice. After the Vagrant file configuration, forward the port 443 to a port on the host and specify the private network; link the script that will be run after the Ubuntu installation. "forwarded_port", guest: 443, host: 8080 "private_network", ip: ""

  config.vm.provision "shell", inline: < "files/"  

The script should automatically set the hostname as well as install the Foreman-installer. Make sure that it is placed at the location you point at in your Vagrant file.

    #Correcting the hostname
    echo localhost > /etc/hosts
    echo foreman18.loc.local foreman18 >> /etc/hosts
    apt-get update
    apt-get upgrade -y

    #Download and Installation of Puppet:
    apt-get -y install ca-certificates
    sudo dpkg -i puppetlabs-release-utopic.deb
    #Download and Installation of the Foreman-Installer to install Foreman:
    echo "deb trusty 1.8" > /etc/apt/sources.list.d/foreman.list
    echo "deb plugins 1.8" >> /etc/apt/sources.list.d/foreman.list
    wget -q -O- | apt-key add -
    apt-get update && apt-get -y install foreman-installer
exit 0;


After creating the file, bring the Vagrant box up and ssh into the machine.
One of the parameters to pass to the command that installs Foreman, is the Foreman Discovery Plugin that enables Foreman to do automatic bare-metal discovery of unknown nodes on the provisioning network.

~$ sudo foreman-installer --enable-foreman-plugin-discovery --foreman-plugin-discovery-install-images=true


Write down the login credentials and then reboot the system. After the reboot you should be able to access Foreman under this address: https://localhost:8080

Configuration of Foreman

Next step is the Provisioning Setup. Log into Foreman, then go to Infrastructure–> Provisioning Setup and fill in the needed Information. You should fix a gateway for the network otherwise you would get problems when provisioning the machines.
In our example we will use Foreman as DNS, DHCP, and GW. Our settings:

Name: prov-network Network address*: Network mask*: Gateway: (foreman) Primary DNS: (foreman) IPAM: DHCP Boot mode DHCP

Submit and copy the displayed script that into the Terminal. After this step continue to the next window and select the Ubuntu Mirror under “Existing Medium” before submitting again. Now everything is done to provision the hosts.

Provisioning Hosts

The next task is to boot the hosts over the network (with PXE). Make sure that they are listed under hosts.

If the error message “ip already given” pops up during the provisioning process, you have to ACK it and under Network settings, press “Suggest new one”. Repeat this step for each host.

After the provision you need to change the name of the interfaces. It is important that all the interfaces are mapped the same way on all of the hosts.

For example:

eth0 --> private
eth1 --> public

eth0 --> private

The following commands need to be executed on each host.

First add to “/etc/default/grub” the :

sudo vi /etc/default/grub

GRUB_CMDLINE_LINUX=" splash=quiet nofb crashkernel=auto net.ifnames=0 rhgb quiet"

This line is needed to assign the same name to the network interfaces – a requirement from OpenStack.

Afterwards execute the following command and reboot the machine:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

When the machine has finished rebooting you need to add the following line to “/etc/udev/rules.d/70-persistent-net.rules”:

sudo vi /etc/udev/rules.d/70-persistent-net.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b0:83:fe:5e:f1:ec", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Remember that you have to do the steps above for each of the hosts.

Preparation of the Nodes for the OpenStack installation

We now prepare the Nodes for the next step, the OpenStack installation.

First, disable firewalld:

systemctl stop firewalld
systemctl disable firewalld

Than, set SELINUX to permissive:

setenforce 0
vim /etc/sysconfig/selinux


Afterwards, disable the Network Manager and migrate to “network” before rebooting the machines:

systemctl disable NetworkManager
systemctl stop NetworkManager
systemctl enable network

When the reboot has finished check if all the “ifcfg-*” files look sane under “/etc/sysconfig/network-scripts/”. If they are sane they will look similar to this:


Controller node interface configuration

Now we will configure the interface of the OpenStack controller node.

cat /etc/sysconfig/network-scripts/ifcfg-p4p2

# Generated by dracut initrd

Also set the gateway in “/etc/sysconfig/network”.

vim /etc/sysconfig/network

# Created by anaconda

The next step is to install PackStack and let it create the OpenStack environment, by passing it a so called “answer file” you previously create. It is very important that you configure your own answer file as it is tightly coupled to the particular environment. The process may take you several re-runs of the answer file until you fully eliminate any error and finish the process successfully.


To install PackStack execute the following commands:

sudo yum update -y
sudo yum install -y
sudo yum install -y openstack-packstack


Finally, to let PackStack set up the OpenStack environment, we pass it the “answer_file_name” file we created.

packstack --anwser-file=[answer_file_name]


Leave a Reply

Your email address will not be published. Required fields are marked *