The purpose of the project, create a virtual machine on azure with ubuntu 22.04. Then, with ansible, install docker, docker-compose and launch the docker-compose on the virtual machine. The purpose of the docker-compose.yml is to collect virtual machine logs with Promtail and display then with Loki and Grafana.
I use Terraform locally cause I can't access to the Active Directory of my organization to create a ClientID, ClientSecret and TenantID. But initialy, the purpose is create the virtual machine from Gitlab in a pipeline.
This allow us to connect to Azure
az account list-locations
az vm image list
.\terraform\terraform.exe -chdir="./terraform" init
.\terraform\terraform.exe -chdir="./terraform" plan
.\terraform\terraform.exe -chdir="./terraform" apply
ssh -i <private key path> <user>@<public-ip>
ansible-playbook -i ansible/inventory ansible/playbook-docker.yml -u <user> --private-key=~/.ssh/id_rsa
Ansible run in .gitlab-ci.yml
<public-ip>:3000