mirror of
https://github.com/khuedoan/homelab.git
synced 2025-07-04 15:27:52 +07:00
Restructure PXE boot for separation of concerns
This commit is contained in:
@ -42,7 +42,7 @@ Visit the README file for each layer to learn more.
|
|||||||
|
|
||||||
### Prerequisite
|
### Prerequisite
|
||||||
|
|
||||||
For the controller (to run Ansible, stateless PXE server, Terraform...):
|
For the controller (your laptop or desktop):
|
||||||
|
|
||||||
- SSH keys in `~/.ssh/{id_ed25519,id_ed25519.pub}` (you can generate it with `ssh-keygen -t ed25519`)
|
- SSH keys in `~/.ssh/{id_ed25519,id_ed25519.pub}` (you can generate it with `ssh-keygen -t ed25519`)
|
||||||
- Docker with `host` networking driver (which means [only Docker on Linux hosts](https://docs.docker.com/network/host/), you can use a Linux virtual machine with bridged networking if you're on macOS or Windows)
|
- Docker with `host` networking driver (which means [only Docker on Linux hosts](https://docs.docker.com/network/host/), you can use a Linux virtual machine with bridged networking if you're on macOS or Windows)
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
controller:
|
|
||||||
hosts:
|
|
||||||
localhost: {ansible_connection: local}
|
|
||||||
|
|
||||||
metal:
|
metal:
|
||||||
hosts:
|
hosts:
|
||||||
metal0: {ansible_host: 192.168.1.110, mac: '00:23:24:d1:f3:f0'}
|
metal0: {ansible_host: 192.168.1.110, mac: '00:23:24:d1:f3:f0'}
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
- name: Install OS on bare metal machines
|
- name: Start PXE server
|
||||||
hosts: all
|
hosts: localhost
|
||||||
|
roles:
|
||||||
|
- pxe-server
|
||||||
|
|
||||||
|
- name: Provision bare metal machines
|
||||||
|
hosts: metal
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
roles:
|
roles:
|
||||||
- pxe-boot
|
- wake
|
||||||
|
|
||||||
- name: Create Terraform state storage
|
- name: Create Terraform state storage
|
||||||
hosts: metal[0]
|
hosts: metal[0]
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
- name: Stop ephemeral PXE server
|
|
||||||
docker_compose:
|
|
||||||
project_src: "{{ role_path }}/build"
|
|
||||||
state: absent
|
|
@ -1,12 +0,0 @@
|
|||||||
- name: Render configs and start PXE server
|
|
||||||
include_tasks:
|
|
||||||
file: server.yml
|
|
||||||
run_once: yes
|
|
||||||
when:
|
|
||||||
- "'controller' in group_names"
|
|
||||||
|
|
||||||
- name: Wakes the nodes up and install OS on them
|
|
||||||
include_tasks:
|
|
||||||
file: wake.yml
|
|
||||||
when:
|
|
||||||
- "'metal' in group_names"
|
|
@ -17,7 +17,6 @@
|
|||||||
url: "{{ iso_url }}"
|
url: "{{ iso_url }}"
|
||||||
dest: "{{ role_path }}/files/images/{{ iso_file_name }}"
|
dest: "{{ role_path }}/files/images/{{ iso_file_name }}"
|
||||||
checksum: "{{ iso_checksum }}"
|
checksum: "{{ iso_checksum }}"
|
||||||
delegate_to: localhost
|
|
||||||
register: iso
|
register: iso
|
||||||
|
|
||||||
- name: Extract the ISO
|
- name: Extract the ISO
|
||||||
@ -76,5 +75,3 @@
|
|||||||
restarted: yes
|
restarted: yes
|
||||||
build: yes
|
build: yes
|
||||||
recreate: always
|
recreate: always
|
||||||
notify:
|
|
||||||
- Stop ephemeral PXE server
|
|
@ -37,9 +37,11 @@ storage:
|
|||||||
|
|
||||||
systemd:
|
systemd:
|
||||||
units:
|
units:
|
||||||
|
# iSCSI for Longhorn distributed block storage
|
||||||
- name: iscsid.service
|
- name: iscsid.service
|
||||||
enabled: true
|
enabled: true
|
||||||
{% if item == "metal0" %}
|
{% if item == "metal0" %}
|
||||||
|
# Terraform state backend
|
||||||
- name: tfstate.service
|
- name: tfstate.service
|
||||||
enabled: true
|
enabled: true
|
||||||
contents: |
|
contents: |
|
@ -8,4 +8,4 @@
|
|||||||
host: '{{ ansible_host }}'
|
host: '{{ ansible_host }}'
|
||||||
port: 22
|
port: 22
|
||||||
search_regex: OpenSSH
|
search_regex: OpenSSH
|
||||||
connection: local
|
delegate_to: localhost
|
Reference in New Issue
Block a user