mirror of
https://github.com/khuedoan/homelab.git
synced 2025-02-02 04:14:28 +07:00
Restructure PXE boot for separation of concerns
This commit is contained in:
parent
c04f524d34
commit
e89847e83c
@ -42,7 +42,7 @@ Visit the README file for each layer to learn more.
|
||||
|
||||
### 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`)
|
||||
- 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:
|
||||
hosts:
|
||||
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
|
||||
hosts: all
|
||||
- name: Start PXE server
|
||||
hosts: localhost
|
||||
roles:
|
||||
- pxe-server
|
||||
|
||||
- name: Provision bare metal machines
|
||||
hosts: metal
|
||||
gather_facts: no
|
||||
roles:
|
||||
- pxe-boot
|
||||
- wake
|
||||
|
||||
- name: Create Terraform state storage
|
||||
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 }}"
|
||||
dest: "{{ role_path }}/files/images/{{ iso_file_name }}"
|
||||
checksum: "{{ iso_checksum }}"
|
||||
delegate_to: localhost
|
||||
register: iso
|
||||
|
||||
- name: Extract the ISO
|
||||
@ -76,5 +75,3 @@
|
||||
restarted: yes
|
||||
build: yes
|
||||
recreate: always
|
||||
notify:
|
||||
- Stop ephemeral PXE server
|
@ -37,9 +37,11 @@ storage:
|
||||
|
||||
systemd:
|
||||
units:
|
||||
# iSCSI for Longhorn distributed block storage
|
||||
- name: iscsid.service
|
||||
enabled: true
|
||||
{% if item == "metal0" %}
|
||||
# Terraform state backend
|
||||
- name: tfstate.service
|
||||
enabled: true
|
||||
contents: |
|
@ -8,4 +8,4 @@
|
||||
host: '{{ ansible_host }}'
|
||||
port: 22
|
||||
search_regex: OpenSSH
|
||||
connection: local
|
||||
delegate_to: localhost
|
Loading…
Reference in New Issue
Block a user