Reusable Workflows (Ansible)
Lint & Deploy Role
Lint and optionally deploy a role to a remote server.
Inputs
Inputs
Name |
Type |
Required |
Default |
Description |
playbook_repository |
boolean |
Yes |
|
The repository that contains the playbook |
deploy |
boolean |
No |
true |
Deploy the playbook |
cache_dependencies |
boolean |
No |
true |
Cache the dependencies from the requirement file |
requirements_file |
string |
No |
/workspace/${{ gitea.repository }}/meta/requirements.yml |
The path to the requirements file |
config_file |
string |
No |
/workspace/${{ gitea.repository }}/ansible.cfg |
The path to the ansible config file |
Secrets
Name |
Required |
Description |
FORGEJO_TOKEN |
Only when deploy is true |
A personal access token that allows this workflow to pull the playbook repository |
ANSIBLE_VAULT_PASSWORD |
Only when deploy is true |
The vault token/password for ansible vault |
ANSIBLE_SSH_PRIVATE_KEY |
Only when deploy is true |
A SSH private key to deploy the playbook with the role |
Usage
---
name: Lint & Deploy
on:
pull_request:
push:
paths-ignore:
- "**/*.md"
- "**/*.txt"
- "renovate.json5"
- "meta/main.yml"
workflow_dispatch:
jobs:
lint_and_deploy_role:
uses: ansible/reusable-workflows/.forgejo/workflows/lint_and_deploy_role.yml@main
with:
playbook_repository: ${{ vars.ANSIBLE_PLAYBOOK_REPOSITORY }} # "https://git.michaelsasser.org/ansible/roles/role.git"
# deploy: true
secrets:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
ANSIBLE_SSH_PRIVATE_KEY: ${{ secrets.ANSIBLE_SSH_PRIVATE_KEY }}