Running Ansible using GitHub Actions
Ansible doesn’t have a concept of state files, so this will simplify our GitHub action workflow. As we are using Microsoft Azure again, you must set up the ARM_CLIENT_ID
, ARM_CLIENT_SECRET
, ARM_SUBSCRIPTION_ID
, and ARM_TENANT_ID
secrets in your GitHub repository as we did in the last section before progressing.
Once they are there, we can move on to the workflow itself; as with the Terraform workflow, we start by setting some basic configurations:
name: "Ansible Playbook Run" on: push: branches: - main pull_request: branches: - main
Then we define the job; that’s right, there is only one job for this workflow:
jobs: run_ansible_playbook: name: "Run Ansible Playbook" runs-on: ubuntu-latest ...