From 94c16d6df84afdb4dbe1ce22ee4ee9f47edfab3e Mon Sep 17 00:00:00 2001 From: Salt Date: Fri, 26 Mar 2021 21:58:55 -0500 Subject: [PATCH] More nodes --- inventory/hosts.yml | 2 ++ playbooks/pimp.yml | 72 +++++++++++++++++++++++++++++++++++++++++++++ site.yml | 1 + 3 files changed, 75 insertions(+) create mode 100755 playbooks/pimp.yml diff --git a/inventory/hosts.yml b/inventory/hosts.yml index 922a5d4..0234051 100644 --- a/inventory/hosts.yml +++ b/inventory/hosts.yml @@ -32,8 +32,10 @@ all: pi-kub-node-3.desu.ltd: keepalived_priority: 48 pi-kub-node-4.desu.ltd: + ansible_host: 192.168.103.100 keepalived_priority: 47 pi-kub-node-5.desu.ltd: + ansible_host: 192.168.103.101 keepalived_priority: 46 desktop: hosts: diff --git a/playbooks/pimp.yml b/playbooks/pimp.yml new file mode 100755 index 0000000..5093df7 --- /dev/null +++ b/playbooks/pimp.yml @@ -0,0 +1,72 @@ +#!/usr/bin/env ansible-playbook +# vim:ft=ansible: +--- +# Mass storage Pis +- hosts: pi-storage-1.desu.ltd + tasks: + - name: assure mount directory + file: path=/data state=directory + tags: [ pis, storage ] + - name: assure mount + mount: path=/data src=LABEL=mass state=mounted fstype=ext4 + tags: [ pis, storage ] + - name: assure directories in mount + file: path=/data/{{ item }} state=directory + with_items: + - nfs + - postgresql + tags: [ pis, storage ] + - name: assure symlinks to directories in mount + file: path={{ item.path }} src=/data/{{ item.src }} state=link + with_items: + - { path: /var/lib/postgresql, src: postgresql } + - { path: /srv/nfs, src: nfs } + tags: [ pis, storage ] + roles: + - role: backup + vars: + backup_script: s3pgdump + tags: [ backup ] +# - role: backup +# vars: +# backup_s3backup_list_extra: +# - /data +# backup_time: "Mon *-*-* 02:00:00" + - role: motd + vars: + motd_watch_services_extra: + - docker + - postgresql + - role: postgresql + vars: + postgresql_global_config_options: + - option: listen_addresses + value: 192.168.103.1,172.23.103.1 + postgresql_hba_entries: + - { type: local, database: all, user: postgres, auth_method: peer } + - { type: local, database: all, user: all, auth_method: md5 } + - { type: host, database: all, user: all, address: '127.0.0.0/8', auth_method: md5 } + - { type: host, database: all, user: all, address: '::1/128', auth_method: md5 } + # Used for internal access from other nodes + - { type: host, database: all, user: all, address: '192.168.0.0/16', auth_method: md5 } + # Allow hosts over zerotier + - { type: host, database: all, user: all, address: '172.23.0.0/16', auth_method: md5 } + postgresql_users: + - name: grafana + password: "{{ secret_grafana_local_db_pass }}" + - name: netbox + password: "{{ secret_netbox_local_db_pass }}" + postgresql_databases: + - name: grafana + owner: grafana + - name: netbox + owner: netbox + tags: [ pis, storage, psql ] + - role: nfs + vars: + nfs_exports: + - "/srv/nfs 192.168.0.0/16(ro,no_root_squash,sync) 172.23.0.0/16(ro,no_root_squash,sync)" + - "/srv/nfs/bulk 192.168.0.0/16(rw,no_root_squash,sync) 172.23.0.0/16(rw,no_root_squash,sync)" + - "/srv/nfs/bulk/media 192.168.0.0/16(rw,no_root_squash,sync) 172.23.0.0/16(rw,no_root_squash,sync)" + - "/srv/nfs/k8s 192.168.0.0/16(rw,no_root_squash,sync) 172.23.0.0/16(ro,no_root_squash,sync)" + tags: [ pis, storage, nfs ] diff --git a/site.yml b/site.yml index 31c0b2f..694c56d 100755 --- a/site.yml +++ b/site.yml @@ -35,5 +35,6 @@ - import_playbook: playbooks/web.yml - import_playbook: playbooks/game.yml - import_playbook: playbooks/pis.yml +- import_playbook: playbooks/pimp.yml - import_playbook: playbooks/pik8s.yml - import_playbook: playbooks/desktop.yml