I am using DigitalOcean to host my servers. For your vm make sure you use image with Docker installed, or install it yourself.
--/
|__terraform/ ---> dir contains IaC deployed for this app
|__ansible/ ---> dir contains deployment configs for an app to VMs defined in **inventory.ini**
|__Makefile ---> file with commands to set up infra, deploy playbook, and work with vault
- save
secret.auto.tfvars
in./terraform/
folder, which will contain yourdo_token
: do-api-keydatadog_api_key
: datadog-api-keydatadog_app_key
: datadog-app-key
- change name property in
digitalocean_ssh_key
terraform data block to the name of your ssh key in DO - to use remote backend
- create free account with Terraform
https://app.terraform.io/app
- once account is created, follow the instructions on getting started page
- create an organization and select the
run terraform commands from local cli
option - create a workspcae and follow instructions
- change organization and workspaces inside the
backend.tf
file to what you have set them up in your account
- create free account with Terraform
- create
vault_password
file that you will be using to decrypt/encrypt your digital ocean token in Ansible.
$ make create-vault-pass
- empty contents of
/ansible/group_vars/webservers/datadog.yml
file and replace it with yourdo_token
.
vault_datadog_api_key : "your-do_token-here"
Once it's set, encrypt the file
$ make encrypt
- run to install required roles/collections for ansible
$ make install
We need to bring up our infra before we can make any configs with ansible
- run terraform commands to bring up your infrastructure (please follow requirements first to set up your remote backend)
$ make init
$ make plan
$ make apply
- once infra is setup, take note of ip addresses in the terraform
output
block in the terminal. copy them over toinventory.ini
- run
make deploy
command to set-up your vms with react_tic_toe app.
$ make deploy