Clean up roles and add makefile

This commit is contained in:
Oliver Traber 2022-05-15 14:25:38 +02:00
parent d75f487712
commit f8ffbe3452
Signed by: Bluemedia
GPG key ID: C0674B105057136C
7 changed files with 38 additions and 14 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.vscode

View file

@ -1,7 +1,6 @@
# Homelab automation
This project contains the ansible and docker based automation of my homelab. The structure is inspired by [Khue Doan's Homelab Project](https://github.com/khuedoan/homelab).
The repo is currently work in progress. Nothing is tested yet, so everything could burst into flames at any time :)
This project contains the ansible and docker based automation of my homelab. The structure is inspired by [Khue Doan's Homelab Project](https://github.com/khuedoan/homelab).
## Hardware
@ -9,7 +8,7 @@ The repo is currently work in progress. Nothing is tested yet, so everything cou
- CPU: `Intel Core i5-7500T @ 2.70 GHz`
- RAM: `16 GB`
- NVMe SSD: `256 GB`
- SATA SSD: `128 GB`
- SATA SSD: `225 GB`
- 1 × Raspberry Pi 4 (4 GB)
## Current features

18
metal/Makefile Normal file
View file

@ -0,0 +1,18 @@
.POSIX:
default: os-install
os-install:
ansible-playbook \
--inventory inventories/lab.yml \
--ask-vault-pass \
install-os.yml
cluster:
ansible-playbook \
--inventory inventories/lab.yml \
cluster.yml
console:
ansible-console \
--inventory inventories/lab.yml

View file

@ -9,8 +9,8 @@
roles:
- wol-wake
- name: Tear down PXE stack
- name: Clean up playbook execution
hosts: localhost
gather_facts: false
roles:
- pxe-teardown
- pxe-cleanup

View file

@ -2,9 +2,9 @@ metal:
children:
masters:
hosts:
lab-mini-1: {ansible_host: 192.168.6.21, mac: '4c:52:62:1c:bf:6c', disk: '/dev/nvme0n1'}
lab-mini-2: {ansible_host: 192.168.6.22, mac: '4c:52:62:0f:09:6d', disk: '/dev/nvme0n1'}
lab-mini-3: {ansible_host: 192.168.6.23, mac: '4c:52:62:0f:0a:23', disk: '/dev/nvme0n1'}
lab-mini-1: {ansible_host: 192.168.6.21, mac: '4c:52:62:1c:bf:6c', disk: '/dev/sda'}
lab-mini-2: {ansible_host: 192.168.6.22, mac: '4c:52:62:0f:09:6d', disk: '/dev/sda'}
lab-mini-3: {ansible_host: 192.168.6.23, mac: '4c:52:62:0f:0a:23', disk: '/dev/sda'}
workers:
hosts:
lab-mini-4: {ansible_host: 192.168.6.24, mac: '90:1b:0e:f8:e8:af', disk: '/dev/nvme0n1'}
lab-mini-4: {ansible_host: 192.168.6.24, mac: '90:1b:0e:f8:e8:af', disk: '/dev/sda'}

View file

@ -0,0 +1,11 @@
- name: Tear down PXE stack
docker_compose:
project_name: "pxe"
project_src: "{{ playbook_dir }}/roles/pxe-server/files/"
state: absent
- name: Remove preseed files
file:
path: "{{ playbook_dir }}/roles/pxe-server/files/data/preseed/{{ hostvars[item]['mac'] }}.cfg"
state: "absent"
loop: "{{ groups['metal'] }}"

View file

@ -1,5 +0,0 @@
- name: Tear down PXE stack
docker_compose:
project_name: "pxe"
project_src: "{{ playbook_dir }}/roles/pxe-server/files/"
state: absent