Loadbalancer Release 1.1.79 #79
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Project | |
on: | |
release: | |
types: [published] | |
jobs: | |
push_to_registries: | |
name: Run load balancer | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Terraform | |
- name: Set up Terraform | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.5.6 # Replace with your required version | |
# Step 3: Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
# Install Python dependencies | |
- name: Install Python and Dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install docker>=5.0.0 | |
python3 -m pip show docker | |
- name: Display Python version and path | |
run: | | |
which python3 | |
which docker | |
# Step 4: Install Ansible | |
- name: Install Ansible | |
run: | | |
sudo apt update | |
sudo apt install -y ansible | |
sudo apt install -y jq | |
- name: Write SSH Private Key | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
run: | | |
echo "$SSH_PRIVATE_KEY" > id_ecdsa | |
chmod 600 id_ecdsa | |
- name: Check if SSH private key exists | |
run: ls -l id_ecdsa | |
- name: Write SSH Public Key | |
env: | |
SSH_PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} | |
run: | | |
echo "$SSH_PUBLIC_KEY" > id_ecdsa.pub | |
chmod 600 id_ecdsa.pub | |
# Step 5: Initialize Terraform | |
- name: Initialize Terraform | |
run: terraform init | |
# Step 6: Plan Terraform deployment | |
- name: Plan Terraform | |
run: terraform plan | |
# Step 7: Apply Terraform configuration | |
- name: Apply Terraform | |
run: terraform apply -auto-approve | |
# Step 12: Run Ansible playbook | |
- name: Run Ansible Playbook | |
run: ansible-playbook -i ansible/inventory ansible/playbook.yml -e "backend_ips=$(terraform output -json backend_ips)" |