1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/cs_template/tasks/test2.yml

182 lines
5.3 KiB
YAML
Raw Normal View History

---
- name: setup template first template
cs_template:
name: ansible-template-test2
display_text: first template
state: absent
cross_zones: yes
template_find_options: display_text
register: template
- name: verify setup template first template
assert:
that:
- template is successful
- name: setup template second template
cs_template:
name: ansible-template-test2
display_text: second template
state: absent
cross_zones: yes
template_find_options: display_text
register: template
- name: verify setup template second template
assert:
that:
- template is successful
- name: test register first template
cs_template:
name: ansible-template-test2
display_text: first template
url: "{{ cs_template_url }}"
format: "{{ cs_template_format }}"
hypervisor: "{{ cs_template_hypervisor }}"
os_type: "{{ cs_template_os_type }}"
cross_zones: yes
template_find_options: display_text
register: template_first
- name: verify test register first template
assert:
that:
- template_first is changed
- template_first.name == "ansible-template-test2"
- template_first.display_text == "first template"
- template_first.cross_zones == true
- name: test register second template
cs_template:
name: ansible-template-test2
display_text: second template
url: "{{ cs_template_url }}"
format: "{{ cs_template_format }}"
hypervisor: "{{ cs_template_hypervisor }}"
os_type: "{{ cs_template_os_type }}"
cross_zones: yes
template_find_options: display_text
register: template_second
- name: verify test register second template
assert:
that:
- template_second is changed
- template_second.name == "ansible-template-test2"
- template_second.display_text == "second template"
- template_second.cross_zones == true
- template_second.id != template_first.id
- name: test multiple template same name absent without find options
cs_template:
name: ansible-template-test2
state: absent
cross_zones: yes
register: template
ignore_errors: yes
- name: verify test multiple template same name absent without find options
assert:
that:
- template is failed
- template.msg.startswith('Multiple templates found')
- name: test update second template
cs_template:
name: ansible-template-test2
display_text: second template
url: "{{ cs_template_url }}"
format: "{{ cs_template_format }}"
hypervisor: "{{ cs_template_hypervisor }}"
os_type: "{{ cs_template_os_type }}"
is_featured: yes
is_public: yes
cross_zones: yes
template_find_options: display_text
register: template
- name: verify test update second template
assert:
that:
- template is changed
- template.name == "ansible-template-test2"
- template.display_text == "second template"
- template.cross_zones == true
- template.id == template_second.id
- template.is_featured == true
- template.is_public == true
- name: test update second template idempotence
cs_template:
name: ansible-template-test2
display_text: second template
url: "{{ cs_template_url }}"
format: "{{ cs_template_format }}"
hypervisor: "{{ cs_template_hypervisor }}"
os_type: "{{ cs_template_os_type }}"
is_featured: yes
is_public: yes
cross_zones: yes
template_find_options: display_text
register: template
- name: verify test update second template idempotence
assert:
that:
- template is not changed
- template.name == "ansible-template-test2"
- template.display_text == "second template"
- template.cross_zones == true
- template.id == template_second.id
- template.is_featured == true
- name: test update second template idempotence 2
cs_template:
name: ansible-template-test2
display_text: second template
url: "{{ cs_template_url }}"
format: "{{ cs_template_format }}"
hypervisor: "{{ cs_template_hypervisor }}"
os_type: "{{ cs_template_os_type }}"
cross_zones: yes
template_find_options: display_text
register: template
- name: verify test update second template idempotence
assert:
that:
- template is not changed
- template.name == "ansible-template-test2"
- template.display_text == "second template"
- template.cross_zones == true
- template.id == template_second.id
- name: test delete first template
cs_template:
name: ansible-template-test2
display_text: first template
state: absent
cross_zones: yes
template_find_options: display_text
register: template
- name: verify test delete first template
assert:
that:
- template is changed
- template.name == "ansible-template-test2"
- template.display_text == "first template"
- template.cross_zones == true
- template.id == template_first.id
- template.is_featured == false
- name: test delete second template
cs_template:
name: ansible-template-test2
display_text: second template
state: absent
cross_zones: yes
template_find_options: display_text
register: template
- name: verify test delete second template
assert:
that:
- template is changed
- template.name == "ansible-template-test2"
- template.display_text == "second template"
- template.cross_zones == true
- template.id == template_second.id
- template.is_featured == true