ansible/playbooks/pimp.yml

134 lines
4.5 KiB
YAML
Raw Normal View History

2021-02-28 19:48:42 -06:00
#!/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_list:
- /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
2021-03-11 09:11:48 -06:00
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 }
2021-03-10 13:34:27 -06:00
# Allow hosts over zerotier
- { type: host, database: all, user: all, address: '172.23.0.0/16', auth_method: md5 }
2021-02-28 21:18:00 -06:00
postgresql_users:
- name: grafana
password: "{{ secret_grafana_local_db_pass }}"
2021-03-10 13:29:59 -06:00
- name: netbox
password: "{{ secret_netbox_local_db_pass }}"
2021-02-28 21:18:00 -06:00
postgresql_databases:
- name: grafana
owner: grafana
2021-03-10 13:29:59 -06:00
- name: netbox
owner: netbox
tags: [ pis, storage, psql ]
- role: nfs
vars:
nfs_exports:
2021-03-11 20:45:24 -06:00
- "/srv/nfs 192.168.0.0/16(ro,no_root_squash,sync) 172.23.0.0/16(ro,no_root_squash,sync)"
2021-03-01 15:12:19 -06:00
- "/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)"
2021-03-11 20:37:58 -06:00
- "/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 ]
2021-02-28 19:48:42 -06:00
# Multipurpose Pis running unbound
- hosts: pi-mp-1.desu.ltd,pi-mp-2.desu.ltd
vars:
container_default_behavior: no_defaults
tasks:
- name: docker deploy unbound
docker_container:
name: unbound
image: rehashedsalt/unbound-desu-local:latest
restart_policy: unless-stopped
pull: yes
ports:
- "{{ ansible_facts.eth0.ipv4.address }}:53:5053/tcp"
- "{{ ansible_facts.eth0.ipv4.address }}:53:5053/udp"
tags: [ pis, mp, unbound ]
roles:
- role: motd
vars:
motd_watch_services_extra:
- docker
- isc-dhcp-server
2021-03-10 10:41:40 -06:00
motd_watch_containers_extra:
- unbound
2021-02-28 19:48:42 -06:00
tags: [ pis, mp, motd ]
# And also serving DHCP
- hosts: pi-mp-1.desu.ltd
vars_files:
- vars/desulocal-dhcp.yml
roles:
- role: netplan-static-ip
tags: [ pis, mp, dhcp, static-ip ]
- role: dhcp
vars:
dhcp_global_failover_peer: failover-group
dhcp_global_failover:
role: primary
address: 192.168.103.100
port: 647
peer_address: 192.168.103.101
peer_port: 647
max_response_delay: 15
max_unacked_updates: 10
load_balance_max_seconds: 5
split: 255
mclt: 3600
tags: [ pis, mp, dhcp ]
- hosts: pi-mp-2.desu.ltd
vars_files:
- vars/desulocal-dhcp.yml
roles:
- role: netplan-static-ip
tags: [ pis, mp, dhcp, static-ip ]
- role: dhcp
vars:
dhcp_global_failover_peer: failover-group
dhcp_global_failover:
role: secondary
address: 192.168.103.101
port: 647
peer_address: 192.168.103.100
peer_port: 647
max_response_delay: 15
max_unacked_updates: 10
load_balance_max_seconds: 5
tags: [ pis, mp, dhcp ]