diff --git a/README.md b/README.md index 6d65051e..fc7e368c 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,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 diff --git a/docs/applications/mosquitto.md b/docs/applications/mosquitto.md new file mode 100644 index 00000000..26da7021 --- /dev/null +++ b/docs/applications/mosquitto.md @@ -0,0 +1,10 @@ +# 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. + diff --git a/docs/configuration/application_ports.md b/docs/configuration/application_ports.md index 08fd7fa2..f0f8e848 100644 --- a/docs/configuration/application_ports.md +++ b/docs/configuration/application_ports.md @@ -21,6 +21,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 | | diff --git a/group_vars/all.yml.dist b/group_vars/all.yml.dist index 93ff1022..08a5dc04 100644 --- a/group_vars/all.yml.dist +++ b/group_vars/all.yml.dist @@ -74,6 +74,9 @@ firefly_enabled: false # Wallabag wallabag_enabled: false +# MQTT +mosquitto_enabled: false + ### ### General ### @@ -563,4 +566,9 @@ nzbget_group_id: 0 ### Wallabag ### wallabag_available_externally: "false" -wallabag_data_directory: "{{ docker_home }}/wallabag" \ No newline at end of file +wallabag_data_directory: "{{ docker_home }}/wallabag" + +### Mosquitto +### +mosquitto_available_externally: "false" +mosquitto_data_directory: "{{ docker_home }}/mosquitto" diff --git a/nas.yml b/nas.yml index 3754eea6..d9ab30f1 100644 --- a/nas.yml +++ b/nas.yml @@ -166,4 +166,8 @@ - import_tasks: tasks/wallabag.yml when: (wallabag_enabled | default(False)) - tags: wallabag \ No newline at end of file + tags: wallabag + + - import_tasks: tasks/mosquitto.yml + when: (mosquitto_enabled | default(False)) + tags: mosquitto diff --git a/tasks/mosquitto.yml b/tasks/mosquitto.yml new file mode 100644 index 00000000..1633f68f --- /dev/null +++ b/tasks/mosquitto.yml @@ -0,0 +1,32 @@ +- name: Create Mosquitto Directories + file: + path: "{{ item }}" + state: directory + 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: eclipse-mosquitto:latest + 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 diff --git a/templates/mosquitto/mosquitto.conf b/templates/mosquitto/mosquitto.conf new file mode 100644 index 00000000..ce7c5910 --- /dev/null +++ b/templates/mosquitto/mosquitto.conf @@ -0,0 +1,4 @@ +persistence true +persistence_location /mosquitto/data/ +log_dest file /mosquitto/log/mosquitto.log +