This is an Ansible role that provisione hosts orchestrating several roles and backends.
Currently only VMware backend is supported.
-
A dhcpd host configured with amtega.dhcpd role. Within this host you need a network for provisioning, which name you must pass to the
host_provisioner_dhcpd_prov_net_name
variable (seedefaults/main.yml
for details) -
A cobbler host configured with amtega.cobbler role. Within this host you must configure all distros and profiles you need to install new hosts
-
Server with access to the backends platforms supported (e.g VMWARE vCenter/ESX). You must configure in your inventory all connection variables required by the backends (e.g amtega.vmware_provisioner)
-
All the hosts to provisione must have their network config defined in the inventory according to
amtega.network_interfaces
role.
Point 1 to 3 of the previous requirements can be fulfilled with multiple machines or in a single host.
A list of all the default variables for this role is available in defaults/main.yml
.
The role also setups the following facts:
host_provisioner_vms_filtered
: dict indicating hosts backends considered to provisione and the ones considered stalledhost_provisioner_macs
: dict mapping hostnames with the macs provided by all backendshost_provisioner_nics
: list of dicts with the all nics backends will configurehost_provisioner_dhcpd_hosts
: list of dicts with the hosts all backends will pass to the dhcpd serverhost_provisioner_cobbler_systems
: list of dicts with the systems vmware backend will pass to the cobbler serverhost_provisioner_vmware_vms_filtered
: dict indicating the vmware backend hosts to provisione and the ones considered stalledhost_provisioner_vmware_macs
: dict mapping hostnames with the macs provided by VMware backendhost_provisioner_vmware_nics
: list of dicts with the nics vmware backend will configurehost_provisioner_vmware_dhcpd_hosts
: list of dicts with the hosts vmware backend will pass to the dhcpd serverhost_provisioner_vmware_cobbler_systems
: list of dicts with the systems vmware backend will pass to the cobbler server
To use the role you must setup a playbook that calls the role multiple times against different hosts and provisioning stages. See variable host_provisioner_stage
in defaults/main.yml
for details about the involved hosts and stages. Also, you can find a playbook sample in files/site.yml
Tests are based on molecule with docker containers.
Due to the complexity of the role and the set of involved services, currently it's only posible to run tests aginst a real configured platform as described above. You must use a host with all services and set the following environment variables:
HOST_PROVISIONER_TEST_HOST
: host with the provisioning servicesHOST_PROVISIONER_TEST_VMS
: json list with the hostnames of the virtual machines to provisione. This testing virtual machines must be configured in an inventory with the structure required by theamtega.vmware_provisioner
and each host must have their network config defined in the inventory according toamtega.network_interfaces
role.HOST_PROVISIONER_GROUP
: group where to put testing virtual machines. Seehost_provisioner_group
role variable for details.
To provide the inventory with the testing virtual machines and the required role variables you must fill also these environment variables:
ANSIBLE_INVENTORY
: path to an inventoryANSIBLE_VAULT_PASSWORD_FILE
: path to the file containing the vault password required for the previous inventory
cd amtega.host_provisioner
HOST_PROVISIONER_TEST_HOST=myhost HOST_PROVISIONER_TEST_VMS="['testingvm1', 'testingvm2']" HOST_PROVISIONER_GROUP=provisioning_testing ANSIBLE_INVENTORY=~/myinventory ANSIBLE_VAULT_PASSWORD_FILE=~/myvaultpassword molecule test --all
Copyright (C) 2022 AMTEGA - Xunta de Galicia
This role is free software: you can redistribute it and/or modify it under the terms of:
GNU General Public License version 3, or (at your option) any later version; or the European Union Public License, either Version 1.2 or – as soon they will be approved by the European Commission subsequent versions of the EUPL.
This role is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details or European Union Public License for more details.
- Juan Antonio Valiño García.