Skip to content

sansible/mosquitto

Repository files navigation

Mosquitto

Master: Build Status
Develop: Build Status

This roles installs Oracle, tested on Mosquitto 1.6.x.

Installation and Dependencies

This role has no dependencies.

To install run ansible-galaxy install sansible.mosquitto or add this to your roles.yml

- name: sansible.mosquitto
  version: v3.0

and run ansible-galaxy install -p ./roles -r roles.yml

Tags

This role uses two tags: build and configure

  • build - Installs Mosquitto.
  • configure - Configures Mosquitto.

Settings

# Whether to install mosquitto_pub and _sub cmds
sansible_mosquitto_install_clients: no
sansible_mosquitto_version: 1.6.*
sansible_mosquitto_aws_enabled: yes
sansible_mosquitto_aws_region: eu-west-1
# List of files that need to be copied and secured from S3
# These should be things like TLS files
sansible_mosquitto_aws_s3_files:
  - bucket: config-bucket
    path: /mosquitto/tls/ca.crt
    dest: /etc/mosquitto/certs/ca.crt
    mode: "0600"
  - bucket: config-bucket
    path: /mosquitto/tls/server.crt
    dest: /etc/mosquitto/certs/server.crt
    mode: "0600"
  - bucket: config-bucket
    path: /mosquitto/tls/server.key
    dest: /etc/mosquitto/certs/server.key
    mode: "0600"
# All key/value pairs under sansible_mosquitto_settings will be added to 
# `/etc/mosquitto/conf.d/mosquitto.local.conf`
sansible_mosquitto_settings:
  allow_anonymous: yes
  persistence: yes
sansible_mosquitto_user_list:
  # Format is username: password, passwords must be generated using mosquitto_passwd
  # sansible_mosquitto_password_file must be defined if you want to enable users
  user_one: hash
  user_two: hash

Examples

To simply install Mosquitto:

- name: Install Mosquitto
  hosts: sandbox

  roles:
    - name: sansible.mosquitto

Overriding some settings:

- name: Install Mosquitto with alternate port
  hosts: sandbox

  roles:
    - name: sansible.mosquitto
      sansible_mosquitto_settings:
        port: 8000

To set up with a password file:

- name: Install Mosquitto with username/password file
  hosts: sandbox

  roles:
    - name: sansible.mosquitto
      sansible_mosquitto_settings:
        allow_anonymous: "false"
      sansible_mosquitto_password_file: /etc/mosquitto/passwd
      sansible_mosquitto_user_list:
        user_one: hash
        user_two: hash

This will create a password file with the username/password hash sansible_mosquitto_user_list. Note that the sansible_mosquitto_password_file variable must be set.

Passwords should be hashes generated by the mosquitto_passwd utility