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: Play_Against_Pis:
stage: play stage: play
script: 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 [ "$error" -eq 4 ]; then echo "Some hosts were unreachable; masking error"; unset error; fi
- if [ -n "$error" ]; then echo "Return code $error"; false; fi - if [ -n "$error" ]; then echo "Return code $error"; false; fi
Play_Against_Desktops: Play_Against_Desktops:
stage: play stage: play
script: 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 [ "$error" -eq 4 ]; then echo "Some hosts were unreachable; masking error"; unset error; fi
- if [ -n "$error" ]; then echo "Return code $error"; false; fi - if [ -n "$error" ]; then echo "Return code $error"; false; fi
Play_Against_Production: Play_Against_Production:
stage: play stage: play
script: 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 [ "$error" -eq 4 ]; then echo "Some hosts were unreachable; masking error"; unset error; fi
- if [ -n "$error" ]; then echo "Return code $error"; false; fi - if [ -n "$error" ]; then echo "Return code $error"; false; fi

View File

@ -1,55 +1,15 @@
# vim:ft=ansible: plugin: netbox.netbox.nb_inventory
all: token: !vault |
vars: $ANSIBLE_VAULT;1.1;AES256
ansible_user: ansible 31656630386363323836663537383930346336393061363461653532323561386632343063353161
ansible_become: yes 6630636535373331633762363738613232636366663430330a356333623466623230616433373036
children: 35386162633961616438383332346165323930333662376665616531613837316333653361313332
home: 3065343761343338340a336266316339616134336332376336326332663435323937343531636238
children: 37323530333463383062396363616263386430356438306133393130626365333932323734383165
pis: 3064663435626339393836353837643730333266366436373033
vars: api_endpoint: "https://netbox.desu.ltd"
docker_apt_arch: arm64 group_by:
children: - device_roles
pistorage: - tags
hosts: device_query_filters:
pi-storage-1.desu.ltd: - has_primary_ip: "true"
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:

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: # vim:ft=ansible:
--- ---
# Home desktops # Home desktops
- hosts: desktop - hosts: tags_desktop
tasks: tasks:
- name: assure pi-storage-1 nfs mountpoint - name: assure pi-storage-1 nfs mountpoint
file: path=/nfs/pi-storage-1.desu.ltd state=directory owner=root mode=0755 file: path=/nfs/pi-storage-1.desu.ltd state=directory owner=root mode=0755

View File

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

View File

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

View File

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