2018-05-18 11:45:38 +02:00
|
|
|
---
|
|
|
|
- name: create random string
|
|
|
|
set_fact:
|
|
|
|
zone_name: "{{ 65535 | random | string }}.ansible.example.com"
|
|
|
|
|
|
|
|
- name: create zone with incorrect API key
|
2019-04-27 02:33:59 +02:00
|
|
|
memset_zone:
|
2018-05-18 11:45:38 +02:00
|
|
|
api_key: "wa9aerahhie0eekee9iaphoorovooyia"
|
|
|
|
state: present
|
|
|
|
name: "{{ zone_name }}"
|
|
|
|
ttl: 300
|
|
|
|
ignore_errors: true
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: check API response with invalid API key
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "'Memset API returned a 403 response (ApiErrorForbidden, Bad api_key)' in result.msg"
|
|
|
|
- result is not successful
|
|
|
|
|
|
|
|
- name: test creating zone
|
2019-04-27 02:33:59 +02:00
|
|
|
memset_zone:
|
2018-05-18 11:45:38 +02:00
|
|
|
api_key: "{{ api_key }}"
|
|
|
|
state: present
|
|
|
|
name: "{{ zone_name }}"
|
|
|
|
ttl: 300
|
|
|
|
check_mode: true
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: check if the zone would be created
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result is successful
|
|
|
|
|
|
|
|
- name: create zone
|
2019-04-27 02:33:59 +02:00
|
|
|
memset_zone:
|
2018-05-18 11:45:38 +02:00
|
|
|
api_key: "{{ api_key }}"
|
|
|
|
state: present
|
|
|
|
name: "{{ zone_name }}"
|
|
|
|
ttl: 300
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: create the zone
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result is successful
|
|
|
|
|
|
|
|
- name: create duplicate zone
|
2019-04-27 02:33:59 +02:00
|
|
|
memset_zone:
|
2018-05-18 11:45:38 +02:00
|
|
|
api_key: "{{ api_key }}"
|
|
|
|
state: present
|
|
|
|
name: "{{ zone_name }}"
|
|
|
|
ttl: 300
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: ensure we can't create duplicate zones
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is not changed
|
|
|
|
|
|
|
|
- name: test deleting zone
|
2019-04-27 02:33:59 +02:00
|
|
|
memset_zone:
|
2018-05-18 11:45:38 +02:00
|
|
|
api_key: "{{ api_key }}"
|
|
|
|
state: absent
|
|
|
|
name: "{{ zone_name }}"
|
|
|
|
check_mode: true
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: check if the zone would be deleted
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result is successful
|
|
|
|
|
|
|
|
- name: delete empty zone
|
2019-04-27 02:33:59 +02:00
|
|
|
memset_zone:
|
2018-05-18 11:45:38 +02:00
|
|
|
api_key: "{{ api_key }}"
|
|
|
|
state: absent
|
|
|
|
name: "{{ zone_name }}"
|
|
|
|
force: false
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: delete the zone
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result is successful
|
|
|
|
|
|
|
|
- name: create zone for deletion test
|
2019-04-27 02:33:59 +02:00
|
|
|
memset_zone:
|
2018-05-18 11:45:38 +02:00
|
|
|
api_key: "{{ api_key }}"
|
|
|
|
state: present
|
|
|
|
name: "{{ zone_name }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: ensure we can't create duplicate zones
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result is successful
|
|
|
|
|
|
|
|
- name: delete zone with force
|
2019-04-27 02:33:59 +02:00
|
|
|
memset_zone:
|
2018-05-18 11:45:38 +02:00
|
|
|
api_key: "{{ api_key }}"
|
|
|
|
state: absent
|
|
|
|
name: "{{ zone_name }}"
|
|
|
|
force: true
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: ensure force is respected
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- result is changed
|
|
|
|
- result is successful
|