mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
879 B
YAML
35 lines
879 B
YAML
7 years ago
|
- name: Create random domain name
|
||
|
set_fact:
|
||
|
domain_name: "{{ resource_group | hash('md5') | truncate(16, True, '') + (65535 | random | string) }}"
|
||
|
|
||
|
- name: Create a DNS zone
|
||
|
azure_rm_dnszone:
|
||
|
resource_group: "{{ resource_group }}"
|
||
|
name: "{{ domain_name }}.com"
|
||
|
state: present
|
||
|
tags:
|
||
|
tag1: tag1
|
||
|
register: results
|
||
|
|
||
|
- name: Assert DNS Zone was created
|
||
|
assert:
|
||
|
that: results.changed
|
||
|
|
||
|
- name: Retrieve DNS Zone Facts
|
||
|
azure_rm_dnszone_facts:
|
||
|
resource_group: "{{ resource_group }}"
|
||
|
name: "{{ domain_name }}.com"
|
||
|
register: results
|
||
|
|
||
|
- name: Assert that facts module returned result
|
||
|
assert:
|
||
|
that:
|
||
|
- not results.changed
|
||
|
- results.ansible_facts.azure_dnszones[0].tags.tag1 == 'tag1'
|
||
|
|
||
|
- name: Delete DNS zone
|
||
|
azure_rm_dnszone:
|
||
|
resource_group: "{{ resource_group }}"
|
||
|
name: "{{ domain_name }}.com"
|
||
|
state: absent
|