ansible/test/integration/targets/cs_domain/tasks/main.yml
2017-05-05 21:46:29 +08:00

112 lines
3.5 KiB
YAML

---
- name: setup
cs_domain: path={{ cs_resource_prefix }}_domain state=absent
register: dom
- name: verify setup
assert:
that:
- dom|success
- name: test fail if missing name
action: cs_domain
register: dom
ignore_errors: true
- name: verify results of fail if missing params
assert:
that:
- dom|failed
- 'dom.msg == "missing required arguments: path"'
- name: test fail if ends with /
cs_domain: path={{ cs_resource_prefix }}_domain/
register: dom
ignore_errors: true
- name: verify results of fail if ends with /
assert:
that:
- dom|failed
- dom.msg == "Path '{{ cs_resource_prefix }}_domain/' must not end with /"
- name: test create a domain
cs_domain: path={{ cs_resource_prefix }}_domain
register: dom
- name: verify results of test create a domain
assert:
that:
- dom|changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain"
- dom.name == "{{ cs_resource_prefix }}_domain"
- name: test create a domain idempotence
cs_domain: path={{ cs_resource_prefix }}_domain
register: dom
- name: verify results of test create a domain idempotence
assert:
that:
- not dom|changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain"
- dom.name == "{{ cs_resource_prefix }}_domain"
- name: test create a subdomain
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
register: dom
- name: verify results of test create a domain
assert:
that:
- dom|changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test create a subdomain idempotence
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
register: dom
- name: verify results of test create a subdomain idempotence
assert:
that:
- not dom|changed
- name: test delete a subdomain
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain state=absent
register: dom
- name: verify results of test delete a subdomain idempotence
assert:
that:
- dom|changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test delete a subdomain idempotence
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain state=absent
register: dom
- name: verify results of test delete a subdomain idempotence
assert:
that:
- not dom|changed
- name: test create a subdomain 2
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain
register: dom
- name: verify results of test create a subdomain 2
assert:
that:
- dom|changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain/{{ cs_resource_prefix }}_subdomain"
- dom.name == "{{ cs_resource_prefix }}_subdomain"
- name: test delete a domain with clean up
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain state=absent clean_up=true
register: dom
- name: verify results of test delete a domain with clean up
assert:
that:
- dom|changed
- dom.path == "ROOT/{{ cs_resource_prefix }}_domain"
- dom.name == "{{ cs_resource_prefix }}_domain"
- name: test delete a domain with clean up idempotence
cs_domain: path=ROOT/{{ cs_resource_prefix }}_domain state=absent clean_up=true
register: dom
- name: verify results of test delete a domain with clean up idempotence
assert:
that:
- not dom|changed