|
| 1 | +--- |
| 2 | +- name: setup template first template |
| 3 | + ngine_io.cloudstack.template: |
| 4 | + name: ansible-template-test2 |
| 5 | + display_text: first template |
| 6 | + state: absent |
| 7 | + cross_zones: yes |
| 8 | + template_find_options: display_text |
| 9 | + register: template |
| 10 | +- name: verify setup template first template |
| 11 | + assert: |
| 12 | + that: |
| 13 | + - template is successful |
| 14 | + |
| 15 | +- name: setup template second template |
| 16 | + ngine_io.cloudstack.template: |
| 17 | + name: ansible-template-test2 |
| 18 | + display_text: second template |
| 19 | + state: absent |
| 20 | + cross_zones: yes |
| 21 | + template_find_options: display_text |
| 22 | + register: template |
| 23 | +- name: verify setup template second template |
| 24 | + assert: |
| 25 | + that: |
| 26 | + - template is successful |
| 27 | + |
| 28 | +- name: test register first template |
| 29 | + ngine_io.cloudstack.template: |
| 30 | + name: ansible-template-test2 |
| 31 | + display_text: first template |
| 32 | + url: "{{ cs_template_url }}" |
| 33 | + format: "{{ cs_template_format }}" |
| 34 | + hypervisor: "{{ cs_template_hypervisor }}" |
| 35 | + os_type: "{{ cs_template_os_type }}" |
| 36 | + cross_zones: yes |
| 37 | + template_find_options: display_text |
| 38 | + register: template_first |
| 39 | +- name: verify test register first template |
| 40 | + assert: |
| 41 | + that: |
| 42 | + - template_first is changed |
| 43 | + - template_first.name == "ansible-template-test2" |
| 44 | + - template_first.display_text == "first template" |
| 45 | + - template_first.cross_zones == true |
| 46 | + |
| 47 | +- name: test register second template |
| 48 | + ngine_io.cloudstack.template: |
| 49 | + name: ansible-template-test2 |
| 50 | + display_text: second template |
| 51 | + url: "{{ cs_template_url }}" |
| 52 | + format: "{{ cs_template_format }}" |
| 53 | + hypervisor: "{{ cs_template_hypervisor }}" |
| 54 | + os_type: "{{ cs_template_os_type }}" |
| 55 | + cross_zones: yes |
| 56 | + template_find_options: display_text |
| 57 | + register: template_second |
| 58 | +- name: verify test register second template |
| 59 | + assert: |
| 60 | + that: |
| 61 | + - template_second is changed |
| 62 | + - template_second.name == "ansible-template-test2" |
| 63 | + - template_second.display_text == "second template" |
| 64 | + - template_second.cross_zones == true |
| 65 | + - template_second.id != template_first.id |
| 66 | + |
| 67 | +- name: test multiple template same name absent without find options |
| 68 | + ngine_io.cloudstack.template: |
| 69 | + name: ansible-template-test2 |
| 70 | + state: absent |
| 71 | + cross_zones: yes |
| 72 | + register: template |
| 73 | + ignore_errors: yes |
| 74 | +- name: verify test multiple template same name absent without find options |
| 75 | + assert: |
| 76 | + that: |
| 77 | + - template is failed |
| 78 | + - template.msg.startswith('Multiple templates found') |
| 79 | + |
| 80 | +- name: test update second template |
| 81 | + ngine_io.cloudstack.template: |
| 82 | + name: ansible-template-test2 |
| 83 | + display_text: second template |
| 84 | + url: "{{ cs_template_url }}" |
| 85 | + format: "{{ cs_template_format }}" |
| 86 | + hypervisor: "{{ cs_template_hypervisor }}" |
| 87 | + os_type: "{{ cs_template_os_type }}" |
| 88 | + is_featured: yes |
| 89 | + is_public: yes |
| 90 | + cross_zones: yes |
| 91 | + template_find_options: display_text |
| 92 | + register: template |
| 93 | +- name: verify test update second template |
| 94 | + assert: |
| 95 | + that: |
| 96 | + - template is changed |
| 97 | + - template.name == "ansible-template-test2" |
| 98 | + - template.display_text == "second template" |
| 99 | + - template.cross_zones == true |
| 100 | + - template.id == template_second.id |
| 101 | + - template.is_featured == true |
| 102 | + - template.is_public == true |
| 103 | + |
| 104 | +- name: test update second template idempotence |
| 105 | + ngine_io.cloudstack.template: |
| 106 | + name: ansible-template-test2 |
| 107 | + display_text: second template |
| 108 | + url: "{{ cs_template_url }}" |
| 109 | + format: "{{ cs_template_format }}" |
| 110 | + hypervisor: "{{ cs_template_hypervisor }}" |
| 111 | + os_type: "{{ cs_template_os_type }}" |
| 112 | + is_featured: yes |
| 113 | + is_public: yes |
| 114 | + cross_zones: yes |
| 115 | + template_find_options: display_text |
| 116 | + register: template |
| 117 | +- name: verify test update second template idempotence |
| 118 | + assert: |
| 119 | + that: |
| 120 | + - template is not changed |
| 121 | + - template.name == "ansible-template-test2" |
| 122 | + - template.display_text == "second template" |
| 123 | + - template.cross_zones == true |
| 124 | + - template.id == template_second.id |
| 125 | + - template.is_featured == true |
| 126 | + |
| 127 | +- name: test update second template idempotence 2 |
| 128 | + ngine_io.cloudstack.template: |
| 129 | + name: ansible-template-test2 |
| 130 | + display_text: second template |
| 131 | + url: "{{ cs_template_url }}" |
| 132 | + format: "{{ cs_template_format }}" |
| 133 | + hypervisor: "{{ cs_template_hypervisor }}" |
| 134 | + os_type: "{{ cs_template_os_type }}" |
| 135 | + cross_zones: yes |
| 136 | + template_find_options: display_text |
| 137 | + register: template |
| 138 | +- name: verify test update second template idempotence |
| 139 | + assert: |
| 140 | + that: |
| 141 | + - template is not changed |
| 142 | + - template.name == "ansible-template-test2" |
| 143 | + - template.display_text == "second template" |
| 144 | + - template.cross_zones == true |
| 145 | + - template.id == template_second.id |
| 146 | + |
| 147 | +- name: test delete first template |
| 148 | + ngine_io.cloudstack.template: |
| 149 | + name: ansible-template-test2 |
| 150 | + display_text: first template |
| 151 | + state: absent |
| 152 | + cross_zones: yes |
| 153 | + template_find_options: display_text |
| 154 | + register: template |
| 155 | +- name: verify test delete first template |
| 156 | + assert: |
| 157 | + that: |
| 158 | + - template is changed |
| 159 | + - template.name == "ansible-template-test2" |
| 160 | + - template.display_text == "first template" |
| 161 | + - template.cross_zones == true |
| 162 | + - template.id == template_first.id |
| 163 | + - template.is_featured == false |
| 164 | + |
| 165 | +- name: test delete second template |
| 166 | + ngine_io.cloudstack.template: |
| 167 | + name: ansible-template-test2 |
| 168 | + display_text: second template |
| 169 | + state: absent |
| 170 | + cross_zones: yes |
| 171 | + template_find_options: display_text |
| 172 | + register: template |
| 173 | +- name: verify test delete second template |
| 174 | + assert: |
| 175 | + that: |
| 176 | + - template is changed |
| 177 | + - template.name == "ansible-template-test2" |
| 178 | + - template.display_text == "second template" |
| 179 | + - template.cross_zones == true |
| 180 | + - template.id == template_second.id |
| 181 | + - template.is_featured == true |
0 commit comments