From 3a72a6d468b8f6e4675752cda02307d327026584 Mon Sep 17 00:00:00 2001 From: Khue Doan Date: Tue, 4 Jan 2022 22:21:24 +0700 Subject: [PATCH] refactor(metal): put hardware info in inventory too Because we may have a mix of different hardware types --- docs/src/deployment/configuration.md | 19 ++++--------------- metal/group_vars/all.yml | 3 --- metal/inventories/prod.yml | 8 ++++---- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/docs/src/deployment/configuration.md b/docs/src/deployment/configuration.md index 681e0485..f36a37a1 100644 --- a/docs/src/deployment/configuration.md +++ b/docs/src/deployment/configuration.md @@ -7,15 +7,14 @@ Because this repository applies GitOps practices, this git repository is the sou After forking it, clone and replace the reference to my repository with yours (without `https://`): ```sh -./scripts/replace-gitops-repo "gitservicelikegithub.com/yourname/homelab" +./scripts/replace-gitops-repo "github.com/yourname/homelab" ``` Then commit and push the changes. -## Server list +## Server list and hardware info -Edit the following file and replace the MAC addresses with the one on your servers. -The IP addresses are the desired ones, since your servers have no operating system installed yet. +Edit the following file and replace the hardware information with the one on your servers: > Use `dev.yml` instead of `prod.yml` if you're trying out the dev VM @@ -24,17 +23,7 @@ The IP addresses are the desired ones, since your servers have no operating syst {{#include ../../../metal/inventories/prod.yml:3:}} ``` -## Server hardware info - -> Skip this step if you're trying out the dev VM - -Change the following parameters based on your hardware. - -```yaml -# metal/group_vars/all.yaml -{{#include ../../../metal/group_vars/all.yml:6:}} -``` - +- The IP addresses are the desired ones, not the current one, since your servers have no operating system installed yet. - Disk: based on `/dev/$DISK`, in my case it's `sda`, but yours can be `sdb`, `nvme0n1`... - Network interface: usually it's `eth0`, mine is `eno1` diff --git a/metal/group_vars/all.yml b/metal/group_vars/all.yml index dddd09b2..8828020b 100644 --- a/metal/group_vars/all.yml +++ b/metal/group_vars/all.yml @@ -2,6 +2,3 @@ ansible_user: root ansible_ssh_private_key_file: ~/.ssh/id_ed25519 ssh_public_key: "{{lookup('file', '~/.ssh/id_ed25519.pub') }}" dns_server: "8.8.8.8" - -disk: "sda" -network_interface: "eno1" diff --git a/metal/inventories/prod.yml b/metal/inventories/prod.yml index 3a37c7b7..7f6474ab 100644 --- a/metal/inventories/prod.yml +++ b/metal/inventories/prod.yml @@ -2,9 +2,9 @@ metal: children: masters: hosts: - metal0: {ansible_host: 192.168.1.110, mac: '00:23:24:d1:f3:f0'} - metal1: {ansible_host: 192.168.1.111, mac: '00:23:24:d1:f4:d6'} - metal2: {ansible_host: 192.168.1.112, mac: '00:23:24:e7:04:60'} + metal0: {ansible_host: 192.168.1.110, mac: '00:23:24:d1:f3:f0', disk: sda, network_interface: eno1} + metal1: {ansible_host: 192.168.1.111, mac: '00:23:24:d1:f4:d6', disk: sda, network_interface: eno1} + metal2: {ansible_host: 192.168.1.112, mac: '00:23:24:e7:04:60', disk: sda, network_interface: eno1} workers: hosts: - metal3: {ansible_host: 192.168.1.113, mac: '00:23:24:d1:f5:69'} + metal3: {ansible_host: 192.168.1.113, mac: '00:23:24:d1:f5:69', disk: sda, network_interface: eno1}