Add mosquitto

This commit is contained in:
Sam Maes 2019-05-01 14:23:11 +02:00
parent 84e0c96922
commit 146940773a
8 changed files with 93 additions and 0 deletions

View file

@ -42,6 +42,7 @@ Ansible config and a bunch of Docker containers.
* [Jackett](https://github.com/Jackett/Jackett) - API Support for your favorite torrent trackers
* [MiniDlna](https://sourceforge.net/projects/minidlna/) - simple media server which is fully compliant with DLNA/UPnP-AV clients
* [Miniflux](https://miniflux.app/) - An RSS news reader
* [Mosquitto](https://mosquitto.org) - An open source MQTT broker
* [MyMediaForAlexa](https://www.mymediaalexa.com/) - Lets you stream your music collection to your alexa device
* [Netdata](https://my-netdata.io/) - An extremely comprehensive system monitoring solution
* [Nextcloud](https://nextcloud.com/) - A self-hosted Dropbox alternative

View file

@ -0,0 +1,13 @@
# Mosquitto
Homepage: [https://mosquitto.org](https://mosquitto.org)
Mosquitto is a lightweight open source MQTT message broker.
## Usage
Set `mosquitto_enabled: true` in your `group_vars/all.yml` file.
## Specific Configuration
You can change the mosquitto.conf template to change the default configuration.

View file

@ -20,6 +20,8 @@ By default, applications can be found on the ports listed below.
| Jackett | 9117 | |
| MiniDLNA | 8201 | |
| Miniflux | 8070 | |
| Mosquitto | 1883 | MQTT |
| Mosquitto | 9001 | Websocket |
| MyMediaForAlexa | 52051 | |
| Netdata | 19999 | |
| Nextcloud | 8080 | |

View file

@ -64,6 +64,9 @@ thelounge_enabled: false
# Password Management
bitwarden_enabled: false
# MQTT
mosquitto_enabled: false
###
### General
###
@ -525,3 +528,10 @@ bitwarden_admin_token: qwertyuiop1234567890poiuytrewq0987654321
# Once you have created your user, set to "false" and run one more time.
# Target just Bitwarden by running: ansible-playbook -i inventory nas.yml -b -K -t bitwarden
bitwarden_allow_signups: false
###
### Mosquitto
###
mosquitto_available_externally: "false"
mosquitto_docker_image: eclipse-mosquitto:latest
mosquitto_data_directory: "{{ docker_home }}/mosquitto"

View file

@ -151,3 +151,7 @@
- import_tasks: tasks/bitwarden.yml
when: (bitwarden_enabled | default(False))
tags: bitwarden
- import_tasks: tasks/mosquitto.yml
when: (mosquitto_enabled | default(False))
tags: mosquitto

56
tasks/mosquitto.yml Normal file
View file

@ -0,0 +1,56 @@
---
- name: Create Mosquitto group
group:
name: mosquitto
gid: 1311
state: present
- name: Create Mosquitto user
user:
name: mosquitto
uid: 1311
state: present
system: yes
update_password: on_create
create_home: no
group: mosquitto
- name: Create Mosquitto Directories
file:
path: "{{ item }}"
state: directory
owner: mosquitto
group: mosquitto
with_items:
- "{{ mosquitto_data_directory }}/config"
- "{{ mosquitto_data_directory }}/data"
- "{{ mosquitto_data_directory }}/log"
- name: Template mosquitto.conf
template:
src: mosquitto/mosquitto.conf
dest: "{{ mosquitto_data_directory }}/config/mosquitto.conf"
- name: Create Mosquitto container
docker_container:
name: mosquitto
image: "{{ mosquitto_docker_image }}"
pull: true
volumes:
- "{{ mosquitto_data_directory }}:/config:rw"
- "{{ mosquitto_data_directory }}:/data:rw"
- "{{ mosquitto_data_directory }}:/log:rw"
env:
PUID: 1311
PGID: 1311
TZ: "{{ ansible_nas_timezone }}"
ports:
- "1883:1883"
- "9001:9001"
restart_policy: unless-stopped
memory: 1g
labels:
traefik.backend: "mosquitto"
traefik.frontend.rule: "Host:mosquitto.{{ ansible_nas_domain }}"
traefik.enable: "{{ mosquitto_available_externally }}"
traefik.port: "80"

View file

@ -0,0 +1,6 @@
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
#listener 9001
#protocol websockets

View file

@ -191,6 +191,7 @@ onDemand = false # create certificate when container is created
"heimdall.{{ ansible_nas_domain }}",
"jackett.{{ ansible_nas_domain }}",
"miniflux.{{ ansible_nas_domain }}",
"mosquitto.{{ ansible_nas_domain }}",
"netdata.{{ ansible_nas_domain }}",
"nextcloud.{{ ansible_nas_domain }}",
"plex.{{ ansible_nas_domain }}",