diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a010f26..91afee7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/inventory/hosts.yml b/inventory/hosts.yml index 8620d81..b1845fa 100644 --- a/inventory/hosts.yml +++ b/inventory/hosts.yml @@ -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" diff --git a/inventory/hosts.yml.old b/inventory/hosts.yml.old new file mode 100644 index 0000000..8620d81 --- /dev/null +++ b/inventory/hosts.yml.old @@ -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: diff --git a/playbooks/desktop.yml b/playbooks/desktop.yml index 5dc0519..37a951f 100755 --- a/playbooks/desktop.yml +++ b/playbooks/desktop.yml @@ -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 diff --git a/playbooks/game.yml b/playbooks/game.yml index 1db9446..446ebb1 100755 --- a/playbooks/game.yml +++ b/playbooks/game.yml @@ -2,7 +2,7 @@ # vim:ft=ansible: # Game servers --- -- hosts: game +- hosts: tags_game roles: - role: backup vars: diff --git a/playbooks/pik8s.yml b/playbooks/pik8s.yml index 3091f93..2024d92 100755 --- a/playbooks/pik8s.yml +++ b/playbooks/pik8s.yml @@ -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 diff --git a/playbooks/pis.yml b/playbooks/pis.yml index f6b5899..bd9b242 100755 --- a/playbooks/pis.yml +++ b/playbooks/pis.yml @@ -2,7 +2,7 @@ # vim:ft=ansible: --- # General configuration -- hosts: pis +- hosts: tags_pis roles: - role: zerotier tags: [ pis, zerotier ]