The purpose of this repository is to host the end of degree project in Computer Engineering from the Higher School of Informatics and Telecommunications of Granada.
The main objective of this work can be divided into different parts.
-
Automate everything related to infrastructure of a company using Ansible playbooks.
-
Implement CI/CD for a company that develops Django projects.
Anyway, to make this repository more readable, it will be divided into three blocks that are explained below.
Summarizing this part, configure a Hetzner server from scratch, installing and configuring the virtualization service proxmox. For more detail follow the links below.
- Activate rescue mode on the nodes on Hetzner panel.
- Create your
hosts.yml
file. As an example if you want to execute first part of the project ahosts.yml
file should look like:
---
all:
hosts:
children:
proxmox_master:
hosts:
node1.yourdomain.com:
ansible_host: node1.yourdomain.com
ansible_user: root
node: node1
proxmox_slave:
hosts:
node2.yourdomain.com:
ansible_host: node2.yourdomain.com
ansible_user: root
node: node2
proxmox_nodes:
hosts:
node3.yourdomain.com:
ansible_host: node3.yourdomain.com
ansible_user: root
node: node3
proxmox:
hosts:
node1.yourdomain.com:
node2.yourdomain.com:
node3.yourdomain.com:
-
Make sure that
Makefile
is pointing to correct hosts.yml file. -
Configure playbook vars. At the beggining of the playbook there are a few vars you must fill.
-
Execute playbook. With TAGS var you can choose wich parts of the playbook execute, in case you don't want to execute everything.
make PLAYBOOK=configure_proxmox_nodes TAGS=all playbook
- Finally, you can access proxmox control panel through https://nodeX.domain.com:8006
If Part 1 is completed, we should have:
- Hetzner Server provisioned with some packages and Debian 10 installed.
- Proxmox
This second part includes:
- Creation and provisioning of different types of VM's.
- Creation of LAN infrastructure.
Ideally the infrastructure should look like:
Includes:
- Failover IP: If master node goes down failover IP will change to the slave node.
- Redundant firewall: Two pfSense firewall VM's. One in each node. In case that master goes down, the CARP virtual ip switches to the slave that takes the control till master comes back.
- deploy_pfsense_firewall.yml
- create_gitlab.yml
- create_ceph_cluster.yml
- create_virtualmin.yml
- create_webproxy.yml
- create_icinga2.yml
- create_galera_cluster.yml
- create_rabbitmq.yml
- create_swarm_cluster.yml
- create_kubernetes_cluster.yml
This part includes the deployment of many services on the Proxmox cluster. You may want to deploy all of some of them. Each service is managed by an Ansible playbook and has a role associated. Check each playbook doc to learn how to deploy each service.
- Configure
hosts.yml
file. You must add one entry per each service you want to deploy. For example, if we want to deploy all services our hosts file should look like hosts file.
This project is for Django + Angular application. Check dockerize app to learn how to dockerize a Django + Angular app.
Thanks to the deployment of servies of part 2, we have GitLab on our cluster and we are going to configure it in order to create CI/CD pipelines. Check gitlab ci to learn how to create CI/CD pipelines for a containerized app.