aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/run.yml
blob: a4e6fe4f2e6cf6b0a4ba022c3f6aa3ba13438a78 (plain) (blame)
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
name: Run

on:
  workflow_dispatch:
    inputs:
      hosts:
        description: Inventory pattern
        required: false
        default: all

jobs:
  run:
    name: Run
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Set up WireGuard
        uses: egor-tensin/setup-wireguard@v1
        with:
          endpoint: '${{ secrets.ENDPOINT }}'
          endpoint_public_key: '${{ secrets.ENDPOINT_PUBLIC_KEY }}'
          ips: '${{ secrets.IPS }}'
          allowed_ips: '${{ secrets.ALLOWED_IPS }}'
          private_key: '${{ secrets.WG_PRIVATE_KEY }}'
          preshared_key: '${{ secrets.WG_PRESHARED_KEY }}'
      - name: Set SSH key
        run: |
          touch .ansible-key
          chmod 0600 .ansible-key
          cat <<'EOF' > .ansible-key
          ${{ secrets.SSH_KEY }}
          EOF
      - name: Run Ansible play
        run: ansible-playbook --inventory inventory.ini --limit '${{ github.event.inputs.hosts }}' --private-key .ansible-key maintenance.yml