forked from Netz39_Admin/netz39-infra-ansible
Compare commits
15 commits
cac6cca105
...
76d25384c6
Author | SHA1 | Date | |
---|---|---|---|
|
76d25384c6 | ||
8cebc59443 | |||
|
53b7815d27 | ||
62b44867d7 | |||
65bfb358dd | |||
be09ef57f6 | |||
b1b3382728 | |||
9b31fe0619 | |||
b6a05b8c8c | |||
71e031cdc6 | |||
10da78d11b | |||
dee4f2557e | |||
|
48a4e9e62e | ||
00a647036e | |||
f539a42024 |
7 changed files with 264 additions and 181 deletions
|
@ -78,3 +78,6 @@ all:
|
||||||
34613761363237633865306332653631323366343232353666343165666664343838
|
34613761363237633865306332653631323366343232353666343165666664343838
|
||||||
unicorn.n39.eu:
|
unicorn.n39.eu:
|
||||||
server_admin: "admin+unicorn@netz39.de"
|
server_admin: "admin+unicorn@netz39.de"
|
||||||
|
platon.n39.eu:
|
||||||
|
server_admin: "admin+platon@netz39.de"
|
||||||
|
ansible_ssh_user: pi
|
3
main.yml
3
main.yml
|
@ -42,3 +42,6 @@
|
||||||
|
|
||||||
- name: Specific setup for host unicorn
|
- name: Specific setup for host unicorn
|
||||||
import_playbook: unicorn.yml
|
import_playbook: unicorn.yml
|
||||||
|
|
||||||
|
- name: Platon specific setup
|
||||||
|
import_playbook: platon.yml
|
9
platon.yml
Normal file
9
platon.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- hosts: platon.n39.eu
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
door_open_command: '/home/pi/netz39_rollladensteuerung/raspberry/doorcontrol/door-open.sh'
|
||||||
|
ble_keykeeper_dir: '/home/pi/netz39_ble_keykeeper'
|
||||||
|
roles:
|
||||||
|
- role: ble-keykeeper-role
|
358
pottwal.yml
358
pottwal.yml
|
@ -8,7 +8,7 @@
|
||||||
mosquitto_image: eclipse-mosquitto:1.6
|
mosquitto_image: eclipse-mosquitto:1.6
|
||||||
mosquitto_data: /srv/data/mosquitto
|
mosquitto_data: /srv/data/mosquitto
|
||||||
|
|
||||||
openhab_image: openhab/openhab:3.1.0
|
openhab_image: openhab/openhab:2.5.11
|
||||||
openhab_data: /srv/data/openhab
|
openhab_data: /srv/data/openhab
|
||||||
openhab_host_port: 8081
|
openhab_host_port: 8081
|
||||||
openhab_configuration_source: https://github.com/netz39/n39-openhab.git
|
openhab_configuration_source: https://github.com/netz39/n39-openhab.git
|
||||||
|
@ -28,199 +28,199 @@
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: Check if gitea data dir exists
|
- name: Check if gitea data dir exists
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "/srv/data/gitea"
|
path: "/srv/data/gitea"
|
||||||
register: gitea_dir
|
register: gitea_dir
|
||||||
- name: Fail if gitea data dir does not exist
|
- name: Fail if gitea data dir does not exist
|
||||||
ansible.builtin.fail:
|
ansible.builtin.fail:
|
||||||
msg: "Gitea data dir is missing, please restore from the backup!"
|
msg: "Gitea data dir is missing, please restore from the backup!"
|
||||||
when: not gitea_dir.stat.exists
|
when: not gitea_dir.stat.exists
|
||||||
|
|
||||||
# If port 2222 is changed here, it must also be adapted
|
# If port 2222 is changed here, it must also be adapted
|
||||||
# in the gitea config file (see application volume)!!
|
# in the gitea config file (see application volume)!!
|
||||||
- name: Setup the docker container for gitea
|
- name: Setup the docker container for gitea
|
||||||
docker_container:
|
docker_container:
|
||||||
name: gitea
|
name: gitea
|
||||||
image: "gitea/gitea:1.15.10"
|
image: "gitea/gitea:1.15.10"
|
||||||
pull: true
|
pull: true
|
||||||
state: started
|
state: started
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
detach: yes
|
detach: yes
|
||||||
ports:
|
ports:
|
||||||
# - 127.0.0.1:{{ gitea_host_port }}:3000
|
# - 127.0.0.1:{{ gitea_host_port }}:3000
|
||||||
- "{{ gitea_host_port }}:3000"
|
- "{{ gitea_host_port }}:3000"
|
||||||
- 2222:2222
|
- 2222:2222
|
||||||
env:
|
env:
|
||||||
APP_NAME="Netz39 Gitea"
|
APP_NAME="Netz39 Gitea"
|
||||||
RUN_MODE="prod"
|
RUN_MODE="prod"
|
||||||
SSH_DOMAIN="gitea.n39.eu"
|
SSH_DOMAIN="gitea.n39.eu"
|
||||||
SSH_PORT="2222"
|
SSH_PORT="2222"
|
||||||
SSH_START_SERVER="false"
|
SSH_START_SERVER="false"
|
||||||
ROOT_URL="https://gitea.n39.eu"
|
ROOT_URL="https://gitea.n39.eu"
|
||||||
DISABLE_REGISTRATION="true"
|
DISABLE_REGISTRATION="true"
|
||||||
USER_UID=1000
|
USER_UID=1000
|
||||||
USER_GID=1000
|
USER_GID=1000
|
||||||
volumes:
|
volumes:
|
||||||
- "/srv/data/gitea:/data:rw"
|
- "/srv/data/gitea:/data:rw"
|
||||||
|
|
||||||
- name: Setup proxy site gitea.n39.eu
|
- name: Setup proxy site gitea.n39.eu
|
||||||
include_role:
|
include_role:
|
||||||
name: setup-http-site-proxy
|
name: setup-http-site-proxy
|
||||||
vars:
|
vars:
|
||||||
site_name: "gitea.n39.eu"
|
site_name: "gitea.n39.eu"
|
||||||
proxy_port: "{{ gitea_host_port }}"
|
proxy_port: "{{ gitea_host_port }}"
|
||||||
|
|
||||||
- name: Ensure apt-cacher container is running
|
- name: Ensure apt-cacher container is running
|
||||||
docker_container:
|
docker_container:
|
||||||
name: apt_cacher_ng
|
name: apt_cacher_ng
|
||||||
image: "mrtux/apt-cacher-ng"
|
image: "mrtux/apt-cacher-ng"
|
||||||
pull: true
|
pull: true
|
||||||
state: started
|
state: started
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
detach: yes
|
detach: yes
|
||||||
ports:
|
ports:
|
||||||
- 3142:3142
|
- 3142:3142
|
||||||
|
|
||||||
|
|
||||||
- name: Ensure the mosquitto directories exist
|
- name: Ensure the mosquitto directories exist
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ mosquitto_data }}/config"
|
- "{{ mosquitto_data }}/config"
|
||||||
- "{{ mosquitto_data }}/data"
|
- "{{ mosquitto_data }}/data"
|
||||||
- "{{ mosquitto_data }}/log"
|
- "{{ mosquitto_data }}/log"
|
||||||
|
|
||||||
- name: Make sure mosquitto config is there
|
- name: Make sure mosquitto config is there
|
||||||
template:
|
template:
|
||||||
src: "templates/mosquitto.conf.j2"
|
src: "templates/mosquitto.conf.j2"
|
||||||
dest: "{{ mosquitto_data }}/config/mosquitto.conf"
|
dest: "{{ mosquitto_data }}/config/mosquitto.conf"
|
||||||
notify: restart_mosquitto
|
notify: restart_mosquitto
|
||||||
|
|
||||||
- name: Ensure mosquitto is running
|
- name: Ensure mosquitto is running
|
||||||
docker_container:
|
docker_container:
|
||||||
name: mosquitto
|
name: mosquitto
|
||||||
image: "{{ mosquitto_image }}"
|
image: "{{ mosquitto_image }}"
|
||||||
pull: true
|
pull: true
|
||||||
state: started
|
state: started
|
||||||
ports:
|
ports:
|
||||||
- 1883:1883
|
- 1883:1883
|
||||||
- 9001:9001
|
- 9001:9001
|
||||||
volumes:
|
volumes:
|
||||||
- "{{ mosquitto_data }}/config:/mosquitto/config"
|
- "{{ mosquitto_data }}/config:/mosquitto/config"
|
||||||
- "{{ mosquitto_data }}/data:/mosquitto/data"
|
- "{{ mosquitto_data }}/data:/mosquitto/data"
|
||||||
- "{{ mosquitto_data }}/log:/mosquitto/log"
|
- "{{ mosquitto_data }}/log:/mosquitto/log"
|
||||||
detach: yes
|
detach: yes
|
||||||
keep_volumes: yes
|
keep_volumes: yes
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
|
|
||||||
- name: Ensure the openhab directories exist
|
- name: Ensure the openhab directories exist
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ openhab_data }}/addons"
|
- "{{ openhab_data }}/addons"
|
||||||
- "{{ openhab_data }}/conf"
|
- "{{ openhab_data }}/conf"
|
||||||
- "{{ openhab_data }}/userdata"
|
- "{{ openhab_data }}/userdata"
|
||||||
|
|
||||||
- name: Clone or update configuration
|
- name: Clone or update configuration
|
||||||
git:
|
git:
|
||||||
repo: "{{ openhab_configuration_source }}"
|
repo: "{{ openhab_configuration_source }}"
|
||||||
version: "{{ openhab_configuration_version }}"
|
version: "{{ openhab_configuration_version }}"
|
||||||
dest: "{{ openhab_data }}/conf"
|
dest: "{{ openhab_data }}/conf"
|
||||||
clone: yes
|
clone: yes
|
||||||
update: yes
|
update: yes
|
||||||
|
|
||||||
- name: ensure openhab is up and running
|
- name: ensure openhab is up and running
|
||||||
docker_container:
|
docker_container:
|
||||||
name: openhab
|
name: openhab
|
||||||
image: "{{ openhab_image }}"
|
image: "{{ openhab_image }}"
|
||||||
pull: true
|
pull: true
|
||||||
state: started
|
state: started
|
||||||
detach: yes
|
detach: yes
|
||||||
interactive: yes
|
interactive: yes
|
||||||
tty: yes
|
tty: yes
|
||||||
ports:
|
ports:
|
||||||
- "{{ openhab_host_port }}:8080"
|
- "{{ openhab_host_port }}:8080"
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
- "{{ openhab_data }}/addons:/openhab/addons:rw"
|
- "{{ openhab_data }}/addons:/openhab/addons:rw"
|
||||||
- "{{ openhab_data }}/conf:/openhab/conf:rw"
|
- "{{ openhab_data }}/conf:/openhab/conf:rw"
|
||||||
- "{{ openhab_data }}/userdata:/openhab/userdata:rw"
|
- "{{ openhab_data }}/userdata:/openhab/userdata:rw"
|
||||||
keep_volumes: yes
|
keep_volumes: yes
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
env: EXTRA_JAVA_OPTS="-Duser.timezone=Europe/Berlin"
|
env: EXTRA_JAVA_OPTS="-Duser.timezone=Europe/Berlin"
|
||||||
|
|
||||||
- name: Setup proxy site openhab.n39.eu
|
- name: Setup proxy site openhab.n39.eu
|
||||||
include_role:
|
include_role:
|
||||||
name: setup-http-site-proxy
|
name: setup-http-site-proxy
|
||||||
vars:
|
vars:
|
||||||
site_name: openhab.n39.eu
|
site_name: openhab.n39.eu
|
||||||
proxy_port: "{{ openhab_host_port }}"
|
proxy_port: "{{ openhab_host_port }}"
|
||||||
|
|
||||||
- name: Ensure container for URI tools is running
|
- name: Ensure container for URI tools is running
|
||||||
docker_container:
|
docker_container:
|
||||||
name: uritools
|
name: uritools
|
||||||
image: mrtux/clean_uri
|
image: mrtux/clean_uri
|
||||||
pull: true
|
pull: true
|
||||||
state: started
|
state: started
|
||||||
detach: yes
|
detach: yes
|
||||||
ports:
|
ports:
|
||||||
- "{{ uritools_host_port }}:8080"
|
- "{{ uritools_host_port }}:8080"
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
|
|
||||||
- name: Setup proxy site uritools.n39.eu
|
- name: Setup proxy site uritools.n39.eu
|
||||||
include_role:
|
include_role:
|
||||||
name: setup-http-site-proxy
|
name: setup-http-site-proxy
|
||||||
vars:
|
vars:
|
||||||
site_name: uritools.n39.eu
|
site_name: uritools.n39.eu
|
||||||
proxy_port: "{{ uritools_host_port }}"
|
proxy_port: "{{ uritools_host_port }}"
|
||||||
|
|
||||||
- name: Ensure container for entities validation service is running
|
- name: Ensure container for entities validation service is running
|
||||||
docker_container:
|
docker_container:
|
||||||
name: entities_validation_svc
|
name: entities_validation_svc
|
||||||
image: netz39/entities_validation_svc:v1.0.0
|
image: netz39/entities_validation_svc:v1.0.0
|
||||||
pull: true
|
pull: true
|
||||||
state: started
|
state: started
|
||||||
detach: yes
|
detach: yes
|
||||||
ports:
|
ports:
|
||||||
- "{{ entities_validation_svc_host_port }}:8080"
|
- "{{ entities_validation_svc_host_port }}:8080"
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
|
|
||||||
- name: Setup proxy site entities-validation.svc.n39.eu
|
- name: Setup proxy site entities-validation.svc.n39.eu
|
||||||
include_role:
|
include_role:
|
||||||
name: setup-http-site-proxy
|
name: setup-http-site-proxy
|
||||||
vars:
|
vars:
|
||||||
site_name: entities-validation.svc.n39.eu
|
site_name: entities-validation.svc.n39.eu
|
||||||
proxy_port: "{{ entities_validation_svc_host_port }}"
|
proxy_port: "{{ entities_validation_svc_host_port }}"
|
||||||
|
|
||||||
- name: Ensure container for shlink is running
|
- name: Ensure container for shlink is running
|
||||||
docker_container:
|
docker_container:
|
||||||
name: shlink
|
name: shlink
|
||||||
image: shlinkio/shlink:2.6.2
|
image: shlinkio/shlink:2.6.2
|
||||||
pull: true
|
pull: true
|
||||||
state: started
|
state: started
|
||||||
detach: yes
|
detach: yes
|
||||||
ports:
|
ports:
|
||||||
- "{{ shlink_host_port }}:8080"
|
- "{{ shlink_host_port }}:8080"
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
env:
|
env:
|
||||||
SHORT_DOMAIN_HOST: "{{ shlink_domain_name }}"
|
SHORT_DOMAIN_HOST: "{{ shlink_domain_name }}"
|
||||||
SHORT_DOMAIN_SCHEMA: https
|
SHORT_DOMAIN_SCHEMA: https
|
||||||
GEOLITE_LICENSE_KEY: "{{ shlink_geolite_license_key }}"
|
GEOLITE_LICENSE_KEY: "{{ shlink_geolite_license_key }}"
|
||||||
|
|
||||||
|
- name: Setup proxy site {{ shlink_domain_name }}
|
||||||
|
include_role:
|
||||||
|
name: setup-http-site-proxy
|
||||||
|
vars:
|
||||||
|
site_name: "{{ shlink_domain_name }}"
|
||||||
|
proxy_port: "{{ shlink_host_port }}"
|
||||||
|
|
||||||
- name: Setup proxy site {{ shlink_domain_name }}
|
|
||||||
include_role:
|
|
||||||
name: setup-http-site-proxy
|
|
||||||
vars:
|
|
||||||
site_name: "{{ shlink_domain_name }}"
|
|
||||||
proxy_port: "{{ shlink_host_port }}"
|
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
- name: restart mosquitto
|
- name: restart mosquitto
|
||||||
docker_container:
|
docker_container:
|
||||||
name: mosquitto
|
name: mosquitto
|
||||||
state: started
|
state: started
|
||||||
restart: yes
|
restart: yes
|
||||||
|
|
|
@ -5,3 +5,5 @@
|
||||||
version: 3.0.0
|
version: 3.0.0
|
||||||
- src: git+https://github.com/24367dfa/ansible-role-dehydrated.git
|
- src: git+https://github.com/24367dfa/ansible-role-dehydrated.git
|
||||||
version: 1.0.2
|
version: 1.0.2
|
||||||
|
- src: git+https://github.com/maz3max/ble-keykeeper-role.git
|
||||||
|
version: v1.0.1
|
||||||
|
|
45
tau.yml
45
tau.yml
|
@ -5,6 +5,9 @@
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /usr/bin/python3
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
|
||||||
|
docker_registry_port: 5000 # this is the reg standard port
|
||||||
|
docker_registry_domain: "docker.n39.eu"
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: docker_setup
|
- role: docker_setup
|
||||||
- role: apache
|
- role: apache
|
||||||
|
@ -31,6 +34,8 @@
|
||||||
deploy_challenge_hook: "/bin/systemctl restart apache2"
|
deploy_challenge_hook: "/bin/systemctl restart apache2"
|
||||||
- name: "mysql.adm.netz39.de"
|
- name: "mysql.adm.netz39.de"
|
||||||
deploy_challenge_hook: "/bin/systemctl restart apache2"
|
deploy_challenge_hook: "/bin/systemctl restart apache2"
|
||||||
|
- name: "{{ docker_registry_domain }}"
|
||||||
|
deploy_challenge_hook: "/bin/systemctl restart apache2"
|
||||||
|
|
||||||
- name: Setup forward site reservierung.netz39.de
|
- name: Setup forward site reservierung.netz39.de
|
||||||
include_role:
|
include_role:
|
||||||
|
@ -68,3 +73,43 @@
|
||||||
vars:
|
vars:
|
||||||
site_name: mysql.adm.netz39.de
|
site_name: mysql.adm.netz39.de
|
||||||
proxy_port: 9001
|
proxy_port: 9001
|
||||||
|
|
||||||
|
|
||||||
|
- name: Check if Docker Registry auth dir exists
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "/srv/docker/registry/auth"
|
||||||
|
register: docker_dir
|
||||||
|
- name: Fail if docker registry data dir does not exist
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: "Docker Registry auth dir is missing, please restore from the backup!"
|
||||||
|
when: not docker_dir.stat.exists
|
||||||
|
- name: Ensure the Docker Registry data directory exists
|
||||||
|
# This may not be part of the backup
|
||||||
|
file:
|
||||||
|
path: "/srv/docker/registry/data"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Setup Docker Registry Container
|
||||||
|
docker_container:
|
||||||
|
name: registry
|
||||||
|
image: "registry:2"
|
||||||
|
pull: true
|
||||||
|
state: started
|
||||||
|
restart_policy: unless-stopped
|
||||||
|
detach: yes
|
||||||
|
ports:
|
||||||
|
- 127.0.0.1:{{ docker_registry_port }}:{{ docker_registry_port }}
|
||||||
|
env:
|
||||||
|
REGISTRY_HTTP_HOST: "https://{{ docker_registry_domain }}"
|
||||||
|
REGISTRY_AUTH_HTPASSWD_REALM: "Netz39 Docker Registry"
|
||||||
|
REGISTRY_AUTH_HTPASSWD_PATH: "/auth/htpasswd"
|
||||||
|
volumes:
|
||||||
|
- "/srv/docker/registry/data:/var/lib/registry:rw"
|
||||||
|
- "/srv/docker/registry/auth:/auth:rw"
|
||||||
|
|
||||||
|
- name: Setup proxy site for the Docker Registry
|
||||||
|
include_role:
|
||||||
|
name: setup-http-site-proxy
|
||||||
|
vars:
|
||||||
|
site_name: "{{ docker_registry_domain }}"
|
||||||
|
proxy_port: "{{ docker_registry_port }}"
|
||||||
|
|
25
unicorn.yml
25
unicorn.yml
|
@ -1,11 +1,32 @@
|
||||||
---
|
---
|
||||||
|
# this is for a dedicated vm just hosting the unifi controller.
|
||||||
- hosts: unicorn.n39.eu
|
- hosts: unicorn.n39.eu
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /usr/bin/python3
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: docker_setup
|
- role: docker_setup
|
||||||
vars:
|
vars:
|
||||||
docker_data_root: "/srv/docker"
|
docker_data_root: "/srv/docker"
|
||||||
|
tasks:
|
||||||
|
- name: Setup the docker container for unifi-controller
|
||||||
|
docker_container:
|
||||||
|
name: unifi-controller
|
||||||
|
image: "jacobalberty/unifi:v6.5.55"
|
||||||
|
state: started
|
||||||
|
restart_policy: unless-stopped
|
||||||
|
container_default_behavior: no_defaults
|
||||||
|
env:
|
||||||
|
TZ: "Europe/Berlin"
|
||||||
|
# These fixed ports are needed.
|
||||||
|
# https://help.ui.com/hc/en-us/articles/218506997-UniFi-Ports-Used
|
||||||
|
ports:
|
||||||
|
- "8080:8080/tcp" # Device command/control
|
||||||
|
- "8443:8443/tcp" # Web interface + API
|
||||||
|
- "8843:8843/tcp" # HTTPS portal
|
||||||
|
- "8880:8880/tcp" # HTTP portal
|
||||||
|
- "3478:3478/udp" # STUN service
|
||||||
|
- "6789:6789/tcp" # Speed Test (unifi5 only)
|
||||||
|
volumes:
|
||||||
|
- "/srv/data/unifi-controller/data:/unifi/data"
|
||||||
|
- "/srv/data/unifi-controller/log:/unifi/log"
|
||||||
|
|
Loading…
Reference in a new issue