Update Ansible inventory to split node roles

Splits servers and clients to their own groups so that plays can target
specific roles.

Prior, everything was "both", but i want to and another server for
recovery purposes but not host containers on it.
This commit is contained in:
IamTheFij 2024-04-27 20:10:23 -07:00 committed by Ian Fijolek
parent c711c25737
commit 57efee14e9
4 changed files with 75 additions and 64 deletions

View File

@ -1,12 +1,8 @@
---
all:
children:
servers:
vars:
nomad_network_interface: eth0
hosts:
n1.thefij:
nomad_node_role: both
nomad_node_class: ingress
nomad_reserved_memory: 1024
# nomad_meta:
# hw_transcode.device: /dev/dri
@ -29,7 +25,6 @@ all:
mode: "0755"
read_only: false
n2.thefij:
nomad_node_role: both
nomad_node_class: ingress
nomad_reserved_memory: 1024
nfs_mounts:
@ -44,7 +39,6 @@ all:
mode: "0755"
read_only: false
pi4:
nomad_node_role: both
nomad_node_class: ingress
nomad_reserved_memory: 512
nomad_meta:
@ -52,11 +46,27 @@ all:
hw_transcode.type: raspberry
qnomad.thefij:
ansible_host: 192.168.2.234
nomad_node_role: both
nomad_reserved_memory: 1024
# This VM uses a non-standard interface
nomad_network_interface: ens3
nomad_instances:
nomad_instances:
vars:
nomad_network_interface: eth0
children:
servers: {}
nomad_servers: {}
nomad_clients: {}
nomad_servers:
hosts:
nonopi.thefij:
ansible_host: 192.168.2.170
n1.thefij: {}
n2.thefij: {}
pi4: {}
qnomad.thefij: {}
nomad_clients:
hosts:
n1.thefij: {}
n2.thefij: {}
pi4: {}
qnomad.thefij: {}

View File

@ -14,7 +14,7 @@
state: restarted
become: true
- name: Start Dockee
- name: Start Docker
systemd:
name: docker
state: started

View File

@ -1,6 +1,6 @@
---
- name: Recover Nomad
hosts: nomad_instances
hosts: nomad_servers
any_errors_fatal: true
tasks:

View File

@ -14,7 +14,7 @@
line: "nameserver {{ non_nomad_dns }}"
- name: Install Docker
hosts: nomad_instances
hosts: nomad_clients
become: true
vars:
docker_architecture_map:
@ -44,7 +44,7 @@
# state: present
- name: Create NFS mounts
hosts: nomad_instances
hosts: nomad_clients
become: true
vars:
shared_nfs_mounts:
@ -140,6 +140,7 @@
nomad_version: "1.7.6-1"
nomad_install_upgrade: true
nomad_allow_purge_config: true
nomad_node_role: "{% if 'nomad_clients' in group_names %}{% if 'nomad_servers' in group_names %}both{% else %}client{% endif %}{% else %}server{% endif %}"
# Where nomad gets installed to
nomad_bin_dir: /usr/bin
@ -213,7 +214,7 @@
enabled: true
- name: Bootstrap Nomad ACLs and scheduler
hosts: nomad_instances
hosts: nomad_servers
tasks:
- name: Start Nomad