Setup infrastructure with Terraform
For control your servers infrastructure use following steps:
- Check
./iac/terraform/*.tf
files, update your provider and infrastructure settings - Add provider credentials. For example for AWS use
~/.aws/credentials
file. Addaws_access_key_id
andaws_secret_access_key
. Configuration and credential file settings - Add your deployment public key
id_rsa.pub
to./iac/terraform/public_keys/
folder - Run terraform commands:
make terraform [command]
Examples:
make terraform init
make terraform plan
make terraform apply
Automate server apps with Ansible
For running server setup automations use this steps:
- Add public key to
~/authorized_keys
file on servers (usemake terraform apply
command if you haven’t already done so) - Check your credentials in
./.ssh
folder. Use ssh config file to simplify connections. - Check
./iac/ansible/inventory.yml
servers and credentials, host names should be the same as on ssh config file. - Check
./iac/ansible/playbook.yml
file hosts and tasks. Hosts must correspond to inventory hosts. - Run ansible command:
make ansible
This will run main playbook ansible-playbook -i iac/ansible/inventory.yml iac/ansible/playbook.yml
for all hosts.
To run playbook for specific host use command:
make ansible -- --limit [host]
After that you will be able to run CI/CD deployment pipelines automations.