2020-12-10 22:15:09 +01:00
|
|
|
- hosts: pottwal.n39.eu
|
|
|
|
become: true
|
|
|
|
|
|
|
|
vars:
|
|
|
|
ansible_python_interpreter: /usr/bin/python3
|
|
|
|
|
2020-12-11 18:59:47 +01:00
|
|
|
openhab_image: openhab/openhab:2.5.10
|
|
|
|
openhab_data: /srv/data/openhab
|
|
|
|
openhab_host_port: 8081
|
|
|
|
openhab_configuration_source: https://github.com/netz39/n39-openhab.git
|
|
|
|
openhab_configuration_version: master
|
|
|
|
|
2020-12-10 22:15:09 +01:00
|
|
|
roles:
|
2020-12-12 14:09:05 +01:00
|
|
|
- role: docker_setup
|
2020-12-11 17:25:32 +01:00
|
|
|
vars:
|
|
|
|
docker_data_root: "/srv/docker"
|
2020-12-10 22:15:09 +01:00
|
|
|
- role: apache
|
|
|
|
|
|
|
|
tasks:
|
2020-12-11 18:59:47 +01:00
|
|
|
- name: Ensure the openhab directories exist
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
with_items:
|
|
|
|
- "{{ openhab_data }}/addons"
|
|
|
|
- "{{ openhab_data }}/conf"
|
|
|
|
- "{{ openhab_data }}/userdata"
|
|
|
|
|
|
|
|
- name: Clone or update configuration
|
|
|
|
git:
|
|
|
|
repo: "{{ openhab_configuration_source }}"
|
|
|
|
version: "{{ openhab_configuration_version }}"
|
|
|
|
dest: "{{ openhab_data }}/conf"
|
|
|
|
clone: yes
|
|
|
|
update: yes
|
|
|
|
notify: restart openhab
|
|
|
|
|
|
|
|
- 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"
|
|
|
|
|
2020-12-12 15:50:50 +01:00
|
|
|
- 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 }}"
|
|
|
|
|
2020-12-11 18:59:47 +01:00
|
|
|
handlers:
|
|
|
|
- name: restart openhab
|
|
|
|
docker_container:
|
|
|
|
name: openhab
|
|
|
|
state: started
|
|
|
|
restart: yes
|