azure_rm_iothub – Manage Azure IoT hub¶
New in version 2.9.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.7
azure >= 2.0.0
Parameters¶
Notes¶
Note
For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with
az login
.Authentication is also possible using a service principal or Active Directory user.
To authenticate via service principal, pass subscription_id, client_id, secret and tenant or set environment variables AZURE_SUBSCRIPTION_ID, AZURE_CLIENT_ID, AZURE_SECRET and AZURE_TENANT.
To authenticate via Active Directory user, pass ad_user and password, or set AZURE_AD_USER and AZURE_PASSWORD in the environment.
Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription_id, client_id, secret and tenant or subscription_id, ad_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE_PROFILE in the environment.
See Also¶
See also
- Sign in with Azure CLI
How to authenticate using the
az login
command.
Examples¶
- name: Create a simplest IoT hub
azure_rm_iothub:
name: Testing
resource_group: myResourceGroup
- name: Create an IoT hub with route
azure_rm_iothub:
resource_group: myResourceGroup
name: Testing
routing_endpoints:
- connection_string: "Endpoint=sb://qux.servicebus.windows.net/;SharedAccessKeyName=quux;SharedAccessKey=****;EntityPath=myQueue"
name: foo
resource_type: queue
resource_group: myResourceGroup1
routes:
- name: bar
source: device_messages
endpoint_name: foo
enabled: yes
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | ||
---|---|---|---|---|
cloud_to_device
complex
|
success |
Cloud to device message properties.
|
||
max_delivery_count
integer
|
success |
The number of times the IoT hub attempts to deliver a message on the feedback queue.
See Sample:
10
|
||
ttl_as_iso8601
string
|
success |
The period of time for which a message is available to consume before it is expired by the IoT hub.
See Sample:
1:00:00
|
||
enable_file_upload_notifications
boolean
|
success |
Whether file upload notifications are enabled.
Sample:
True
|
||
event_endpoints
complex
|
success |
Built-in endpoint where to deliver device message.
|
||
endpoint
string
|
success |
The Event Hub-compatible endpoint.
Sample:
sb://iothub-ns-testing-1478811-9bbc4a15f0.servicebus.windows.net/
|
||
partition_count
integer
|
success |
The number of partitions for receiving device-to-cloud messages in the Event Hub-compatible endpoint.
See Sample:
2
|
||
partition_ids
list
|
success |
List of the partition id for the event endpoint.
Sample:
['0', '1']
|
||
retention_time_in_days
integer
|
success |
The retention time for device-to-cloud messages in days.
See Sample:
1
|
||
host_name
string
|
success |
Host of the IoT hub.
Sample:
testing.azure-devices.net
|
||
id
string
|
success |
Resource ID of the IoT hub.
Sample:
/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/Testing
|
||
ip_filters
complex
|
success |
Configure rules for rejecting or accepting traffic from specific IPv4 addresses.
|
||
action
string
|
success |
The desired action for requests captured by this rule.
Sample:
Reject
|
||
ip_mask
string
|
success |
A string that contains the IP address range in CIDR notation for the rule.
Sample:
40.54.7.3
|
||
name
string
|
success |
Name of the filter.
Sample:
filter
|
||
location
string
|
success |
Location of the IoT hub.
Sample:
eastus
|
||
name
string
|
success |
Name of the IoT hub.
Sample:
Testing
|
||
resource_group
string
|
success |
Resource group of the IoT hub.
Sample:
myResourceGroup.
|
||
routes
complex
|
success |
Route device-to-cloud messages to service-facing endpoints.
|
||
condition
boolean
|
success |
The query expression for the routing query that is run against the message application properties, system properties, message body, device twin tags, and device twin properties to determine if it is a match for the endpoint.
For more information about constructing a query, see https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-routing-query-syntax
Sample:
true
|
||
enabled
string
|
success |
Whether to enable the route.
Sample:
True
|
||
endpoint_name
string
|
success |
The name of the endpoint in
routing_endpoints where IoT Hub sends messages that match the query.Sample:
foo
|
||
name
string
|
success |
Name of the route.
Sample:
route1
|
||
source
string
|
success |
The origin of the data stream to be acted upon.
Sample:
device_messages
|
||
routing_endpoints
complex
|
success |
Custom endpoints.
|
||
event_hubs
complex
|
success |
List of custom endpoints of event hubs.
|
||
connection_string
string
|
success |
Connection string of the custom endpoint.
Sample:
Endpoint=sb://quux.servicebus.windows.net:5671/;SharedAccessKeyName=qux;SharedAccessKey=****;EntityPath=foo
|
||
name
string
|
success |
Name of the custom endpoint.
Sample:
foo
|
||
resource_group
string
|
success |
Resource group of the endpoint.
Sample:
bar
|
||
subscription
string
|
success |
Subscription id of the endpoint.
Sample:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||
service_bus_queues
complex
|
always |
List of custom endpoints of service bus queue.
|
||
connection_string
string
|
success |
Connection string of the custom endpoint.
Sample:
Endpoint=sb://quux.servicebus.windows.net:5671/;SharedAccessKeyName=qux;SharedAccessKey=****;EntityPath=foo
|
||
name
string
|
success |
Name of the custom endpoint.
Sample:
foo
|
||
resource_group
string
|
success |
Resource group of the endpoint.
Sample:
bar
|
||
subscription
string
|
success |
Subscription ID of the endpoint.
Sample:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||
service_bus_topics
complex
|
success |
List of custom endpoints of service bus topic.
|
||
connection_string
string
|
success |
Connection string of the custom endpoint.
Sample:
Endpoint=sb://quux.servicebus.windows.net:5671/;SharedAccessKeyName=qux;SharedAccessKey=****;EntityPath=foo
|
||
name
string
|
success |
Name of the custom endpoint.
Sample:
foo
|
||
resource_group
string
|
success |
Resource group of the endpoint.
Sample:
bar
|
||
subscription
string
|
success |
Subscription ID of the endpoint.
Sample:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||
storage_containers
complex
|
success |
List of custom endpoints of storage
|
||
connection_string
string
|
success |
Connection string of the custom endpoint.
Sample:
Endpoint=sb://quux.servicebus.windows.net:5671/;SharedAccessKeyName=qux;SharedAccessKey=****;EntityPath=foo
|
||
name
string
|
success |
Name of the custom endpoint.
Sample:
foo
|
||
resource_group
string
|
success |
Resource group of the endpoint.
Sample:
bar
|
||
subscription
string
|
success |
Subscription ID of the endpoint.
Sample:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||
sku
string
|
success |
Pricing tier for Azure IoT Hub.
Sample:
f1
|
||
unit
integer
|
success |
Units in the IoT Hub.
Sample:
1
|
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]
Authors¶
Yuwei Zhou (@yuwzho)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.