mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
49 lines
1.1 KiB
YAML
49 lines
1.1 KiB
YAML
- 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
|
|
register: results
|
|
|
|
- assert:
|
|
that: results.changed
|
|
|
|
- name: Update DNS zone with tags
|
|
azure_rm_dnszone:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "{{ domain_name }}.com"
|
|
state: present
|
|
tags:
|
|
test: modified
|
|
register: results
|
|
|
|
- assert:
|
|
that:
|
|
- results.changed
|
|
- results.state.tags.test == 'modified'
|
|
|
|
- name: Test check_mode
|
|
azure_rm_dnszone:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "{{ domain_name }}.com"
|
|
state: present
|
|
tags:
|
|
test: new_modified
|
|
check_mode: yes
|
|
register: results
|
|
|
|
- assert:
|
|
that:
|
|
- results.changed
|
|
- results.state.tags.test == 'new_modified'
|
|
- results.check_mode == true
|
|
|
|
- name: Delete DNS zone
|
|
azure_rm_dnszone:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "{{ domain_name }}.com"
|
|
state: absent
|