Create a Deploy Ansible Workflow
Create an Ansible workflow that deploys the site.yml playbook, which, in turn, configures your environment.
Using the Docker container action, you will build a workflow. This workflow will be responsible for deploying the site.yml
playbook, which, in turn, configures your environment.
We have created the workflow file using the command below:
touch .github/workflows/deploy_ansible.yml
Components
Let’s look at the components of the deploy_ansible workflow file one by one.
Triggers
You will give the workflow a name and define the triggers for the following actions:
- Push
- Pull request
name: deploy ansibleon:push:branches:- masterpull_request:branches:- master
Job
Use the checkout and Ansible Docker container actions within a job called deploy
.
jobs:deploy:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v1- uses: ./.github/actions/ansible
The highlighted line-6 calls action from within the repository instead of an external source. Review the complete deploy_ansible.yml
file below:
name: deploy ansible on: push: branches: - master pull_request: branches: - master jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: ./.github/actions/ansible
Click the Run
button and wait for the environment to set up. Once set up, save, add, commit, and push the new ...