Install node-red
. The role installs node-red
using npm
.
node-red
itself does not support granular logging outputs, but simple logging
to a file. The role configures node-red
to log all console outputs to
syslog
, which is not very pretty (duplicated time stamp).
nodejs
andnpm
(usetrombik.nodejs
)
Variable | Description | Default |
---|---|---|
node_red_user |
User of node-red |
node-red |
node_red_group |
Group of node-red |
node-red |
node_red_service |
Service name of node-red |
node_red |
node_red_package |
npm package name of node-red |
node-red |
node_red_db_dir |
Path to a directory where files are kept | {{ __node_red_db_dir }} |
node_red_conf_dir |
Path to base directory of settings.js |
{{ __node_red_conf_dir }} |
node_red_conf_file |
Path to settings.js |
{{ node_red_conf_dir }}/settings.js |
node_red_extra_packages |
A list of dict to install extra packages (see below) | [] |
node_red_extra_npm_packages |
A list of dict to install extra npm packages (see below) |
[] |
node_red_bind_address |
Address and port that node-red listens on (used in play to ensure the daemon is running and ready) |
127.0.0.1:1880 |
node_red_config |
Content of settings.js |
"" |
node_red_flags |
(not implemented yet) | "" |
A list of extra packages to install.
A list of dict to install extra npm
packages.
Key | Description | Mandatory? |
---|---|---|
name |
Name of the package | Yes |
state |
State of the package. The value should be one of supported state value of ansible npm module, such as present . |
No |
Variable | Default |
---|---|
__node_red_db_dir |
/var/lib/node-red |
__node_red_conf_dir |
/etc/node-red |
Variable | Default |
---|---|
__node_red_db_dir |
/var/db/node-red |
__node_red_conf_dir |
/usr/local/etc/node-red |
None
- hosts: localhost
roles:
- name: trombik.apt_repo
when: ansible_os_family == 'Debian'
- name: trombik.nodejs
- name: ansible-role-node_red
vars:
apt_repo_keys_to_add:
- https://deb.nodesource.com/gpgkey/nodesource.gpg.key
apt_repo_enable_apt_transport_https: yes
apt_repo_to_add:
- "deb https://deb.nodesource.com/node_12.x {{ ansible_distribution_release }} main"
os_nodejs_package:
FreeBSD: www/node12
Debian: "{{ __nodejs_package }}"
RedHat: "{{ __nodejs_package }}"
OpenBSD: "{{ __nodejs_package }}"
nodejs_package: "{{ os_nodejs_package[ansible_os_family] }}"
os_nodejs_npm_package:
FreeBSD: www/npm-node12
Debian: "{{ __nodejs_package }}"
RedHat: "{{ __nodejs_package }}"
OpenBSD: "{{ __nodejs_package }}"
nodejs_npm_package: "{{ os_nodejs_npm_package[ansible_os_family] }}"
node_red_extra_packages:
- zsh
node_red_extra_npm_packages:
- name: node-red-contrib-influxdb
state: present
node_red_config: |
module.exports = {
uiPort: {{ node_red_bind_address.split(':')[1] }},
mqttReconnectTime: 15000,
serialReconnectTime: 15000,
debugMaxLength: 1000,
functionGlobalContext: {},
logging: {
console: {
level: "info",
metrics: false,
audit: false
}
},
editorTheme: {
projects: {
enabled: false
}
},
}
Copyright (c) 2018 Tomoyuki Sakurai <y@trombik.org>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Tomoyuki Sakurai y@trombik.org
This README was created by qansible