diff --git a/README.md b/README.md index 404dff31..eaa401b9 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,15 @@ - SSD: 128GB - Switch TP-Link TL-SG108 +## Design + +| Layer | Name | Description | Provisioner | +|-------|----------|---------------------------------------------|---------------------| +| 0 | metal | bare metal PXE boot, etcd, docker, lxd, | Ansible, PXE server | +| 1 | infra | Cloud-like infrastructure, based on KVM/LXC | Terraform | +| 2 | platform | kubernetes, vault, git, ci/cd... | Helm | +| 3 | apps | Plex, PeerTube, Nextcloud... | ArgoCD | + ## Features ### Infrastructure @@ -29,7 +38,3 @@ ![Pastebin](https://img.shields.io/static/v1?logo=Pastebin&logoColor=white&label=&message=Pastebin&color=02456C) ![PeerTube](https://img.shields.io/static/v1?logo=PeerTube&logoColor=white&label=&message=PeerTube&color=F1680D) ![Plex](https://img.shields.io/static/v1?logo=Plex&logoColor=white&label=&message=Plex&color=E5A00D) - -## Notes - -- Node hostname must be different and has proper domain (for example `node0.homelab.local`) diff --git a/metal/playbook.yml b/metal/playbook.yml index 0f1ec199..4f362173 100644 --- a/metal/playbook.yml +++ b/metal/playbook.yml @@ -3,13 +3,14 @@ roles: - { role: pxe-server, tag: pxe-server } +- name: Shutdown all nodes + hosts: homelab + roles: + - { role: shutdown, tag: shutdown } + ignore_unreachable: yes + - name: Wake all nodes up hosts: homelab gather_facts: no roles: - { role: wake, tag: wake } - -# - name: Shutdown all nodes -# hosts: homelab -# roles: -# - { role: shutdown, tag: shutdown } diff --git a/metal/roles/pxe-server/files b/metal/roles/pxe-server/files index 028f617e..ba467bcc 160000 --- a/metal/roles/pxe-server/files +++ b/metal/roles/pxe-server/files @@ -1 +1 @@ -Subproject commit 028f617e4dc9018182ec8d8c9fa26dfffd56522a +Subproject commit ba467bcc4d74e37468b2a63c956ca5271f1acbbd diff --git a/metal/roles/pxe-server/tasks/main.yml b/metal/roles/pxe-server/tasks/main.yml index 5a97f58c..92da77bc 100644 --- a/metal/roles/pxe-server/tasks/main.yml +++ b/metal/roles/pxe-server/tasks/main.yml @@ -2,28 +2,7 @@ # community.general.docker_compose: # project_src: "{{ role_path }}/files/pxe-servers" -- name: Render DHCP config +- name: Render environment file template: - src: "dhcp/dhcpd.conf.j2" - dest: "{{ role_path }}/files/dhcp/dhcpd.conf" - -- name: Render GRUB config - template: - src: "tftp/tftpboot/grub.cfg.j2" - dest: "{{ role_path }}/files/tftp/tftpboot/grub.cfg" - -- name: Create directories - ansible.builtin.file: - path: "{{ role_path }}/build/{{ item.path }}" - state: directory - mode: '{{ item.mode }}' - with_community.general.filetree: "{{ role_path }}/templates" - when: item.state == 'directory' - -- name: Template files (explicitly skip directories in order to use the 'src' attribute) - ansible.builtin.template: - src: '{{ item.src }}' - dest: "{{ role_path }}/build/{{ item.path }}" - mode: '{{ item.mode }}' - with_community.general.filetree: "{{ role_path }}/templates" - when: item.state == 'file' + src: "{{ role_path }}/files/.env.j2" + dest: "{{ role_path }}/files/.env" diff --git a/metal/roles/shutdown/tasks/main.yml b/metal/roles/shutdown/tasks/main.yml index 2081effa..ab9021f4 100644 --- a/metal/roles/shutdown/tasks/main.yml +++ b/metal/roles/shutdown/tasks/main.yml @@ -1,3 +1,8 @@ - name: Unconditionally shut down the machine with all defaults community.general.shutdown: delay: 0 + +- name: Wait for the machine to shutdown + wait_for: + timeout: 30 + delegate_to: localhost