Add GitHub Actions Workflow for maintaining & deploying production hosts

The workflow runs on a schedule and can also be triggered manually.
This commit is contained in:
Julian Schacher
2024-02-07 20:49:43 +01:00
parent 076d53ab9c
commit 894785fb5c

View File

@@ -0,0 +1,24 @@
name: Maintain & Deploy Production Hosts
on:
schedule:
# Run Wednesday and Friday (the days on which I (Julian) usually work) at
# 04:00.
- cron: "0 4 * * 3,5"
workflow_dispatch:
jobs:
Run-Everything-Playbook:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Setup .ssh
run: |
mkdir -p $HOME/.ssh
chmod 700 $HOME/.ssh
echo "${{ secrets.ANSIBLE_INFRA_SSH_DEPLOY_KEY }}" > $HOME/.ssh/id_ed25519
chmod 400 $HOME/.ssh/id_ed25519
echo "${{ vars.ANSIBLE_INFRA_SSH_KNOWN_HOSTS }}" > $HOME/.ssh/known_hosts
- name: Install dependencies
run: ansible-galaxy install -r requirements.yml -f
- name: Run playbook
run: ansible-playbook -l Production_Hosts playbooks/everything.yaml