azure_rm_dnsrecordset – Create, delete and update DNS record sets and records¶
New in version 2.4.
Synopsis¶
- Creates, deletes, and updates DNS records sets and records within an existing Azure DNS Zone.
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: ensure an "A" record set with multiple records
azure_rm_dnsrecordset:
resource_group: myResourceGroup
relative_name: www
zone_name: testing.com
record_type: A
records:
- entry: 192.168.100.101
- entry: 192.168.100.102
- entry: 192.168.100.103
- name: delete a record set
azure_rm_dnsrecordset:
resource_group: myResourceGroup
record_type: A
relative_name: www
zone_name: testing.com
state: absent
- name: create multiple "A" record sets with multiple records
azure_rm_dnsrecordset:
resource_group: myResourceGroup
zone_name: testing.com
relative_name: "{{ item.name }}"
record_type: "{{ item.type }}"
records: "{{ item.records }}"
with_items:
- { name: 'servera', type: 'A', records: [ { entry: '10.10.10.20' }, { entry: '10.10.10.21' }] }
- { name: 'serverb', type: 'A', records: [ { entry: '10.10.10.30' }, { entry: '10.10.10.41' }] }
- { name: 'serverc', type: 'A', records: [ { entry: '10.10.10.40' }, { entry: '10.10.10.41' }] }
- name: create SRV records in a new record set
azure_rm_dnsrecordset:
resource_group: myResourceGroup
relative_name: _sip._tcp.testing.com
zone_name: testing.com
time_to_live: 7200
record_type: SRV
records:
- entry: sip.testing.com
preference: 10
priority: 20
weight: 10
port: 5060
- name: create PTR record in a new record set
azure_rm_dnsrecordset:
resource_group: myResourceGroup
relative_name: 192.168.100.101.in-addr.arpa
zone_name: testing.com
record_type: PTR
records:
- entry: servera.testing.com
- name: create TXT record in a new record set
azure_rm_dnsrecordset:
resource_group: myResourceGroup
relative_name: mail.testing.com
zone_name: testing.com
record_type: TXT
records:
- entry: 'v=spf1 a -all'
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Obezimnaka Boms (@ozboms)
- Matt Davis (@nitzmahone)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.