refactor(metal): put hardware info in inventory too

Because we may have a mix of different hardware types
This commit is contained in:
Khue Doan 2022-01-04 22:21:24 +07:00
parent 8f70137b1d
commit 3a72a6d468
3 changed files with 8 additions and 22 deletions

View File

@ -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`

View File

@ -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"

View File

@ -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}