Skip to content

Run Ansible execution environment #1

Run Ansible execution environment

Run Ansible execution environment #1

Workflow file for this run

name: Run Ansible execution environment
on:
workflow_dispatch
permissions:
id-token: write
contents: read
env:
CONTAINER_REGISTRY_URL: ghcr.io
EE_BASELINE_IMAGE_NAME: ee-baseline
EE_AZURE_IMAGE_NAME: ee-azure
MACHINE_ROLE: testvm
jobs:
ee-run:
runs-on: ubuntu-latest
environment: test
steps:
- name: Log into Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${CONTAINER_REGISTRY_URL} -u $ --password-stdin
- name: 'Run Azure CLI commands'
run: |
az account show
az group list
pwd
- name: Construct & check the inventory
run: |
mkdir -p ${MACHINE_ROLE}/inventory/
cat > ${MACHINE_ROLE}/inventory/azure_rm.yml <<EOF
plugin: azure.azcollection.azure_rm
auth_source: auto
EOF
- name: Construct & check the playbook
run: |
mkdir -p ${MACHINE_ROLE}/project/
cat > ${MACHINE_ROLE}/project/playbook.yml <<EOF
- name: Testing Ansible SSH connectivity
hosts: all
tasks:
- name: Ping the thing!
ping:
EOF
- name: Test run the Azure execution environment image
run: |
docker run --rm -u root -v ${PWD}/${MACHINE_ROLE}:/runner -v /home/runner/.azure/:/root/.azure/ -e RUNNER_PLAYBOOK=playbook.yml -e ANSIBLE_INVENTORY=/runner/inventory ${CONTAINER_REGISTRY_URL}/ansible/${EE_AZURE_IMAGE_NAME} ansible-inventory --graph
# docker run --rm -u root -v ${PWD}/${MACHINE_ROLE}:/runner -v /home/runner/.azure/:/root/.azure/ -e RUNNER_PLAYBOOK=playbook.yml -e ANSIBLE_INVENTORY=/runner/inventory ${CONTAINER_REGISTRY_URL}/ansible/${EE_AZURE_IMAGE_NAME} ansible-runner run /runner