From ad2225744f15f0e60c648e5eaa39bb3aa15b7d52 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Sat, 25 Jun 2022 18:15:52 +0200 Subject: [PATCH 1/4] Move mosquitto from pottwal to radon --- pottwal.yml | 41 ----------------------------------------- radon.yml | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/pottwal.yml b/pottwal.yml index 0494907..e856541 100644 --- a/pottwal.yml +++ b/pottwal.yml @@ -5,9 +5,6 @@ vars: ansible_python_interpreter: /usr/bin/python3 - mosquitto_image: eclipse-mosquitto:1.6 - mosquitto_data: /srv/data/mosquitto - openhab_image: openhab/openhab:2.5.11 openhab_data: /srv/data/openhab openhab_host_port: 8081 @@ -82,39 +79,6 @@ 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: 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 - - 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: Ensure the openhab directories exist file: path: "{{ item }}" @@ -219,8 +183,3 @@ proxy_port: "{{ shlink_host_port }}" handlers: - - name: restart mosquitto - docker_container: - name: mosquitto - state: started - restart: yes diff --git a/radon.yml b/radon.yml index 29967b0..ae789a7 100644 --- a/radon.yml +++ b/radon.yml @@ -5,11 +5,50 @@ vars: ansible_python_interpreter: /usr/bin/python3 + mosquitto_image: eclipse-mosquitto:1.6 + mosquitto_data: /srv/data/mosquitto + roles: - role: docker_setup vars: docker_data_root: "/srv/docker" tasks: + - 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 + - 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 handlers: + - name: restart mosquitto + docker_container: + name: mosquitto + state: started + restart: yes From 3496bcb48a06cf1fc76588c18e79f85c07362b06 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Sat, 25 Jun 2022 18:20:37 +0200 Subject: [PATCH 2/4] Rename MQTT bridge to reflect host change --- templates/mosquitto.conf.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/mosquitto.conf.j2 b/templates/mosquitto.conf.j2 index 64c7575..c5ff401 100644 --- a/templates/mosquitto.conf.j2 +++ b/templates/mosquitto.conf.j2 @@ -5,10 +5,10 @@ persistence_location /mosquitto/data/ log_dest file /mosquitto/log/mosquitto.log # Bridge to platon -connection br-pottwal-to-platon +connection br-radon-to-platon address platon:1883 cleansession false -clientid br-pottwal-platon +clientid br-radon-platon start_type automatic notifications false try_private true From 256c8c1c6c8267eeddddbd4dbe99f4f621bbe38b Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Sat, 25 Jun 2022 18:23:04 +0200 Subject: [PATCH 3/4] Fix handler name --- radon.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radon.yml b/radon.yml index ae789a7..ad42929 100644 --- a/radon.yml +++ b/radon.yml @@ -27,7 +27,7 @@ template: src: "templates/mosquitto.conf.j2" dest: "{{ mosquitto_data }}/config/mosquitto.conf" - notify: restart_mosquitto + notify: restart mosquitto - name: Ensure mosquitto is running docker_container: From 4f6a695ff767ca7760d869aade01f04775e4ce82 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Sat, 25 Jun 2022 18:27:53 +0200 Subject: [PATCH 4/4] Bump mosquitto version to 2.0.14 --- radon.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radon.yml b/radon.yml index ad42929..078499b 100644 --- a/radon.yml +++ b/radon.yml @@ -5,7 +5,7 @@ vars: ansible_python_interpreter: /usr/bin/python3 - mosquitto_image: eclipse-mosquitto:1.6 + mosquitto_image: eclipse-mosquitto:2.0.14 mosquitto_data: /srv/data/mosquitto roles: