- Muchas notas - Fran Acién

20230324 - Deploy a machine on Hertzner using Terraform

Long time ago I create a script to deploy machines on hertzner, but for some reason is not documented and I would like to deploy a simple machine. Here I am going to deocument how I did it.

Install Terraform

Make it work

$ git clone https://github.com/acien101/Terraform-Hetzner-Deploy
$ cd Terraform-Hetzner-Deploy
$ mv example.terraform.tfvars terraform.tfvars
$ vim terraform.tfvars # Add credentials from hertzner
$ terraform init
$ terraform plan -var-file="terraform.tfvars"
$ terraform apply

From the repository you download it is necessary to update the variables with the credentials of hertner

Install some requirements

You need to install by hand requests, and then it will work.

sudo pip3 uninstall requests
sudo pip3 install requests=2.28.1

Running Anarres

It is necessary to make a apt-get update on the remote machine

$ git clone --recursive git@github.com:anarres-org/anarres.git
$ ansible-playbook --tags="init, common" --limit="ubuntu20" -i /home/facien/gitRepos/terraform/Terraform-Hetzner-Deploy/inventory full.yml

Connect

$ ssh delta@PUBLIC_IP