Attempt to pivot to a Netbox-based inventory solution

This commit is contained in:
Salt 2021-08-01 22:28:39 -05:00
parent 4489e87a7b
commit ccad04d544
7 changed files with 79 additions and 64 deletions

View File

@ -64,18 +64,18 @@ Test:
Play_Against_Pis:
stage: play
script:
- ansible-playbook -l pis site.yml --vault-password-file /vaultpw || error="$?"
- ansible-playbook -l tags_pis site.yml --vault-password-file /vaultpw || error="$?"
- if [ "$error" -eq 4 ]; then echo "Some hosts were unreachable; masking error"; unset error; fi
- if [ -n "$error" ]; then echo "Return code $error"; false; fi
Play_Against_Desktops:
stage: play
script:
- ansible-playbook -l desktop site.yml --vault-password-file /vaultpw || error="$?"
- ansible-playbook -l tags_desktop site.yml --vault-password-file /vaultpw || error="$?"
- if [ "$error" -eq 4 ]; then echo "Some hosts were unreachable; masking error"; unset error; fi
- if [ -n "$error" ]; then echo "Return code $error"; false; fi
Play_Against_Production:
stage: play
script:
- ansible-playbook -l prod site.yml --vault-password-file /vaultpw || error="$?"
- ansible-playbook -l tags_prod site.yml --vault-password-file /vaultpw || error="$?"
- if [ "$error" -eq 4 ]; then echo "Some hosts were unreachable; masking error"; unset error; fi
- if [ -n "$error" ]; then echo "Return code $error"; false; fi

View File

@ -1,55 +1,15 @@
# vim:ft=ansible:
all:
vars:
ansible_user: ansible
ansible_become: yes
children:
home:
children:
pis:
vars:
docker_apt_arch: arm64
children:
pistorage:
hosts:
pi-storage-1.desu.ltd:
pik8s:
children:
pik8s_masters:
vars:
kubernetes_role: master
hosts:
pi-kub-master-1.desu.ltd:
pik8s_nodes:
vars:
kubernetes_role: node
hosts:
pi-kub-node-1.desu.ltd:
keepalived_state: MASTER
keepalived_priority: 50
pi-kub-node-2.desu.ltd:
keepalived_priority: 49
pi-kub-node-3.desu.ltd:
keepalived_priority: 48
pi-kub-node-4.desu.ltd:
keepalived_priority: 47
pi-kub-node-5.desu.ltd:
keepalived_priority: 46
desktop:
hosts:
dsk-ryzen-0.desu.ltd:
lap-s76-lemp9-0.desu.ltd:
prod:
children:
db:
hosts:
psql1.desu.ltd:
web:
hosts:
web1.desu.ltd:
web2.desu.ltd:
web3.desu.ltd:
game:
hosts:
game1.desu.ltd:
game2.desu.ltd:
plugin: netbox.netbox.nb_inventory
token: !vault |
$ANSIBLE_VAULT;1.1;AES256
31656630386363323836663537383930346336393061363461653532323561386632343063353161
6630636535373331633762363738613232636366663430330a356333623466623230616433373036
35386162633961616438383332346165323930333662376665616531613837316333653361313332
3065343761343338340a336266316339616134336332376336326332663435323937343531636238
37323530333463383062396363616263386430356438306133393130626365333932323734383165
3064663435626339393836353837643730333266366436373033
api_endpoint: "https://netbox.desu.ltd"
group_by:
- device_roles
- tags
device_query_filters:
- has_primary_ip: "true"

55
inventory/hosts.yml.old Normal file
View File

@ -0,0 +1,55 @@
# vim:ft=ansible:
all:
vars:
ansible_user: ansible
ansible_become: yes
children:
home:
children:
pis:
vars:
docker_apt_arch: arm64
children:
pistorage:
hosts:
pi-storage-1.desu.ltd:
pik8s:
children:
pik8s_masters:
vars:
kubernetes_role: master
hosts:
pi-kub-master-1.desu.ltd:
pik8s_nodes:
vars:
kubernetes_role: node
hosts:
pi-kub-node-1.desu.ltd:
keepalived_state: MASTER
keepalived_priority: 50
pi-kub-node-2.desu.ltd:
keepalived_priority: 49
pi-kub-node-3.desu.ltd:
keepalived_priority: 48
pi-kub-node-4.desu.ltd:
keepalived_priority: 47
pi-kub-node-5.desu.ltd:
keepalived_priority: 46
desktop:
hosts:
dsk-ryzen-0.desu.ltd:
lap-s76-lemp9-0.desu.ltd:
prod:
children:
db:
hosts:
psql1.desu.ltd:
web:
hosts:
web1.desu.ltd:
web2.desu.ltd:
web3.desu.ltd:
game:
hosts:
game1.desu.ltd:
game2.desu.ltd:

View File

@ -2,7 +2,7 @@
# vim:ft=ansible:
---
# Home desktops
- hosts: desktop
- hosts: tags_desktop
tasks:
- name: assure pi-storage-1 nfs mountpoint
file: path=/nfs/pi-storage-1.desu.ltd state=directory owner=root mode=0755

View File

@ -2,7 +2,7 @@
# vim:ft=ansible:
# Game servers
---
- hosts: game
- hosts: tags_game
roles:
- role: backup
vars:

View File

@ -2,7 +2,7 @@
# vim:ft=ansible:
---
# k8s
- hosts: pik8s
- hosts: tag_pik8s
gather_facts: no
tasks:
- name: install nfs-common
@ -17,13 +17,13 @@
- docker
- kubelet
tags: [ k8s, motd ]
- hosts: pik8s_masters
- hosts: tag_pik8s-master
gather_facts: no
tasks:
- name: install openshift
pip: name=openshift state=latest
tags: [ k8s, packages, pip ]
- hosts: pik8s_nodes
- hosts: tag_pik8s-node
gather_facts: no
roles:
- role: keepalived

View File

@ -2,7 +2,7 @@
# vim:ft=ansible:
---
# General configuration
- hosts: pis
- hosts: tags_pis
roles:
- role: zerotier
tags: [ pis, zerotier ]