| 1 |
--- |
| 2 |
# Copyright (c) Ansible Project |
| 3 |
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 4 |
# SPDX-License-Identifier: GPL-3.0-or-later |
| 5 |
|
| 6 |
- name: Install pip packages |
| 7 |
pip: |
| 8 |
name: paho-mqtt>=1.4.0 |
| 9 |
state: present |
| 10 |
|
| 11 |
- name: MQTT non-TLS endpoint |
| 12 |
mqtt: |
| 13 |
topic: /node/s/bar/blurb |
| 14 |
payload: foo |
| 15 |
qos: 1 |
| 16 |
client_id: me001 |
| 17 |
register: result |
| 18 |
|
| 19 |
- assert: |
| 20 |
that: |
| 21 |
- result is success |
| 22 |
|
| 23 |
- name: Send a test message to TLS1.1 endpoint, no client version specified |
| 24 |
mqtt: |
| 25 |
topic: /node/s/bar/blurb |
| 26 |
payload: foo-tls |
| 27 |
qos: 1 |
| 28 |
client_id: me001 |
| 29 |
ca_certs: /tls/ca_certificate.pem |
| 30 |
certfile: /tls/client_certificate.pem |
| 31 |
keyfile: /tls/client_key.pem |
| 32 |
port: 8883 |
| 33 |
register: result |
| 34 |
|
| 35 |
- assert: |
| 36 |
that: |
| 37 |
- result is success |
| 38 |
|
| 39 |
- name: Send a test message to TLS1.2 endpoint, no client version specified |
| 40 |
mqtt: |
| 41 |
topic: /node/s/bar/blurb |
| 42 |
payload: foo-tls |
| 43 |
qos: 1 |
| 44 |
client_id: me001 |
| 45 |
ca_certs: /tls/ca_certificate.pem |
| 46 |
certfile: /tls/client_certificate.pem |
| 47 |
keyfile: /tls/client_key.pem |
| 48 |
port: 8884 |
| 49 |
register: result |
| 50 |
|
| 51 |
- assert: |
| 52 |
that: |
| 53 |
- result is success |
| 54 |
|
| 55 |
# TODO(Uncomment when TLS1.3 is supported in moquitto and ubuntu version) |
| 56 |
# |
| 57 |
# - name: Send a test message to TLS1.3 endpoint |
| 58 |
# mqtt: |
| 59 |
# topic: /node/s/bar/blurb |
| 60 |
# payload: foo-tls |
| 61 |
# qos: 1 |
| 62 |
# client_id: me001 |
| 63 |
# ca_certs: /tls/ca_certificate.pem |
| 64 |
# certfile: /tls/client_certificate.pem |
| 65 |
# keyfile: /tls/client_key.pem |
| 66 |
# port: 8885 |
| 67 |
# register: result |
| 68 |
|
| 69 |
# - assert: |
| 70 |
# that: |
| 71 |
# - result is success |
| 72 |
|
| 73 |
- name: Send a message, client TLS1.1, server (required) TLS1.2 - Expected failure |
| 74 |
mqtt: |
| 75 |
topic: /node/s/bar/blurb |
| 76 |
payload: foo-tls |
| 77 |
qos: 1 |
| 78 |
client_id: me001 |
| 79 |
ca_certs: /tls/ca_certificate.pem |
| 80 |
certfile: /tls/client_certificate.pem |
| 81 |
keyfile: /tls/client_key.pem |
| 82 |
tls_version: tlsv1.1 |
| 83 |
port: 8884 |
| 84 |
register: result |
| 85 |
failed_when: result is success |
| 86 |
|
| 87 |
- assert: |
| 88 |
that: |
| 89 |
- result is success |
| 90 |
|
| 91 |
# TODO(Uncomment when TLS1.3 is supported in moquitto and ubuntu version) |
| 92 |
# |
| 93 |
# - name: Send a message, client TLS1.1, server (required) TLS1.3 - Expected failure |
| 94 |
# mqtt: |
| 95 |
# topic: /node/s/bar/blurb |
| 96 |
# payload: foo-tls |
| 97 |
# qos: 1 |
| 98 |
# client_id: me001 |
| 99 |
# ca_certs: /tls/ca_certificate.pem |
| 100 |
# certfile: /tls/client_certificate.pem |
| 101 |
# keyfile: /tls/client_key.pem |
| 102 |
# tls_version: tlsv1.1 |
| 103 |
# port: 8885 |
| 104 |
# register: result |
| 105 |
# failed_when: result is success |
| 106 |
|
| 107 |
# - assert: |
| 108 |
# that: |
| 109 |
# - result is success |
| 110 |
|
| 111 |
- name: Send a message, client TLS1.2, server (required) TLS1.1 - Expected failure |
| 112 |
mqtt: |
| 113 |
topic: /node/s/bar/blurb |
| 114 |
payload: foo-tls |
| 115 |
qos: 1 |
| 116 |
client_id: me001 |
| 117 |
ca_certs: /tls/ca_certificate.pem |
| 118 |
certfile: /tls/client_certificate.pem |
| 119 |
keyfile: /tls/client_key.pem |
| 120 |
tls_version: tlsv1.2 |
| 121 |
port: 8883 |
| 122 |
register: result |
| 123 |
failed_when: result is success |
| 124 |
|
| 125 |
- assert: |
| 126 |
that: |
| 127 |
- result is success |
| 128 |
|
| 129 |
# TODO(Uncomment when TLS1.3 is supported in moquitto and ubuntu version) |
| 130 |
# |
| 131 |
# - name: Send a message, client TLS1.2, server (required) TLS1.3 - Expected failure |
| 132 |
# mqtt: |
| 133 |
# topic: /node/s/bar/blurb |
| 134 |
# payload: foo-tls |
| 135 |
# qos: 1 |
| 136 |
# client_id: me001 |
| 137 |
# ca_certs: /tls/ca_certificate.pem |
| 138 |
# certfile: /tls/client_certificate.pem |
| 139 |
# keyfile: /tls/client_key.pem |
| 140 |
# tls_version: tlsv1.2 |
| 141 |
# port: 8885 |
| 142 |
# register: result |
| 143 |
# failed_when: result is success |
| 144 |
|
| 145 |
# - assert: |
| 146 |
# that: |
| 147 |
# - result is success |