forked from Netz39_Admin/netz39-infra-ansible
Merge branch 'mosquitto'
This commit is contained in:
commit
9f3d1b65d9
2 changed files with 55 additions and 0 deletions
40
pottwal.yml
40
pottwal.yml
|
@ -4,6 +4,9 @@
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /usr/bin/python3
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
|
||||||
|
mosquitto_image: eclipse-mosquitto:1.6
|
||||||
|
mosquitto_data: /srv/data/mosquitto
|
||||||
|
|
||||||
openhab_image: openhab/openhab:2.5.10
|
openhab_image: openhab/openhab:2.5.10
|
||||||
openhab_data: /srv/data/openhab
|
openhab_data: /srv/data/openhab
|
||||||
openhab_host_port: 8081
|
openhab_host_port: 8081
|
||||||
|
@ -28,6 +31,37 @@
|
||||||
ports:
|
ports:
|
||||||
- 3142:3142
|
- 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: Make sure mosquitto config is there
|
||||||
|
template:
|
||||||
|
src: "templates/mosquitto.conf.j2"
|
||||||
|
dest: "{{ mosquitto_data }}/config/mosquitto.conf"
|
||||||
|
notify: restart_mosquitto
|
||||||
|
|
||||||
|
- name: Ensure mosquitto is running
|
||||||
|
docker_container:
|
||||||
|
name: mosquitto
|
||||||
|
image: "{{ mosquitto_image }}"
|
||||||
|
pull: true
|
||||||
|
state: started
|
||||||
|
ports:
|
||||||
|
- 1883:1883
|
||||||
|
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 the openhab directories exist
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
|
@ -81,3 +115,9 @@
|
||||||
name: openhab
|
name: openhab
|
||||||
state: started
|
state: started
|
||||||
restart: yes
|
restart: yes
|
||||||
|
|
||||||
|
- name: restart mosquitto
|
||||||
|
docker_container:
|
||||||
|
name: mosquitto
|
||||||
|
state: started
|
||||||
|
restart: yes
|
||||||
|
|
15
templates/mosquitto.conf.j2
Normal file
15
templates/mosquitto.conf.j2
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
user root
|
||||||
|
|
||||||
|
persistence true
|
||||||
|
persistence_location /mosquitto/data/
|
||||||
|
log_dest file /mosquitto/log/mosquitto.log
|
||||||
|
|
||||||
|
# Bridge to platon
|
||||||
|
connection br-pottwal-to-platon
|
||||||
|
address platon:1883
|
||||||
|
cleansession false
|
||||||
|
clientid br-pottwal-platon
|
||||||
|
start_type automatic
|
||||||
|
notifications false
|
||||||
|
try_private true
|
||||||
|
topic # in 2
|
Loading…
Reference in a new issue