forked from Netz39_Admin/netz39-infra-ansible
Add openhab in docker container to pottwal
This commit is contained in:
parent
c5dac00a36
commit
d323a09f2b
1 changed files with 52 additions and 0 deletions
52
pottwal.yml
52
pottwal.yml
|
@ -4,6 +4,12 @@
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /usr/bin/python3
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: docker_setup
|
- role: docker_setup
|
||||||
vars:
|
vars:
|
||||||
|
@ -11,3 +17,49 @@
|
||||||
- role: apache
|
- role: apache
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- 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"
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: restart openhab
|
||||||
|
docker_container:
|
||||||
|
name: openhab
|
||||||
|
state: started
|
||||||
|
restart: yes
|
||||||
|
|
Loading…
Reference in a new issue