ansible/.github/workflows/deploy.yml

38 lines
1 KiB
YAML
Raw Normal View History

2024-10-11 11:48:37 +02:00
on:
workflow_dispatch:
push:
branches:
- master
2024-10-20 22:26:57 +02:00
concurrency:
group: deploy
2024-10-11 11:48:37 +02:00
jobs:
ansible:
name: run ansible
runs-on: ubuntu-latest
steps:
2024-10-11 11:55:26 +02:00
- name: Checkout
uses: actions/checkout@v4
2024-10-11 11:48:37 +02:00
- name: Setup Python
uses: actions/setup-python@v5.2.0
with:
python-version: 3
cache: pip
check-latest: true
- name: Run ansible
2024-10-11 11:58:43 +02:00
env:
2024-10-11 12:05:19 +02:00
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
DEPLOY_USERNAME: ${{ secrets.DEPLOY_USERNAME }}
2024-10-11 11:58:43 +02:00
ANSIBLE_INVENTORY: inventories/github.yaml
ANSIBLE_VAULT_PASSWORD_FILE: vault.pass
2024-10-11 12:11:37 +02:00
ANSIBLE_FORCE_COLOR: "true"
2024-10-11 18:41:46 +02:00
ANSIBLE_ROLES_PATH: "./roles"
2024-10-11 11:48:37 +02:00
run: |
2024-10-11 12:14:58 +02:00
echo '${{ secrets.ANSIBLE_VAULT_PASSWORD }}' > $ANSIBLE_VAULT_PASSWORD_FILE
2024-10-11 12:11:37 +02:00
ls $ANSIBLE_VAULT_PASSWORD_FILE
2024-10-11 11:48:37 +02:00
export KEY_FILE=$(mktemp)
echo "${{ secrets.DEPLOY_KEY }}" > $KEY_FILE
2024-10-11 12:17:54 +02:00
ansible-playbook playbooks/all.yaml