Ansible¶
We use Ansible to configure all of our machines. You don’t need to be familiar with Ansible to use our playbooks, but it surely helps, especially if you want to customise your setup.
You can find our Ansible git repository here. Each role is documented within its own directory, with the high level README giving an explanation on how to hack on the ansible setup.
If you have never used Ansible before, don’t worry. The documentation is pretty well made. You can also find a very basic guide on how to get started with Ansible on this page.
Before trying to use our playbooks, we recommend you get to know our setup some more. We classify machines during the install by their role and you will have a hard time understanding what Ansible does if you don’t have a basic idea of what you are trying to build.
Manual install¶
In the long run, we think you should be using a PXE server to install your machines. It means you have to control the DHCP server, but having your video machines on a separate VLAN is a good practice anyway.
We’ll thus start by running Ansible on a fresh Debian install to create the DHCP and PXE server you will be using to install all the other machines. Alternatively, if you don’t want to have a PXE server, you can use this guide to install other types of machines directly.
Our ansible playbooks require ansible 2.4 or later. This is available in Debian Stretch backports. While your target machine is installing Debian, clone our playbooks and install Ansible locally on your development machine:
$ git clone https://salsa.debian.org/debconf-video-team/ansible.git
$ sudo apt install ansible
Next, you’ll need to configure Ansible’s host declaration (the default location
of that file is /etc/ansible/hosts
) to tell Ansible where the machine
you are trying to install is. This is also the file where you’ll be classifying
your machines.
You should end up with something like this:
[dhcp-server]
$NODE_IP ansible_connection=ssh ansible_user=root
[tftp-server]
$NODE_IP ansible_connection=ssh ansible_user=root
Next, have a look at our example inventory files (if needed, you can point
to its location in the ansible config file - /etc/ansible/ansible.cfg
.
You should change the inventory to add your ssh key, configure the machine’s
users and setup the DHCP and networking options.
Make sure you can ssh into the machine you are trying to install and then run a test run (it won’t make any changes to the target machine for now):
$ ansible-playbook -C site.yaml -l $NODE_IP
Once you are ready to install the DHCP and the PXE server, run the command again
without the -C
parameter to apply the changes:
$ ansible-playbook site.yaml -l $NODE_IP
Kerplow! If everything went well, you now have a working DHCP and PXE server you can use to install all the other machines!
PXE boot¶
Once you have the PXE machine installed, network boot the other machines you want to install.
The PXE server will prompt you for a few things (passwords, usernames, etc.) and will finish by cloning our ansible playbooks onto the machine and running them.
Chances are you want to use your custom inventory files to classify your nodes
and pass the right configurations to them. The tftp-server
role has a few
parameters you can pass to it to change what ansible git repository is used and
where the inventory file is fetched from:
playbook_repo: https://salsa.debian.org/debconf-video-team/ansible.git
playbook_branch: master
inventory_repo: https://gitlab.com/yourname/ansible-inventory
inventory_branch: master