Quick Start Guide¶
This setup was tested under Windows 10 with the following components:
- VirtualBox = 6.0.14
- Vagrant = 2.2.6
- Ansible = 2.8.2 within Cygwin 2.10.0, see Jeff Geerling's Blog to Running Ansible within Windows
and under Ubuntu 16.04 LTS (Xenial Xerus) and Ubuntu 18.04 LTS (Bionic Beaver) with:
This document does not explain how to install these components. You have to do it yourself by reading the installation guides of these components.
Get the Vagrant Environment¶
For the next steps open a bash (under Windows a cygwin bash) on the virtual host system.
Download Vagrant box configuration¶
git clone https://gitlab.com/cogline_vagrant/ansible-development.git cd ansible-development
Get Ansible roles for provisioning¶
Now install Ansible roles defined under
ansible-galaxy install -r provisioning/requirements.yml -p provisioning/roles
Install vagrant plugins¶
Before using this Vagrant environment, you still need to install the following plugins.
vagrant plugin install vagrant-vbguest vagrant plugin install vagrant-hostmanager
If you use Vagrant with libvirt under Linux, you also need to install the following plugins
vagrant plugin install vagrant-libvirt vagrant plugin install vagrant-mutate
# on Debian/Ubuntu systems sudo apt install -y nfs-kernel-server # on Enterprise Linux (CentOS/RedHat) sudo yum -y install nfs-utils
The next step will start all Ansible Clients and the Ansible management node. While starting the first time Vagrant will be run any configured provisioners against the running managed machines.
This will take a few minutes
The first time this step takes a while. All required Vagrant Boxes will be downloaded from the Vagrant Cloud. Depending on the speed of your internet connection, this will take a few minutes. Subsequently, the individual systems are started and provisioned in sequence. Then the environment is ready for the development and testing of new Ansible playbooks and roles.
The Vagrant environment can be started with the provider VirtualBox as follows.
If you want to use vagrant with libvirt instead of VirtualBox, use
VAGRANT_DEFAULT_PROVIDER=libvirt vagrant up --no-parallel
libvirt: Switch off the parallel installation the first time
The provider libvirt usually performs the installation of virtual machines
in parallel. It happens that Ansible Provisioner is running on the master
node before all Ansible clients are up and running. Therefore, the Ansible
Provisioner sometimes can not reach all clients through SSH from the master
node, and Ansible fails for the affected clients. Therefore, when starting
the environment for the first time, the parallel installation should be
suppressed using the vagrant option
If you have not turned off the parallel installation and the Ansible provisioner fails, then the provisioning on the master node can be re-executed with the following command after all clients are up and running.
VAGRANT_DEFAULT_PROVIDER=libvirt vagrant provision master