-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (39 loc) · 1.16 KB
/
run-playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Playbook
on:
workflow_dispatch:
inputs:
cluster:
description: Cluster
required: true
playbook:
description: Playbook Name (with _, no extension)
required: true
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Connect to Tailscale
uses: tailscale/github-action@v1
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
- name: Read inventory file
id: inventory
run: |
CONTENT="$(cat ./inventory/${{ github.event.inputs.cluster }}/hosts.yaml)"
echo "INVENTORY<<EOF" >> $GITHUB_ENV
echo "$CONTENT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Run Playbook
uses: dawidd6/action-ansible-playbook@v2
with:
# Required, playbook filepath
playbook: "./playbooks/${{github.event.inputs.playbook}}.yml"
# Optional, directory where playbooks live
directory: ./
# Optional, SSH private key
key: ${{secrets.SSH_PRIVATE_KEY}}
# Optional, literal inventory file contents
inventory: |
echo ${{ env.INVENTORY }}