38 lines
912 B
YAML
38 lines
912 B
YAML
|
---
|
||
|
- getent:
|
||
|
database: passwd
|
||
|
key: "{{ nodered_user }}"
|
||
|
split: ":"
|
||
|
|
||
|
# Tasks for Node-RED role
|
||
|
- name: Pull Node Red image
|
||
|
docker_image:
|
||
|
name: "{{ nodered_image }}"
|
||
|
source: pull
|
||
|
force_source: yes
|
||
|
|
||
|
- name: Ensure Node Red Directory exists
|
||
|
file:
|
||
|
path: "{{ nodered_directory }}"
|
||
|
state: directory
|
||
|
group: "{{ nodered_user }}"
|
||
|
owner: "{{ nodered_user }}"
|
||
|
mode: 0755
|
||
|
|
||
|
- name: Create Node Red container
|
||
|
docker_container:
|
||
|
name: "{{ nodered_container }}"
|
||
|
image: "{{ nodered_image }}"
|
||
|
state: started
|
||
|
restart_policy: "unless-stopped"
|
||
|
user: "{{ getent_passwd[nodered_user][1] }}:{{ getent_passwd[nodered_user][2] }}"
|
||
|
env:
|
||
|
TZ: "Asia/Kolkata"
|
||
|
links:
|
||
|
- "{{ mosquitto_container }}:mqtt"
|
||
|
- "{{ influx_container }}:influx"
|
||
|
published_ports:
|
||
|
- 127.0.0.1:1880:1880
|
||
|
volumes:
|
||
|
- "{{ nodered_directory }}:/data"
|