Skip to content

Update terraform-inventory.py #47

Update terraform-inventory.py

Update terraform-inventory.py #47

Workflow file for this run

name: main-pipeline
#30 openstack keypair delete ${{ env.GITHUB_OWNER }}-00
on:
push:
branches:
- main
jobs:
get-runners-up-and-running:
runs-on: ubuntu-latest
env:
OS_TENANT_ID: ${{ secrets.OS_TENANT_ID }}
OS_TENANT_NAME: ${{ secrets.OS_TENANT_NAME }}
OS_USERNAME: ${{ secrets.OS_USERNAME }}
OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
OS_REGION_NAME: "DE1"
TF_VAR_ANSIBLE_USER: "ubuntu"
GITHUB_OWNER: ${{ github.actor }}
steps:
- uses: actions/checkout@v2
- name: install mamba
uses: mamba-org/provision-with-micromamba@main
- name: set ups and create instances
shell: bash -l {0}
run: |
source ./openrc.sh ${{ env.OS_TENANT_ID }} ${{ env.OS_TENANT_NAME }} ${{ env.OS_USERNAME }} ${{ env.OS_PASSWORD }} ${{ env.OS_REGION_NAME }}
bash ./set_env.sh ${{ env.OS_TENANT_ID }} ${{ env.OS_TENANT_NAME }} ${{ env.OS_USERNAME }} ${{ env.OS_PASSWORD }} ${{ env.GITHUB_OWNER }}
source ./prep_tf.sh ${{ env.GITHUB_OWNER }}
openstack keypair delete ${{ env.GITHUB_OWNER }}-00
bash ./start_instances.sh
- name: Upload the tfstate file
uses: actions/upload-artifact@v3
with:
name: tfstate
path: tf/openstack/terraform.tfstate
- name: Upload the private key
uses: actions/upload-artifact@v3
with:
name: idrsa
path: id_rsa
- name: Upload the pub key
uses: actions/upload-artifact@v3
with:
name: idrsa_pub
path: id_rsa.pub
- name: configure the runners with ansible
shell: bash -l {0}
run: bash ./run.sh ${{ env.GITHUB_OWNER }}
run-on-runner1:
needs: get-runners-up-and-running
runs-on: [self-hosted,linux,x64,runner1]
steps:
- name: list the files
shell: bash -l {0}
run: ls -al
- name: create a file
shell: bash -l {0}
run: touch helloworld-runner1.txt
- name: list the files
shell: bash -l {0}
run: ls -al
- name: echo
shell: bash -l {0}
run: echo "hello world"
run-on-runner2:
needs: get-runners-up-and-running
runs-on: [self-hosted,linux,x64,runner2]
steps:
- name: list the files
shell: bash -l {0}
run: ls -al
- name: create a file
shell: bash -l {0}
run: touch helloworld-runner2.txt
- name: list the files
shell: bash -l {0}
run: ls -al
- name: echo
shell: bash -l {0}
run: echo "hello world"
run-on-runner3:
needs: get-runners-up-and-running
runs-on: [self-hosted,linux,x64,runner3]
steps:
- name: list the files
shell: bash -l {0}
run: ls -al
- name: create a file
shell: bash -l {0}
run: touch helloworld-runner3.txt
- name: list the files
shell: bash -l {0}
run: ls -al
- name: echo
shell: bash -l {0}
run: echo "hello world"
delete-all-vms-and-keys:
needs: [run-on-runner1, run-on-runner2, run-on-runner3]
runs-on: ubuntu-latest
env:
OS_TENANT_ID: ${{ secrets.OS_TENANT_ID }}
OS_TENANT_NAME: ${{ secrets.OS_TENANT_NAME }}
OS_USERNAME: ${{ secrets.OS_USERNAME }}
OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
OS_REGION_NAME: "DE1"
TF_VAR_ANSIBLE_USER: "ubuntu"
GITHUB_OWNER: ${{ github.actor }}
steps:
- uses: actions/checkout@v2
- name: install mamba
uses: mamba-org/provision-with-micromamba@main
- name: download rsa
uses: actions/download-artifact@v3
with:
name: idrsa
- name: download rsa pub
uses: actions/download-artifact@v3
with:
name: idrsa_pub
- name: terraform init
shell: bash -l {0}
run: |
cd tf/openstack/
terraform init
- name: download the tfstate file
uses: actions/download-artifact@v3
with:
name: tfstate
path: tf/openstack/
- name: connect to open stack
shell: bash -l {0}
run: |
source ./openrc.sh ${{ env.OS_TENANT_ID }} ${{ env.OS_TENANT_NAME }} ${{ env.OS_USERNAME }} ${{ env.OS_PASSWORD }} ${{ env.OS_REGION_NAME }}
bash ./set_env.sh ${{ env.OS_TENANT_ID }} ${{ env.OS_TENANT_NAME }} ${{ env.OS_USERNAME }} ${{ env.OS_PASSWORD }} ${{ env.GITHUB_OWNER }}
source ./prep_tf.sh ${{ env.GITHUB_OWNER }}
bash ./destroyVMs.sh