Server Maintenance #261
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Server Maintenance | |
on: | |
schedule: | |
- cron: "0 1 * * *" | |
push: | |
branches: | |
- 'main' | |
jobs: | |
server_maintenance: | |
runs-on: self-hosted | |
permissions: write-all | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Configure Environment Variables | |
id: config_inventory | |
run: | | |
sed -i "s/PASSWORD/${{ secrets.HOMELAB_PASSWORD }}/g" ./inventory.yml | |
sed -i "s/USER/${{ secrets.USER }}/g" ./inventory.yml | |
sed -i "s/R510/${{ secrets.R510 }}/g" ./inventory.yml | |
sed -i "s/R710/${{ secrets.R710 }}/g" ./inventory.yml | |
sed -i "s/R820/${{ secrets.R820 }}/g" ./inventory.yml | |
sed -i "s/RPI4/${{ secrets.RPI4 }}/g" ./inventory.yml | |
sed -i "s#directory=/home/ansible/Development#directory=${{ secrets.DIRECTORY }}#g" ./Dockerfile | |
- name: Build Image | |
id: build_image | |
run: docker build -t server_automation:latest . | |
- name: Run Playbook | |
id: run_playbook | |
run: docker run -i server_automation:latest |