trombik.mosquitto
ansible
Rolle mosquitto
Konfiguriere den Mosquitto MQTT-Server.
Anforderungen
Keine.
Rollenvariablen
Variable | Beschreibung | Standard |
---|---|---|
mosquitto_user |
Benutzername für Mosquitto | {{ __mosquitto_user }} |
mosquitto_group |
Gruppe für Mosquitto | {{ __mosquitto_group }} |
mosquitto_log_dir |
Verzeichnis für Logs (es muss log_dest auf Datei gesetzt werden) |
/var/log/mosquitto |
mosquitto_db_dir |
Speicherort für die Persistenz | {{ __mosquitto_db_dir }} |
mosquitto_service |
Dienstname von Mosquitto | mosquitto |
mosquitto_conf_dir |
Verzeichnis für Konfigurationsdateien | {{ __mosquitto_conf_dir }} |
mosquitto_conf_file |
Pfad zur mosquitto.conf |
{{ __mosquitto_conf_dir }}/mosquitto.conf |
mosquitto_package |
mosquitto |
|
mosquitto_pid_dir |
Pfad zum Verzeichnis der PID-Datei | {{ __mosquitto_pid_dir }} |
mosquitto_pid_file |
Pfad zur PID-Datei. Diese Variable hat keine Auswirkung auf RedHat. Im Debian-Familie kann diese Variable nicht vom Standard (/var/run/mosquitto.pid ) abweichen, da der Pfad im Startskript festgelegt ist. |
{{ mosquitto_pid_dir }}/mosquitto.pid |
mosquitto_flags |
Flags für das Startskript (derzeit nur für FreeBSD) | "" |
mosquitto_port |
Port zum Lauschen | 1883 |
mosquitto_bind_address |
Bind-Adresse | "" |
mosquitto_server |
Aktiviere und konfiguriere den Mosquitto-Server, wenn ja (oder ein beliebiger True -Wert). Setze mosquitto_server auf nein (oder False -Wert), wenn du den Mosquitto-Server nicht ausführen möchtest. |
ja |
mosquitto_extra_packages |
Liste von zusätzlichen Paketen zum Installieren (siehe unten) | [] |
mosquitto_wait_for_timeout |
Wie lange auf den Dienst gewartet werden soll oder Timeout in Sekunden für wait_for in Aufgaben und Handlern |
30 |
mosquitto_include_x509_certificate |
Wenn true , inkludiert das trombik.x509_certificate Ansible-Rolle während des Spiels |
nein |
mosquitto_extra_groups |
Liste von Gruppen, in die der Benutzer mosquitto_user hinzugefügt wird. Wenn die Gruppe nicht existiert, wird sie erstellt. |
[] |
mosquitto_config |
Inhalt von mosquitto.conf(5) |
"" |
mosquitto_acl_files |
Liste von ACL-Dateien (siehe unten) | [] |
mosquitto_accounts |
Liste von MQTT-Konten (siehe unten) | [] |
mosquitto_accounts_file |
Pfad zur MQTT-Kontodatenbankdatei | |
mosquitto_use_custom_systemd_service_file |
Installiere benutzerdefiniertes systemd -Dienstdatei (stammt von mosquitto-dev/mosquitto-ppa). Siehe unten |
false |
mosquitto_extra_packages
Dies ist eine Liste von Dictionären. Jedes Element repräsentiert ein zu installierendes (oder zu deinstallierendes) Paket.
Schlüssel | Beschreibung | Pflicht? |
---|---|---|
name |
Paketname | ja |
state |
Entweder present oder absent . present , wenn nicht angegeben |
nein |
mosquitto_acl_files
Dies ist eine Liste von Dictionären von ACL-Dateien, die erstellt oder gelöscht werden sollen.
Schlüssel | Beschreibung | Pflicht? |
---|---|---|
path |
Pfad zur ACL-Datei | ja |
state |
Entweder present oder absent |
ja |
content |
Der Inhalt der Datei | nein |
mosquitto_accounts
Dies ist eine Liste von MQTT-Konten, bestehend aus Benutzernamen und Passwort. Ein Element muss ein Dictionär mit den folgenden Schlüsseln sein.
Name | Beschreibung |
---|---|
name |
Name des MQTT-Kontos |
password |
Passwort des Kontos |
mosquitto_use_custom_systemd_service_file
Einige Distributionen installieren eine fehlerhafte systemd
-Dienstdatei für mosquitto
, die kein reload
unterstützt. Wenn diese Variable true
ist, installiert die Rolle eine, die reload
unterstützt. Die Datei ist identisch mit einer der Pakete von mosquitto-dev/mosquitto-ppa
.
Debian
---
__mosquitto_user: mosquitto
__mosquitto_group: mosquitto
__mosquitto_db_dir: "/var/lib/mosquitto"
__mosquitto_conf_dir: "/etc/mosquitto"
__mosquitto_pid_dir: "/run/mosquitto"
Devuan
---
__mosquitto_pid_dir: "/run/mosquitto"
FreeBSD
---
__mosquitto_user: nobody
__mosquitto_group: nobody
__mosquitto_db_dir: "/var/db/mosquitto"
__mosquitto_conf_dir: "/usr/local/etc/mosquitto"
__mosquitto_pid_dir: "/var/run/mosquitto"
OpenBSD
---
__mosquitto_user: _mosquitto
__mosquitto_group: _mosquitto
__mosquitto_db_dir: "/var/db/mosquitto"
__mosquitto_conf_dir: "/etc/mosquitto"
__mosquitto_pid_dir: "/var/run/mosquitto"
RedHat
---
__mosquitto_user: mosquitto
__mosquitto_group: mosquitto
__mosquitto_db_dir: "/var/lib/mosquitto"
__mosquitto_conf_dir: "/etc/mosquitto"
__mosquitto_pid_dir: "/var/run/mosquitto"
Ubuntu
---
__mosquitto_pid_dir: "/run/mosquitto"
Abhängigkeiten
Keine.
Beispiel Playbook
---
- hosts: localhost
roles:
- name: trombik.redhat_repo
when:
- ansible_distribution == 'CentOS'
- name: trombik.apt_repo
when:
- ansible_distribution == 'Ubuntu'
- name: ansible-role-mosquitto
vars:
ca_cert_file: "{{ mosquitto_conf_dir }}/certs/ca.pem"
mosquitto_include_x509_certificate: ja
mosquitto_bind_address: "{{ ansible_default_ipv4.address }}"
mosquitto_extra_groups:
- name: cert
mosquitto_acl_files:
- name: meine acl
path: "{{ mosquitto_conf_dir }}/my.acl"
state: present
content: |
topic readwrite public/#
topic read public_read/#
topic write public_write/#
user foo
topic read $SYS/#
topic readwrite foo/#
user bar
topic read $SYS/#
topic readwrite bar/#
user admin
topic read $SYS/#
topic readwrite foo/#
topic readwrite bar/#
mosquitto_accounts:
- name: foo
password: "$6$J8WUb3oFK94I6be3$lTvSR9GPnSZUhg0W0chY2rVcmY04sxGrLBq0it0j0zFiud/S2G8wooFaDVN2xJGGz/FoGk3HO0V4wvd8hlBvcw=="
- name: bar
password: "$6$J8WUb3oFK94I6be3$lTvSR9GPnSZUhg0W0chY2rVcmY04sxGrLBq0it0j0zFiud/S2G8wooFaDVN2xJGGz/FoGk3HO0V4wvd8hlBvcw=="
- name: admin
password: "$6$J8WUb3oFK94I6be3$lTvSR9GPnSZUhg0W0chY2rVcmY04sxGrLBq0it0j0zFiud/S2G8wooFaDVN2xJGGz/FoGk3HO0V4wvd8hlBvcw=="
mosquitto_config: |
user {{ mosquitto_user }}
{% if ansible_os_family != 'Debian' %}
pid_file {{ mosquitto_pid_file }}
{% endif %}
log_dest syslog
autosave_interval 1800
persistence true
persistence_location {{ mosquitto_db_dir }}/
persistence_file mosquitto.db
allow_anonymous true
acl_file {{ mosquitto_conf_dir }}/my.acl
# einfacher MQTT
listener {{ mosquitto_port }} {{ mosquitto_bind_address }}
# MQTT/TLS
listener 8883 {{ mosquitto_bind_address }}
cafile {{ ca_cert_file }}
keyfile {{ mosquitto_conf_dir }}/certs/private/mosquitto.key
certfile {{ mosquitto_conf_dir }}/certs/public/mosquitto.pub
tls_version tlsv1.2
x509_certificate_debug_log: ja
x509_certificate:
- name: ca
state: present
public:
path: "{{ ca_cert_file }}"
key: |
-----BEGIN CERTIFICATE-----
MIIDkTCCAnmgAwIBAgIUYVw5fBR144JGJrXP90d8KxMkkFIwDQYJKoZIhvcNAQEL
BQAwWDELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDERMA8GA1UEAwwIZHVtbXkuY2EwHhcN
MjAwODA4MDYxOTU0WhcNMjUwODA4MDYxOTU0WjBYMQswCQYDVQQGEwJBVTETMBEG
A1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkg
THRkMREwDwYDVQQDDAhkdW1teS5jYTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBAOe2IYvs5VWLs83VkGN0Geub3me1dRB/QFzyuykhAG1S7BqRkd37EjpZ
9DcLKifiLohWWooB63irip8cf/ThFSLSsaQDKUoVKcFNEZg/uKaEGZ21nUnFcFcc
rPjJBpAj4T1TDRGv911Zxcqu/OwYBwlgbVGQgA25PvFauB56WdzXhLvA0dPlvNA6
4wscJyAmkF5BIBHArdxHzDZXvQMMC2xZOUeuaaS2sVbia1k3n31kkgrMHa4Q8BVa
WN883Jz3kwp2344N9EkP25r45azyEHbc91JDwkJH7HYBJS6zxIx09SJ5BZH6JIgf
OnOf8NrMCrlGAoWKD8jYK4UOSvbCE6sCAwEAAaNTMFEwHQYDVR0OBBYEFKMCHquf
WmJtOxGayRQT5DUsWj2uMB8GA1UdIwQYMBaAFKMCHqufWmJtOxGayRQT5DUsWj2u
MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAEoQZg61krEA9OlB
bZ1jcTSsW6sSIA+ectMr9+f579WwDpwtR/7Vgh660SxQxMCbir4u6m7dwJD+4bnW
29iZidxXshJXh0g/g/0aF2AdnaQR9euS7uyW5iVtNC2IPFR83zyaJ4B8hBjvR99O
Ex9LHdGUetuykFq6KjaaX+rh1DlUE7epiUiTfp7BVwa/UkFgBSpYG4c++Hj4+IbZ
Uy+krYdt1BJTshfo0LuMumdy7+6+Kipi44xqzof8XRHWG8rcUKSASc/kUSdeAZXn
uEZvvmJ7x3ijvrwXZunuL96Q6llo/WvRIMTMnKhBgOuM48g338wWaSQbAH4j8y+k
o4Wxowc=
-----END CERTIFICATE-----
- name: mosquitto
state: present
public:
path: "{{ mosquitto_conf_dir }}/certs/public/mosquitto.pub"
mode: "0444"
owner: "{{ mosquitto_user }}"
group: "{{ mosquitto_group }}"
key: |
-----BEGIN CERTIFICATE-----
MIIDMzCCAhsCFHw5MqZ+KtGCX1lvV5JWp8aSBbQNMA0GCSqGSIb3DQEBCwUAMFgx
CzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRl
cm5ldCBXaWRnaXRzIFB0eSBMdGQxETAPBgNVBAMMCGR1bW15LmNhMB4XDTIwMDgw
ODA2MjExMVoXDTMwMDgwNjA2MjExMVowVDELMAkGA1UEBhMCQVUxEzARBgNVBAgM
ClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEN
MAsGA1UEAwwEbXF0dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANtK
v+eJMWHfvn9LIa5kWNctYLh7v0WBMD2f6kpzuKAQWRQFb/IHsVxbyfxAZyMD4Gek
s9PPx8T7+p+zWg+gW2OxpT8/p81EQ5fgF+dKCcaMFaeBZPdFFiPLCko6uzTlPCi0
sni+6IkxjTxitfx9YaDl7+YSwKXSaJaLzQ94ZeaqwdwCBgGuM3ArhCrag9DxYYVs
RmXleGDfaQDZkBMuxR05nWiaxMrU1cvIs856NEFmyR002nwAflfQjPxfwgRuaM6M
5iXr6wZV6arnYqJsHRYeg7B+evMXWpOILfhq8hbNR4n3fRDbFFz88s4c93306VyU
dXeBvd2Cbz3YGoF16GUCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAPEFozRwEvN9a
TzaFBqHzyfgYQewkbIWnvfif8Gdo6o6UeO5nMwHtU02UXcbcVLr0seeNqLfWQpP3
DnSY76qwiKtKjVDRfI3wToFIaYDqbgzj8PWdcjty6Pfp/w1CkK0bWtZwBQcno0U7
05xJFkuszKmzDZCOePyesMURZU6zHBNIWP7FttvwhjPeeo7fgBd5CCLiyMf8gQIt
lfEupV6nHWIGQOwQQBWRyYKltRla2Ugw9zEnDmjbSeNdGOHHeietMfhZKXxAuMkS
lfipiXzwyi0NBFHZJBf/rVy6TnIsWcppTcgBlDMhpC6I54rjo5+t6xNk470boBt4
ZVzvKkfJcw==
-----END CERTIFICATE-----
secret:
path: "{{ mosquitto_conf_dir }}/certs/private/mosquitto.key"
owner: "{{ mosquitto_user }}"
group: "{{ mosquitto_group }}"
mode: "0440"
key: |
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA20q/54kxYd++f0shrmRY1y1guHu/RYEwPZ/qSnO4oBBZFAVv
8gexXFvJ/EBnIwPgZ6Sz08/HxPv6n7NaD6BbY7GlPz+nzURDl+AX50oJxowVp4Fk
90UWI8sKSjq7NOU8KLSyeL7o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
ks8Hy8N4vgOHhQ2CQyekQQKBgQCq4lreSRg49PsbB2ec9SMYiS1xaIa0ZxAo0LDa
Qg9agFxJjszDtzmkgd0dLPVi9WJDVlqr2zTq2RPP5RuuN0tlUAEQBLqX+AZHmCa1
SIv70kaGHsSNPautXEpWsMaf8qg9UcJo2EeijR6OIoKfaUxZJGSoba7RorlDKAGy
UIKpMQKBgFdu5VdxvY8OcDDJGyUQ7cfbEgGy21f4ECZKnILkuy8MndFi/nYRbXIx
fTYVEghz0n7btIpisSc6HPg3sJQh7BLH8ByUFdFHP9k6uxHxMHZt+4q62ZsGGt4k
y2b3dRsFCRR+2bED8QtHL6HHd7uBhz5Qbvpwu1ZceMCY14qUwNk3
-----END RSA PRIVATE KEY-----
redhat_repo_extra_packages:
- epel-release
apt_repo_to_add:
- ppa:mosquitto-dev/mosquitto-ppa
Lizenz
Copyright (c) 2017 Tomoyuki Sakurai <y@trombik.org>
Erlaubnis zur Nutzung, Kopie, Modifikation und Verteilung dieser Software für jeden Zweck, mit oder ohne Gebühr, wird hiermit gewährt, vorausgesetzt, dass der oben genannte Urheberrechtshinweis und diese Erlaubnis in allen Kopien erscheinen.
DIE SOFTWARE WIRD "WIE BESEHEN" BEREITGESTELLT UND DER AUTOR LEHNT ALLE GARANTIEN IM HINSICHT AUF DIESE SOFTWARE AB, EINSCHLIESSLICH ALLER IMPLIZITEN GARANTIEN DER MARKTFÄHIGKEIT UND EIGNUNG. IN KEINEM FALL HAFTET DER AUTOR FÜR BESONDERE, DIREKTE, INDIREKTE ODER FOLGESCHÄDEN ODER FÜR IRGENDEINE SCHÄDEN, DIE AUS DEM VERLUST VON NUTZUNG, DATEN ODER GEWINNEN RESULTIEREN, OB IN EINER KLAGE AUS VERTRAG, FAHRLÄSSIGKEIT ODER ANDERER UNRECHTMÄẞIGER HANDLUNG, DIE AUS ODER IN VERBINDUNG MIT DER NUTZUNG ODER LEISTUNG DIESER SOFTWARE ENTSTEHEN.
Autoreninformation
Tomoyuki Sakurai y@trombik.org
Diese README wurde von qansible erstellt.
ansible-galaxy install trombik.mosquitto