Use variable for domain name (#28807)

This commit is contained in:
Harold Wong 2017-08-29 19:00:28 -07:00 committed by Matt Davis
parent 8a6ae51f90
commit 5e7b2a1c06

View file

@ -1,7 +1,11 @@
- name: Create random domain name
set_fact:
domain_name: "{{ resource_group | hash('md5') | truncate(16, True, '') + (65535 | random | string) }}"
- name: Create a DNS zone - name: Create a DNS zone
azure_rm_dnszone: azure_rm_dnszone:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
name: testing01010.com name: "{{ domain_name }}.com"
state: present state: present
register: results register: results
@ -13,7 +17,7 @@
azure_rm_dnsrecordset: azure_rm_dnsrecordset:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
relative_name: www relative_name: www
zone_name: testing01010.com zone_name: "{{ domain_name }}.com"
record_type: A record_type: A
record_set_state: present record_set_state: present
record_state: present record_state: present
@ -31,7 +35,7 @@
azure_rm_dnsrecordset: azure_rm_dnsrecordset:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
relative_name: www relative_name: www
zone_name: testing01010.com zone_name: "{{ domain_name }}.com"
record_type: A record_type: A
record_set_state: present record_set_state: present
record_state: present record_state: present
@ -49,7 +53,7 @@
azure_rm_dnsrecordset: azure_rm_dnsrecordset:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
relative_name: www relative_name: www
zone_name: testing01010.com zone_name: "{{ domain_name }}.com"
record_type: A record_type: A
record_set_state: present record_set_state: present
record_state: present record_state: present
@ -68,7 +72,7 @@
azure_rm_dnsrecordset: azure_rm_dnsrecordset:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
relative_name: www relative_name: www
zone_name: testing01010.com zone_name: "{{ domain_name }}.com"
record_type: A record_type: A
record_set_state: present record_set_state: present
record_state: absent record_state: absent
@ -85,7 +89,7 @@
azure_rm_dnsrecordset: azure_rm_dnsrecordset:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
relative_name: www relative_name: www
zone_name: testing01010.com zone_name: "{{ domain_name }}.com"
record_type: A record_type: A
record_set_state: absent record_set_state: absent
register: results register: results
@ -97,11 +101,11 @@
- name: create SRV records in a new record set - name: create SRV records in a new record set
azure_rm_dnsrecordset: azure_rm_dnsrecordset:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
relative_name: _sip._tcp.testing.com relative_name: "_sip._tcp.{{ domain_name }}.com"
zone_name: testing01010.com zone_name: "{{ domain_name }}.com"
record_type: SRV record_type: SRV
record_set_state: present record_set_state: present
records: sip.testing01010.com records: "sip.{{ domain_name }}.com"
preference: 10 preference: 10
record_state: present record_state: present
time_to_live: 7200 time_to_live: 7200
@ -114,11 +118,11 @@
assert: assert:
that: that:
- results.changed - results.changed
- results.record_set_state.full_list[0] == 'sip.testing01010.com' - results.record_set_state.full_list[0] == 'sip.{{ domain_name }}.com'
- results.record_set_state.name == '_sip._tcp.testing.com' - results.record_set_state.name == '_sip._tcp.{{ domain_name }}.com'
- name: Delete DNS zone - name: Delete DNS zone
azure_rm_dnszone: azure_rm_dnszone:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
name: testing01010.com name: "{{ domain_name }}.com"
state: absent state: absent