forked from Netz39_Admin/netz39-infra-ansible
Compare commits
15 commits
ec8d79e596
...
48a4e9e62e
Author | SHA1 | Date | |
---|---|---|---|
|
48a4e9e62e | ||
cac6cca105 | |||
85f2d98704 | |||
6f4ede5c5f | |||
babeef8226 | |||
639c1c6c52 | |||
d50247690a | |||
89df671708 | |||
4af65ede5a | |||
b04a9a0e2b | |||
3aced1fe46 | |||
18da9dc52e | |||
675d7a64e8 | |||
b5286cb6cb | |||
cc0b075d2c |
6 changed files with 202 additions and 141 deletions
13
.editorconfig
Normal file
13
.editorconfig
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# EditorConfig is awesome: https://EditorConfig.org
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.yml]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
|
@ -3,6 +3,7 @@
|
||||||
Currently including the following hosts:
|
Currently including the following hosts:
|
||||||
* tau.netz39.de
|
* tau.netz39.de
|
||||||
* pottwal.n39.eu
|
* pottwal.n39.eu
|
||||||
|
* unicorn.n39.eu
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -76,4 +76,5 @@ all:
|
||||||
31356239323439666632333033616366663762646366343839663463633665333863343437343334
|
31356239323439666632333033616366663762646366343839663463633665333863343437343334
|
||||||
3665386538393066380a383366346235343531306561643534663035646537666534383536333230
|
3665386538393066380a383366346235343531306561643534663035646537666534383536333230
|
||||||
34613761363237633865306332653631323366343232353666343165666664343838
|
34613761363237633865306332653631323366343232353666343165666664343838
|
||||||
|
unicorn.n39.eu:
|
||||||
|
server_admin: "admin+unicorn@netz39.de"
|
||||||
|
|
4
main.yml
4
main.yml
|
@ -40,5 +40,5 @@
|
||||||
- name: Pottwal specific setup
|
- name: Pottwal specific setup
|
||||||
import_playbook: pottwal.yml
|
import_playbook: pottwal.yml
|
||||||
|
|
||||||
- name: Unifi specific setup
|
- name: Specific setup for host unicorn
|
||||||
import_playbook: unifi.yml
|
import_playbook: unicorn.yml
|
||||||
|
|
320
pottwal.yml
320
pottwal.yml
|
@ -14,6 +14,7 @@
|
||||||
openhab_configuration_source: https://github.com/netz39/n39-openhab.git
|
openhab_configuration_source: https://github.com/netz39/n39-openhab.git
|
||||||
openhab_configuration_version: master
|
openhab_configuration_version: master
|
||||||
|
|
||||||
|
gitea_host_port: 9091
|
||||||
uritools_host_port: 8080
|
uritools_host_port: 8080
|
||||||
entities_validation_svc_host_port: 8082
|
entities_validation_svc_host_port: 8082
|
||||||
shlink_host_port: 8083
|
shlink_host_port: 8083
|
||||||
|
@ -26,155 +27,200 @@
|
||||||
- role: apache
|
- role: apache
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Ensure apt-cacher container is running
|
|
||||||
docker_container:
|
|
||||||
name: apt_cacher_ng
|
|
||||||
image: "mrtux/apt-cacher-ng"
|
|
||||||
pull: true
|
|
||||||
state: started
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
detach: yes
|
|
||||||
ports:
|
|
||||||
- 3142:3142
|
|
||||||
|
|
||||||
- name: Ensure the mosquitto directories exist
|
- name: Check if gitea data dir exists
|
||||||
file:
|
ansible.builtin.stat:
|
||||||
path: "{{ item }}"
|
path: "/srv/data/gitea"
|
||||||
state: directory
|
register: gitea_dir
|
||||||
with_items:
|
- name: Fail if gitea data dir does not exist
|
||||||
- "{{ mosquitto_data }}/config"
|
ansible.builtin.fail:
|
||||||
- "{{ mosquitto_data }}/data"
|
msg: "Gitea data dir is missing, please restore from the backup!"
|
||||||
- "{{ mosquitto_data }}/log"
|
when: not gitea_dir.stat.exists
|
||||||
|
|
||||||
- name: Make sure mosquitto config is there
|
# If port 2222 is changed here, it must also be adapted
|
||||||
template:
|
# in the gitea config file (see application volume)!!
|
||||||
src: "templates/mosquitto.conf.j2"
|
- name: Setup the docker container for gitea
|
||||||
dest: "{{ mosquitto_data }}/config/mosquitto.conf"
|
docker_container:
|
||||||
notify: restart_mosquitto
|
name: gitea
|
||||||
|
image: "gitea/gitea:1.15.10"
|
||||||
|
pull: true
|
||||||
|
state: started
|
||||||
|
restart_policy: unless-stopped
|
||||||
|
detach: yes
|
||||||
|
ports:
|
||||||
|
# - 127.0.0.1:{{ gitea_host_port }}:3000
|
||||||
|
- "{{ gitea_host_port }}:3000"
|
||||||
|
- 2222:2222
|
||||||
|
env:
|
||||||
|
APP_NAME="Netz39 Gitea"
|
||||||
|
RUN_MODE="prod"
|
||||||
|
SSH_DOMAIN="gitea.n39.eu"
|
||||||
|
SSH_PORT="2222"
|
||||||
|
SSH_START_SERVER="false"
|
||||||
|
ROOT_URL="https://gitea.n39.eu"
|
||||||
|
DISABLE_REGISTRATION="true"
|
||||||
|
USER_UID=1000
|
||||||
|
USER_GID=1000
|
||||||
|
volumes:
|
||||||
|
- "/srv/data/gitea:/data:rw"
|
||||||
|
|
||||||
- name: Ensure mosquitto is running
|
- name: Setup proxy site gitea.n39.eu
|
||||||
docker_container:
|
include_role:
|
||||||
name: mosquitto
|
name: setup-http-site-proxy
|
||||||
image: "{{ mosquitto_image }}"
|
vars:
|
||||||
pull: true
|
site_name: "gitea.n39.eu"
|
||||||
state: started
|
proxy_port: "{{ gitea_host_port }}"
|
||||||
ports:
|
|
||||||
- 1883:1883
|
|
||||||
- 9001:9001
|
|
||||||
volumes:
|
|
||||||
- "{{ mosquitto_data }}/config:/mosquitto/config"
|
|
||||||
- "{{ mosquitto_data }}/data:/mosquitto/data"
|
|
||||||
- "{{ mosquitto_data }}/log:/mosquitto/log"
|
|
||||||
detach: yes
|
|
||||||
keep_volumes: yes
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
|
|
||||||
- name: Ensure the openhab directories exist
|
- name: Ensure apt-cacher container is running
|
||||||
file:
|
docker_container:
|
||||||
path: "{{ item }}"
|
name: apt_cacher_ng
|
||||||
state: directory
|
image: "mrtux/apt-cacher-ng"
|
||||||
with_items:
|
pull: true
|
||||||
- "{{ openhab_data }}/addons"
|
state: started
|
||||||
- "{{ openhab_data }}/conf"
|
restart_policy: unless-stopped
|
||||||
- "{{ openhab_data }}/userdata"
|
detach: yes
|
||||||
|
ports:
|
||||||
|
- 3142:3142
|
||||||
|
|
||||||
- name: Clone or update configuration
|
|
||||||
git:
|
|
||||||
repo: "{{ openhab_configuration_source }}"
|
|
||||||
version: "{{ openhab_configuration_version }}"
|
|
||||||
dest: "{{ openhab_data }}/conf"
|
|
||||||
clone: yes
|
|
||||||
update: yes
|
|
||||||
|
|
||||||
- name: ensure openhab is up and running
|
- name: Ensure the mosquitto directories exist
|
||||||
docker_container:
|
file:
|
||||||
name: openhab
|
path: "{{ item }}"
|
||||||
image: "{{ openhab_image }}"
|
state: directory
|
||||||
pull: true
|
with_items:
|
||||||
state: started
|
- "{{ mosquitto_data }}/config"
|
||||||
detach: yes
|
- "{{ mosquitto_data }}/data"
|
||||||
interactive: yes
|
- "{{ mosquitto_data }}/log"
|
||||||
tty: yes
|
|
||||||
ports:
|
|
||||||
- "{{ openhab_host_port }}:8080"
|
|
||||||
volumes:
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
- /etc/timezone:/etc/timezone:ro
|
|
||||||
- "{{ openhab_data }}/addons:/openhab/addons:rw"
|
|
||||||
- "{{ openhab_data }}/conf:/openhab/conf:rw"
|
|
||||||
- "{{ openhab_data }}/userdata:/openhab/userdata:rw"
|
|
||||||
keep_volumes: yes
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
env: EXTRA_JAVA_OPTS="-Duser.timezone=Europe/Berlin"
|
|
||||||
|
|
||||||
- name: Setup proxy site openhab.n39.eu
|
- name: Make sure mosquitto config is there
|
||||||
include_role:
|
template:
|
||||||
name: setup-http-site-proxy
|
src: "templates/mosquitto.conf.j2"
|
||||||
vars:
|
dest: "{{ mosquitto_data }}/config/mosquitto.conf"
|
||||||
site_name: openhab.n39.eu
|
notify: restart_mosquitto
|
||||||
proxy_port: "{{ openhab_host_port }}"
|
|
||||||
|
|
||||||
- name: Ensure container for URI tools is running
|
- name: Ensure mosquitto is running
|
||||||
docker_container:
|
docker_container:
|
||||||
name: uritools
|
name: mosquitto
|
||||||
image: mrtux/clean_uri
|
image: "{{ mosquitto_image }}"
|
||||||
pull: true
|
pull: true
|
||||||
state: started
|
state: started
|
||||||
detach: yes
|
ports:
|
||||||
ports:
|
- 1883:1883
|
||||||
- "{{ uritools_host_port }}:8080"
|
- 9001:9001
|
||||||
restart_policy: unless-stopped
|
volumes:
|
||||||
|
- "{{ mosquitto_data }}/config:/mosquitto/config"
|
||||||
|
- "{{ mosquitto_data }}/data:/mosquitto/data"
|
||||||
|
- "{{ mosquitto_data }}/log:/mosquitto/log"
|
||||||
|
detach: yes
|
||||||
|
keep_volumes: yes
|
||||||
|
restart_policy: unless-stopped
|
||||||
|
|
||||||
- name: Setup proxy site uritools.n39.eu
|
- name: Ensure the openhab directories exist
|
||||||
include_role:
|
file:
|
||||||
name: setup-http-site-proxy
|
path: "{{ item }}"
|
||||||
vars:
|
state: directory
|
||||||
site_name: uritools.n39.eu
|
with_items:
|
||||||
proxy_port: "{{ uritools_host_port }}"
|
- "{{ openhab_data }}/addons"
|
||||||
|
- "{{ openhab_data }}/conf"
|
||||||
|
- "{{ openhab_data }}/userdata"
|
||||||
|
|
||||||
- name: Ensure container for entities validation service is running
|
- name: Clone or update configuration
|
||||||
docker_container:
|
git:
|
||||||
name: entities_validation_svc
|
repo: "{{ openhab_configuration_source }}"
|
||||||
image: netz39/entities_validation_svc:v1.0.0
|
version: "{{ openhab_configuration_version }}"
|
||||||
pull: true
|
dest: "{{ openhab_data }}/conf"
|
||||||
state: started
|
clone: yes
|
||||||
detach: yes
|
update: yes
|
||||||
ports:
|
|
||||||
- "{{ entities_validation_svc_host_port }}:8080"
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
|
|
||||||
- name: Setup proxy site entities-validation.svc.n39.eu
|
- name: ensure openhab is up and running
|
||||||
include_role:
|
docker_container:
|
||||||
name: setup-http-site-proxy
|
name: openhab
|
||||||
vars:
|
image: "{{ openhab_image }}"
|
||||||
site_name: entities-validation.svc.n39.eu
|
pull: true
|
||||||
proxy_port: "{{ entities_validation_svc_host_port }}"
|
state: started
|
||||||
|
detach: yes
|
||||||
|
interactive: yes
|
||||||
|
tty: yes
|
||||||
|
ports:
|
||||||
|
- "{{ openhab_host_port }}:8080"
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
- /etc/timezone:/etc/timezone:ro
|
||||||
|
- "{{ openhab_data }}/addons:/openhab/addons:rw"
|
||||||
|
- "{{ openhab_data }}/conf:/openhab/conf:rw"
|
||||||
|
- "{{ openhab_data }}/userdata:/openhab/userdata:rw"
|
||||||
|
keep_volumes: yes
|
||||||
|
restart_policy: unless-stopped
|
||||||
|
env: EXTRA_JAVA_OPTS="-Duser.timezone=Europe/Berlin"
|
||||||
|
|
||||||
- name: Ensure container for shlink is running
|
- name: Setup proxy site openhab.n39.eu
|
||||||
docker_container:
|
include_role:
|
||||||
name: shlink
|
name: setup-http-site-proxy
|
||||||
image: shlinkio/shlink:2.6.2
|
vars:
|
||||||
pull: true
|
site_name: openhab.n39.eu
|
||||||
state: started
|
proxy_port: "{{ openhab_host_port }}"
|
||||||
detach: yes
|
|
||||||
ports:
|
|
||||||
- "{{ shlink_host_port }}:8080"
|
|
||||||
restart_policy: unless-stopped
|
|
||||||
env:
|
|
||||||
SHORT_DOMAIN_HOST: "{{ shlink_domain_name }}"
|
|
||||||
SHORT_DOMAIN_SCHEMA: https
|
|
||||||
GEOLITE_LICENSE_KEY: "{{ shlink_geolite_license_key }}"
|
|
||||||
|
|
||||||
- name: Setup proxy site {{ shlink_domain_name }}
|
- name: Ensure container for URI tools is running
|
||||||
include_role:
|
docker_container:
|
||||||
name: setup-http-site-proxy
|
name: uritools
|
||||||
vars:
|
image: mrtux/clean_uri
|
||||||
site_name: "{{ shlink_domain_name }}"
|
pull: true
|
||||||
proxy_port: "{{ shlink_host_port }}"
|
state: started
|
||||||
|
detach: yes
|
||||||
|
ports:
|
||||||
|
- "{{ uritools_host_port }}:8080"
|
||||||
|
restart_policy: unless-stopped
|
||||||
|
|
||||||
|
- name: Setup proxy site uritools.n39.eu
|
||||||
|
include_role:
|
||||||
|
name: setup-http-site-proxy
|
||||||
|
vars:
|
||||||
|
site_name: uritools.n39.eu
|
||||||
|
proxy_port: "{{ uritools_host_port }}"
|
||||||
|
|
||||||
|
- name: Ensure container for entities validation service is running
|
||||||
|
docker_container:
|
||||||
|
name: entities_validation_svc
|
||||||
|
image: netz39/entities_validation_svc:v1.0.0
|
||||||
|
pull: true
|
||||||
|
state: started
|
||||||
|
detach: yes
|
||||||
|
ports:
|
||||||
|
- "{{ entities_validation_svc_host_port }}:8080"
|
||||||
|
restart_policy: unless-stopped
|
||||||
|
|
||||||
|
- name: Setup proxy site entities-validation.svc.n39.eu
|
||||||
|
include_role:
|
||||||
|
name: setup-http-site-proxy
|
||||||
|
vars:
|
||||||
|
site_name: entities-validation.svc.n39.eu
|
||||||
|
proxy_port: "{{ entities_validation_svc_host_port }}"
|
||||||
|
|
||||||
|
- name: Ensure container for shlink is running
|
||||||
|
docker_container:
|
||||||
|
name: shlink
|
||||||
|
image: shlinkio/shlink:2.6.2
|
||||||
|
pull: true
|
||||||
|
state: started
|
||||||
|
detach: yes
|
||||||
|
ports:
|
||||||
|
- "{{ shlink_host_port }}:8080"
|
||||||
|
restart_policy: unless-stopped
|
||||||
|
env:
|
||||||
|
SHORT_DOMAIN_HOST: "{{ shlink_domain_name }}"
|
||||||
|
SHORT_DOMAIN_SCHEMA: https
|
||||||
|
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 }}"
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
- name: restart mosquitto
|
- name: restart mosquitto
|
||||||
docker_container:
|
docker_container:
|
||||||
name: mosquitto
|
name: mosquitto
|
||||||
state: started
|
state: started
|
||||||
restart: yes
|
restart: yes
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
# this is for a dedicated vm just hosting the unifi controller.
|
# this is for a dedicated vm just hosting the unifi controller.
|
||||||
- hosts: unifi.n39.eu
|
- hosts: unicorn.n39.eu
|
||||||
become: true
|
become: true
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /usr/bin/python3
|
ansible_python_interpreter: /usr/bin/python3
|
Loading…
Reference in a new issue