This repo contains DevOps\IaC procedures to automate the followings:
- Provisioning of 3 CentOS virtual machines (one control node and two worker nodes)
- Creation of a 50 GB ext4 partition for Docker
- Installation of Docker
- Installation of Docker Swarm
- Securing of Docker Rest Api via TLS certificate generation
- Configure Docker auto-start at boot
- Interact and deploy services on the Swarm from the control node.
This code has been tested on a windows 11
host with vagrant
version 2.2.19
and virtual box version 6.1.34
.
By making use of the Ansible Local
Vagrant provisioner we are able to provision the guest by executing ansible-playbook directly on the targets machine.
Followings are the required Vagrant Plugins:
vagrant-disksize (0.1.3, global)
vagrant-vbguest (0.21.0, global)
Clone this repo and start the provisioning:
git clone https://github.com/R3DRUN3/centos_ansible_provisioning.git \
&& cd centos_ansible_provisioning && Vagrant up
An ansible linting GitHub action is associated with push on this repo main branch:
Note that it fails because it cannot find some of the roles referenced in the playbook provisioning.yml:
This is not a real error but rather a false positive given by the fact that the procedure uses the vagrant ansible_local provisioner, which allows us to run playbooks on target machines.
This way the ansible galaxy roles do not need to be inside the repo (which could weigh down the code base in case of playbooks that use hundreds of roles) but they are automatically downloaded on targets machine via this line in the Vagrant file:
ansible.galaxy_command = "sudo ansible-galaxy install --role-file=%{role_file} --roles-path=%{roles_path} --force"