This exercise aims to:
- Deploy OpenStack on two virtual machines using Kolla-Ansible
- Launch two virtual machines within OpenStack and ensure they can ping each other
- Configure internet access for the VMs using NAT
To deploy OpenStack, we need two virtual machines. We will create the following VMs:
- Control Node: The main machine where OpenStack services will be installed
- Resources: 12 GB RAM, 1 CPU, 20 GB Disk
- Compute Node: Provides computing resources managed by the control node
- Resources: 2 GB RAM, 1 CPU, 20 GB Disk
Once the VMs are created, connect to them via SSH.
In this guide:
- Compute Node IP:
10.119.68.144 - Control Node IP:
10.119.70.39 - The default user:
ubuntu
ssh ubuntu@10.119.68.144 # Compute Node
ssh ubuntu@10.119.70.39 # Control NodeOn both machines, switch to the root user
sudo -iTo allow Ansible to connect without prompting for passwords, set up SSH key-based authentication from the control node to itself and the compute node
- Generate an SSH key on both control and compute nodes
ssh-keygenPress Enter for all prompts to accept the default options.
- Add the control node public key to authorized keys on the control node:
cat .ssh/id_rsa.pub >> .ssh/authorized_keys- Add the compute node public key to authorized keys on the control node:
COMPUTE_PUB_KEY=<insert your public key>
echo $COMPUTE_PUB_KEY >> .ssh/authorized_keys- Verify passwordless SSH access (from the control node):
ssh root@10.119.68.144 # Compute Node
ssh root@10.119.70.39 # Control NodeIf successful, SSH should not prompt for a password.
Since firewalld may interfere with OpenStack, it should be removed from both VMs:
apt purge -y firewalldInstallation follows the official guide: Kolla-Ansible Quickstart
- Update package index
sudo apt update- Install required dependencies:
sudo apt install -y git python3-dev libffi-dev gcc libssl-dev python3-pipAlthough the official guide recommends using a virtual environment, our virtual machines are dedicated solely to this deployment, so we will install the packages system-wide
- Upgrade pip to the latest version:
pip install -U pip- Install Ansible:
pip install 'ansible-core>=2.15,<2.16.99'Install Kolla-Ansible from the OpenDev repository:
pip install git+https://opendev.org/openstack/kolla-ansible@stable/2024.1- Create the
/etc/kolladirectory
sudo mkdir -p /etc/kolla- Set proper permissions:
sudo chown $USER:$USER /etc/kolla- Copy the configuration files (
globals.ymlandpasswords.yml) to/etc/kolla:
cp -r /usr/local/share/kolla-ansible/etc_examples/kolla/* /etc/kollacp /usr/local/share/kolla-ansible/ansible/inventory/* .For this guide, we will use the multinode inventory.
Kolla-Ansible provides two inventory examples:
all-in-one– for deploying OpenStack on a single node (localhost)multinode– for deploying OpenStack across multiple nodes
kolla-ansible install-depsAdd hostnames for VMs to /etc/hosts
10.119.70.186 compute01
10.119.69.203 control01- In
[control]section, keep onlycontrol01 - In
[network]section, keep onlycontroland rename it to[network:children] - In
[compute]section, keep onlycontrol01andcompute01 - In
[monitoring]section, remove all entries - In
[storage]section, remove all entries - The rest leave unchanged
Once the inventory is configured, test connectivity between nodes using Ansible:
ansible -i multinode all -m pingIf everything is set up correctly, all nodes should respond with "pong".
Kolla-Ansible stores all deployment passwords in the /etc/kolla/passwords.yml file. By default, these passwords are empty and must be generated manually or automatically:
kolla-genpwd- Set the base operation system:
kolla_base_distro: "ubuntu"- Set the internal virtual IP (VIP) for OpenStack services (use the control node IP):
kolla_internal_vip_address: "10.119.70.39"- Specify the network interface used for internal communication (should be the main network interface of the control node):
network_interface: "ens3"- Configure the external network interface for Neutron (we will create this virtual interface later):
neutron_external_interface: "veth0"- Disable HAProxy (as in the task specification):
enable_haproxy: "no"Kolla-Ansible requires an external interface for Neutron networking. Since our VMs do not have a dedicated physical interface for this purpose, we will create a virtual Ethernet (veth) pair
Reference: Netplan veth peer links
Create a systemd network configuration file for the virtual interface
sudo tee /etc/systemd/network/25-veth-b1b2.netdev <<EOF
[NetDev]
Name=veth0
Kind=veth
[Peer]
Name=veth1
EOFModify /etc/netplan/50-cloud-init.yaml to include veth0 and veth1
network:
version: 2
ethernets:
ens3:
dhcp4: true
match:
macaddress: fa:16:3e:a2:a5:0f
set-name: ens3
veth0: {}
veth1: {}netplan generate
netplan apply- Install necessary dependencies on all target nodes
kolla-ansible -i ./multinode bootstrap-servers- Ensure all nodes meet the requirements before deployment
kolla-ansible -i ./multinode prechecks- Deploy OpenStack
kolla-ansible -i ./multinode deployWhen this playbook finishes, OpenStack should be functional.
pip install python-openstackclient -c https://releases.openstack.org/constraints/upper/2024.1kolla-ansible post-deployThis will generate /etc/kolla/cloud.yaml, which contains admin credentials.
export OS_CLIENT_CONFIG_FILE=/etc/kolla/clouds.yaml
export OS_CLOUD=kolla-adminOS_CLIENT_CONFIG_FILE specifies the cloud configuration file with admin credentials
OS_CLOUD defines the cloud name to be used for authentication
Create default networks, images, and other resources:
/usr/local/share/kolla-ansible/init-runonceopenstack server create \
--image cirros \
--flavor m1.tiny \
--key-name mykey \
--network demo-net \
demo1openstack server create \
--image cirros \
--flavor m1.tiny \
--key-name mykey \
--network demo-net \
demo2Now log into your OpenStack and access the consoles of two created VMs and try to ping:
- From
demo1todemo2
ping 10.0.0.49- From
demo2todemo1
ping 10.0.0.143If both pings are successful, the VMs are correctly configured.
Since internet access is not set up yet, we will face the error Destination Host Unreachable when trying to ping Google's DNS server 8.8.8.8
ping 8.8.8.8Perform these steps on the control node
echo 1 > /proc/sys/net/ipv4/ip_forwardIn the OpenStack configuration, we can see a network with the following settings:
- Network address -
10.0.2.0/24 - Gateway IP -
10.0.2.1
Using that information, we can set up the virtual network
ip addr add 10.0.2.1/24 brd 10.0.2.255 dev veth1iptables -t nat -A POSTROUTING -s 10.0.2.0/24 -j MASQUERADETry pinging Google's DNS server again:
ping 8.8.8.8If ping is successful, the internet access is correctly configured.





