terraform-repo: https://github.com/Pr3c10us/AWSAZURE-Postgres.git
disaster-recovery-ansible-repo: https://github.com/Pr3c10us/postgres-ansible-disaster-recovery.git
terraform init
terraform plan
terraform apply
- For Azure provider, you can get the value by following this steps on azure cli in the azure porter:
- az login
- az account list
- az account set --subscription="SUBSCRIPTION_ID"
- az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/SUBSCRIPTION_ID"
- appid for client_id
- password for client_secret
- tenant for tenant_id
- subscription_id for subscription_id
Use any text editor to edit the file "inventory" and replace the value of '<awx_IP>' with the public ip address of awx ec2 instance
ansible-playbook -i inventory --private-key postgres-instance-key.pem ./playbooks/awx-installation.yml -v
If you are using a diffrent key name, replace the "postgres-instance-key.pem" with the key name
username: admin
password: password
Make sure you are using http not https
- Click on the inventory tab
- Click on the add button
- Fill in the name of the inventory
- Select the organization
- Fill in the description
- Click on the save button
- Click on the hosts tab
- Click on the add button
- Fill in the name of the host with the instance ip address
- Select the inventory
- Fill in the description
- Click on the save button
- Click on the credential tab
- Click on the add button
- Select the machine credential type
- Fill in the name of the credential
- Select the organization
- Fill in the username with "ubuntu"
- Fill in the ssh key with the private key pem file
- Choose sudo as the privilege escalation method
- Click on the save button
- Click on the project tab
- Click on the add button
- Fill in the name of the project
- Select the organization
- Fill in the description
- Paste the git repo url in the scm url field
- Fill the source control branch with "main"
- Tick the "Update Revision on Launch" checkbox
- Click on the save button
- Click on the job template tab
- Click on the add button
- Click Add Job Template
- Fill in the name of the job template
- Fill in the description
- Select the Inventory
- Select the Project
- Select the Playbook
- Select the Credential
- Fill the variables field with the following values:
---
aws_IP: <master_ip_address>
aws_IP_haproxy: <haproxy_instance_ip_address>
azure_IP: <slave_ip_address>
rep_user: <replication_username_of_choice>
rep_user_password: <replication_password_of_choice>
example
---
aws_IP: 44.193.224.211
aws_IP_haproxy: 54.158.229.88
azure_IP: 20.123.174.208
rep_user: repuser
rep_user_password: repuser12345- Tick the "Enable Privilege Escalation" checkbox
- Click on the save button
- Click on the job template tab
- Click on the job template name
- Click on the launch button
- Copy the haproxy instance ip address
- Open the browser and paste the ip address in the url with port 7000
- You should see the haproxy dashboard