Merge pull request 'Add Node-RED container on Radon' (!59) from radon-nodered into master

Reviewed-on: https://gitea.n39.eu/Netz39_Admin/netz39-infra-ansible/pulls/59
Reviewed-by: dkdent <dkdent@netz39.de>
This commit is contained in:
Stefan Haun 2022-07-30 17:47:36 +00:00
commit 346cc41148

View file

@ -10,6 +10,9 @@
mosquitto_image: eclipse-mosquitto:2.0.14 mosquitto_image: eclipse-mosquitto:2.0.14
mosquitto_data: "{{ data_dir }}/mosquitto" mosquitto_data: "{{ data_dir }}/mosquitto"
nodered_image: nodered/node-red:3.0.1-1-18
nodered_data: "{{ data_dir }}/nodered"
roles: roles:
- role: docker_setup - role: docker_setup
vars: vars:
@ -48,6 +51,34 @@
keep_volumes: yes keep_volumes: yes
restart_policy: unless-stopped restart_policy: unless-stopped
- name: Check if nodered data dir exists
ansible.builtin.stat:
path: "{{ data_dir }}/nodered"
register: nodered_dir
- name: Fail if nodered data dir does not exist
ansible.builtin.fail:
msg: "Nodered data dir is missing, please restore from the backup!"
when: not nodered_dir.stat.exists
- name: Ensure nodered is running
docker_container:
name: nodered
image: "{{ nodered_image }}"
pull: true
state: started
env:
TZ: Europe/Berlin
NODE_RED_ENABLE_PROJECTS: "true"
ports:
# - 127.0.0.1:9002:1880
- 9002:1880
volumes:
- "{{ nodered_data }}/data:/data"
detach: yes
keep_volumes: yes
restart_policy: unless-stopped
handlers: handlers:
- name: restart mosquitto - name: restart mosquitto
docker_container: docker_container: