Setup mosquitto container on pottwal
This commit is contained in:
parent
4ec382e8bc
commit
5de7a25bfa
1 changed files with 40 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
|
||||||
|
|
Loading…
Reference in a new issue