diff --git a/.gitea/workflows/ansible-runner.yaml b/.gitea/workflows/ansible-runner.yaml index 8575d0e..710d65c 100644 --- a/.gitea/workflows/ansible-runner.yaml +++ b/.gitea/workflows/ansible-runner.yaml @@ -1,11 +1,14 @@ name: 🏃Run Ansible on: - push: - branches: ["main"] - pull_request: - branches: ["main"] - workflow_dispatch: + workflow_call: + inputs: + playbook_path: + required: true + type: string + role_repo: + required: true + type: string jobs: install_ansible: @@ -30,8 +33,9 @@ jobs: - name: 🔎Checkout Repository uses: actions/checkout@v4 - submodules: recursive - fetch-depth: 0 + with: + submodules: recursive + fetch-depth: 0 # Python 3 installieren, was für pip und Ansible notwendig ist - name: ⚙️Setup Python @@ -62,13 +66,19 @@ jobs: run: | ansible-galaxy list + - name: 🔎 Checkout Triggering Role Repo + uses: actions/checkout@v4 + with: + repository: ${{ inputs.role_repo }} + path: active_role + - name: 🔎Check Ansible Playbook Syntax run: | - ansible-playbook --syntax-check playbooks/deploy_valkey.yml.ansible + ansible-playbook --syntax-check active_role/${{ inputs.playbook_path }} - name: 🏃Run Ansible deploy_valkey.yml.ansible run: | - ansible-playbook -i inventory/raspberries.yaml playbooks/deploy_valkey.yml.ansible --vault-password-file .vault_pass.txt -v + ansible-playbook -i inventory/raspberries.yaml active_role/${{ inputs.playbook_path }} --vault-password-file .vault_pass.txt -v # Beispiel für den Benachrichtigungsschritt - name: 📨Telegram Benachrichtigung senden uses: chapvic/telegram-notify@master @@ -77,4 +87,4 @@ jobs: token: ${{ secrets.TELEGRAM_BOT_TOKEN }} # Ihr Bot-Token Secret chat: ${{ secrets.TELEGRAM_CHAT_ID }} # Ihre Chat-ID Secret status: ${{ job.status }} # Sendet den Job-Status (success/failure/cancelled) - title: "Workflow abgeschlossen" + title: "Deploy: ${{ inputs.role_repo }}"