mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-05-08 14:23:03 +00:00
Make it compatible with new SDK.
Although this one was already using self.con.dns.zones to retrieve the
zones, it wasn't using the to_dict(computed=False) and was still
removing the location (which is obsolate when you use to_dict.
Change-Id: Ie2a5b772acc0c8c8338f6f1da877564a077e3b7a
(cherry picked from commit 0c6e8bed69)
50 lines
1.2 KiB
YAML
50 lines
1.2 KiB
YAML
---
|
|
- name: Set random prefix
|
|
set_fact:
|
|
prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}"
|
|
|
|
- name: Create dns zone
|
|
openstack.cloud.dns_zone:
|
|
cloud: "{{ cloud }}"
|
|
name: "{{ (prefix + '.test.zone.') }}"
|
|
email: test@example.net
|
|
|
|
- name: Getting info about dns zones
|
|
openstack.cloud.dns_zone_info:
|
|
cloud: "{{ cloud }}"
|
|
register: zones
|
|
|
|
- name: assert result
|
|
assert:
|
|
that:
|
|
- zones is success
|
|
- zones is not changed
|
|
- zones | length > 0
|
|
|
|
- name: Getting info about created zone
|
|
openstack.cloud.dns_zone_info:
|
|
cloud: "{{ cloud }}"
|
|
name: "{{ (prefix + '.test.zone.') }}"
|
|
register: zone
|
|
|
|
- name: assert result
|
|
assert:
|
|
that:
|
|
- zone is success
|
|
- zone is not changed
|
|
- zone.zones | length == 1
|
|
|
|
- name: Assert keys exist
|
|
assert:
|
|
that:
|
|
- '["action", "attributes", "created_at", "description", "email",
|
|
"links", "masters", "name", "pool_id", "project_id", "serial",
|
|
"status", "ttl", "type", "updated_at", "id"] |
|
|
difference(zone.zones.0.keys()) | length == 0'
|
|
|
|
- name: Drop created dns zone
|
|
openstack.cloud.dns_zone:
|
|
cloud: "{{ cloud }}"
|
|
name: "{{ (prefix + '.test.zone.') }}"
|
|
state: absent
|