Skip to content

Commit

Permalink
Merge pull request #3 from LegitCamper/overhaul
Browse files Browse the repository at this point in the history
Overhaul
  • Loading branch information
LegitCamper authored Oct 20, 2024
2 parents 39b7bb8 + 80da7af commit b96bb53
Show file tree
Hide file tree
Showing 29 changed files with 1,155 additions and 680 deletions.
85 changes: 40 additions & 45 deletions .github/workflows/update-homelab.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,57 @@
name: Update Homelab Files
name: Update Homelab Servers

on:
push:
branches:
- main
- overhaul
workflow_dispatch:

env:
DOCKER_FILES: -f ai.yml -f monitor.yml -f network.yml -f media.yml -f utilities.yml
DOCKER_ENV: --env-file ./secrets/homelab.env
DOCKER_FLAGS: -d --remove-orphans

jobs:
deploy:
runs-on: "self-hosted"

steps:
- uses: actions/checkout@v4

- uses: actions/checkout@v4
with:
repository: LegitCamper/homelab-secrets
path: "secrets"
sparse-checkout: |
homelab.env
sparse-checkout-cone-mode: false
token: ${{ secrets.ACCESS_TOKEN }}

- name: replace domain in configs
run: |
# add any other files that need domain substituion here - for flexablity
sed -i -e 's/$DOMAIN/${{ vars.DOMAIN }}/g' ./dashy/conf.yml
- name: install ansible
run: sudo apt-get install -y ansible

- name: install docker compose for tests
uses: KengoTODA/actions-setup-docker-compose@v1
- name: Run gateway playbook
uses: dawidd6/action-ansible-playbook@v2
with:
version: "2.14.2"

- name: docker compose dry run
run: |
docker compose --dry-run ${{ env.DOCKER_ENV }} ${{ env.DOCKER_FILES }} up ${{ env.DOCKER_FLAGS }}
exit $?
- name: Copy folder content recursively to remote
uses: garygrossgarten/[email protected]
with:
local: ${{ github.workspace }}
remote: /home/${{ secrets.SSH_USER }}/stacks/homelab/
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.PASSWORD }}

- name: multiple command
uses: appleboy/ssh-action@v1.0.3
playbook: gateway.yml
directory: ./
vault_password: ${{secrets.VAULT_PASSWORD}}
requirements: requirements.yml
inventory: |
[all]
gateway
configuration: |
[defaults]
host_key_checking = False
[ssh_connections]
pipelining = true
options: |
--inventory .hosts
--verbose
- name: Run homeserver playbook
uses: dawidd6/action-ansible-playbook@v2
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.PASSWORD }}
script: |
cd ~/stacks/homelab/
docker compose ${{ env.DOCKER_ENV }} ${{ env.DOCKER_FILES }} up ${{ env.DOCKER_FLAGS }}
playbook: homeserver.yml
directory: ./
vault_password: ${{secrets.VAULT_PASSWORD}}
requirements: requirements.yml
inventory: |
[all]
homeserver
configuration: |
[defaults]
host_key_checking = False
ask_sudo_pass = True
[ssh_connections]
pipelining = true
options: |
--inventory .hosts
--verbose
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
secrets

153 changes: 0 additions & 153 deletions ai.yml

This file was deleted.

5 changes: 5 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[defaults]
ask_vault_pass=True

[ssh_connections]
pipelining = true
Loading

0 comments on commit b96bb53

Please sign in to comment.