ansible/test/integration/targets/vultr_dns_domain/tasks/main.yml

100 lines
2.6 KiB
YAML
Raw Normal View History

2018-01-21 22:54:12 +01:00
# Copyright (c) 2018, René Moser <mail@renemoser.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
- name: setup
vultr_dns_domain:
name: "{{ vultr_dns_domain_name }}"
2018-01-21 22:54:12 +01:00
state: absent
register: result
- name: verify setup
assert:
that:
- result is success
- name: test fail if missing name
vultr_dns_domain:
2018-01-21 22:54:12 +01:00
register: result
ignore_errors: yes
- name: verify test fail if missing name
assert:
that:
- result is failed
- 'result.msg == "missing required arguments: name"'
- name: test fail if missing params for state=present
vultr_dns_domain:
name: "{{ vultr_dns_domain_name }}"
2018-01-21 22:54:12 +01:00
register: result
ignore_errors: yes
- name: verify fail if missing params for state=present
assert:
that:
- result is failed
- 'result.msg == "state is present but all of the following are missing: server_ip"'
- name: test create dns domain in check mode
vultr_dns_domain:
name: "{{ vultr_dns_domain_name }}"
2018-01-21 22:54:12 +01:00
server_ip: 10.10.10.10
register: result
check_mode: yes
- name: verify test create dns domain in check mode
assert:
that:
- result is changed
- name: test create dns domain
vultr_dns_domain:
name: "{{ vultr_dns_domain_name }}"
2018-01-21 22:54:12 +01:00
server_ip: 10.10.10.10
register: result
- name: verify test create dns domain
assert:
that:
- result is changed
- result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}'
2018-01-21 22:54:12 +01:00
- name: test create dns domain idempotence
vultr_dns_domain:
name: "{{ vultr_dns_domain_name }}"
2018-01-21 22:54:12 +01:00
server_ip: 10.10.10.10
register: result
- name: verify test create dns domain idempotence
assert:
that:
- result is not changed
- result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}'
2018-01-21 22:54:12 +01:00
- name: test absent dns domain in check mode
vultr_dns_domain:
name: "{{ vultr_dns_domain_name }}"
2018-01-21 22:54:12 +01:00
state: absent
register: result
check_mode: yes
- name: verify test absent dns domain in check mode
assert:
that:
- result is changed
- result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}'
2018-01-21 22:54:12 +01:00
- name: test absent dns domain
vultr_dns_domain:
name: "{{ vultr_dns_domain_name }}"
2018-01-21 22:54:12 +01:00
state: absent
register: result
- name: verify test absent dns domain
assert:
that:
- result is changed
- result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}'
2018-01-21 22:54:12 +01:00
- name: test absent dns domain idempotence
vultr_dns_domain:
name: "{{ vultr_dns_domain_name }}"
2018-01-21 22:54:12 +01:00
state: absent
register: result
- name: verify test absent dns domain idempotence
assert:
that:
- result is not changed