Compare commits

..

14 commits

Author SHA1 Message Date
tux
cac6cca105 Merge pull request 'gitea-fixes' (!22) from gitea-fixes into master
Reviewed-on: https://gitea.n39.eu/Netz39_Admin/netz39-infra-ansible/pulls/22
2022-01-27 21:18:24 +00:00
85f2d98704 Allow external access to gitea port
Until we have a local reverse proxy, ports must be made available
to external access
2022-01-27 21:58:32 +01:00
6f4ede5c5f Fix gitea data dir 2022-01-27 21:58:22 +01:00
babeef8226 Fix YAML format issues 2022-01-27 21:53:34 +01:00
tux
639c1c6c52 Merge pull request 'Bump gitea to 1.15.10' (!21) from gitea-1.15.10 into master
Reviewed-on: https://gitea.n39.eu/Netz39_Admin/netz39-infra-ansible/pulls/21
2022-01-21 22:34:35 +00:00
d50247690a Bump gitea to 1.15.10 2022-01-21 20:01:57 +01:00
tux
89df671708 Merge pull request 'Install gitea via ansible' (!17) from gitea into master
Reviewed-on: https://gitea.n39.eu/Netz39_Admin/netz39-infra-ansible/pulls/17
2022-01-18 20:21:02 +00:00
4af65ede5a Add a note about gitea port 2222 2022-01-11 23:09:36 +01:00
tux
b04a9a0e2b Merge pull request 'Add new virtual machine host 'unicorn'' (!19) from alex/netz39-infra-ansible:unicorn into master
Reviewed-on: https://gitea.n39.eu/Netz39_Admin/netz39-infra-ansible/pulls/19
2022-01-10 14:55:15 +00:00
3aced1fe46 Install gitea via ansible 2022-01-09 16:09:13 +01:00
18da9dc52e inventory: Remove superflous newline 2022-01-08 22:29:47 +01:00
675d7a64e8 Merge pull request 'Add EditorConfig configuration file' (!18) from alex/netz39-infra-ansible:editorconfig into master
Reviewed-on: https://gitea.n39.eu/Netz39_Admin/netz39-infra-ansible/pulls/18
2022-01-08 17:07:36 +00:00
b5286cb6cb Add new virtual machine host 'unicorn'
Required for running unify controller, which is itself required for
configuring our WiFi access points.

Precedes: #16
2022-01-08 14:03:16 +01:00
cc0b075d2c Add EditorConfig configuration file
Link: https://editorconfig.org/
2022-01-08 13:25:36 +01:00
6 changed files with 213 additions and 138 deletions

13
.editorconfig Normal file
View 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

View file

@ -3,6 +3,7 @@
Currently including the following hosts:
* tau.netz39.de
* pottwal.n39.eu
* unicorn.n39.eu
## Setup
```bash

View file

@ -76,4 +76,5 @@ all:
31356239323439666632333033616366663762646366343839663463633665333863343437343334
3665386538393066380a383366346235343531306561643534663035646537666534383536333230
34613761363237633865306332653631323366343232353666343165666664343838
unicorn.n39.eu:
server_admin: "admin+unicorn@netz39.de"

View file

@ -39,3 +39,6 @@
- name: Pottwal specific setup
import_playbook: pottwal.yml
- name: Specific setup for host unicorn
import_playbook: unicorn.yml

View file

@ -14,6 +14,7 @@
openhab_configuration_source: https://github.com/netz39/n39-openhab.git
openhab_configuration_version: master
gitea_host_port: 9091
uritools_host_port: 8080
entities_validation_svc_host_port: 8082
shlink_host_port: 8083
@ -26,155 +27,200 @@
- role: apache
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
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ mosquitto_data }}/config"
- "{{ mosquitto_data }}/data"
- "{{ mosquitto_data }}/log"
- name: Check if gitea data dir exists
ansible.builtin.stat:
path: "/srv/data/gitea"
register: gitea_dir
- name: Fail if gitea data dir does not exist
ansible.builtin.fail:
msg: "Gitea data dir is missing, please restore from the backup!"
when: not gitea_dir.stat.exists
- name: Make sure mosquitto config is there
template:
src: "templates/mosquitto.conf.j2"
dest: "{{ mosquitto_data }}/config/mosquitto.conf"
notify: restart_mosquitto
# If port 2222 is changed here, it must also be adapted
# in the gitea config file (see application volume)!!
- name: Setup the docker container for gitea
docker_container:
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
docker_container:
name: mosquitto
image: "{{ mosquitto_image }}"
pull: true
state: started
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: Setup proxy site gitea.n39.eu
include_role:
name: setup-http-site-proxy
vars:
site_name: "gitea.n39.eu"
proxy_port: "{{ gitea_host_port }}"
- name: Ensure the openhab directories exist
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ openhab_data }}/addons"
- "{{ openhab_data }}/conf"
- "{{ openhab_data }}/userdata"
- 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: 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
docker_container:
name: openhab
image: "{{ openhab_image }}"
pull: true
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 the mosquitto directories exist
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ mosquitto_data }}/config"
- "{{ mosquitto_data }}/data"
- "{{ mosquitto_data }}/log"
- name: Setup proxy site openhab.n39.eu
include_role:
name: setup-http-site-proxy
vars:
site_name: openhab.n39.eu
proxy_port: "{{ openhab_host_port }}"
- name: Make sure mosquitto config is there
template:
src: "templates/mosquitto.conf.j2"
dest: "{{ mosquitto_data }}/config/mosquitto.conf"
notify: restart_mosquitto
- name: Ensure container for URI tools is running
docker_container:
name: uritools
image: mrtux/clean_uri
pull: true
state: started
detach: yes
ports:
- "{{ uritools_host_port }}:8080"
restart_policy: unless-stopped
- name: Ensure mosquitto is running
docker_container:
name: mosquitto
image: "{{ mosquitto_image }}"
pull: true
state: started
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: 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 the openhab directories exist
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ openhab_data }}/addons"
- "{{ openhab_data }}/conf"
- "{{ openhab_data }}/userdata"
- 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: Clone or update configuration
git:
repo: "{{ openhab_configuration_source }}"
version: "{{ openhab_configuration_version }}"
dest: "{{ openhab_data }}/conf"
clone: yes
update: yes
- 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 openhab is up and running
docker_container:
name: openhab
image: "{{ openhab_image }}"
pull: true
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
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 openhab.n39.eu
include_role:
name: setup-http-site-proxy
vars:
site_name: openhab.n39.eu
proxy_port: "{{ openhab_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 }}"
- name: Ensure container for URI tools is running
docker_container:
name: uritools
image: mrtux/clean_uri
pull: true
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:
- name: restart mosquitto
docker_container:
name: mosquitto
state: started
restart: yes
- name: restart mosquitto
docker_container:
name: mosquitto
state: started
restart: yes

11
unicorn.yml Normal file
View file

@ -0,0 +1,11 @@
---
- hosts: unicorn.n39.eu
become: true
vars:
ansible_python_interpreter: /usr/bin/python3
roles:
- role: docker_setup
vars:
docker_data_root: "/srv/docker"