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/tests/integration/targets/cloudscale_server_group/tasks/tests.yml

160 lines
4.4 KiB
YAML
Raw Normal View History

2020-03-09 10:11:07 +01:00
---
- name: Create server group in check mode
cloudscale_server_group:
name: '{{ cloudscale_resource_prefix }}-grp'
tags:
project: ansible-test
stage: production
sla: 24-7
register: grp
check_mode: yes
- name: 'VERIFY: Create server group in check mode'
assert:
that:
- grp is changed
- grp.name == '{{ cloudscale_resource_prefix }}-grp'
- not grp.uuid
- name: Create server group
cloudscale_server_group:
name: '{{ cloudscale_resource_prefix }}-grp'
zone: '{{ cloudscale_test_zone }}'
tags:
project: ansible-test
stage: production
sla: 24-7
register: grp
- name: 'VERIFY: Create server group'
assert:
that:
- grp is changed
- grp.type == 'anti-affinity'
- grp.name == '{{ cloudscale_resource_prefix }}-grp'
- grp.zone.slug == '{{ cloudscale_test_zone }}'
- grp.uuid
- grp.tags.project == 'ansible-test'
- grp.tags.stage == 'production'
- grp.tags.sla == '24-7'
- name: Remember uuid
set_fact:
server_group_uuid: '{{ grp.uuid }}'
- name: Create server group idempotence
cloudscale_server_group:
name: '{{ cloudscale_resource_prefix }}-grp'
zone: '{{ cloudscale_test_zone }}'
tags:
project: ansible-test
stage: production
sla: 24-7
register: grp
- name: 'VERIFY: Create server group idempotence'
assert:
that:
- grp is not changed
- grp.name == '{{ cloudscale_resource_prefix }}-grp'
- grp.zone.slug == '{{ cloudscale_test_zone }}'
- grp.uuid == server_group_uuid
- grp.tags.project == 'ansible-test'
- grp.tags.stage == 'production'
- grp.tags.sla == '24-7'
- name: Update server group in check mode
cloudscale_server_group:
uuid: '{{ server_group_uuid }}'
name: '{{ cloudscale_resource_prefix }}-grp2'
tags:
project: ansible-test
stage: staging
sla: 8-5
register: grp
check_mode: yes
- name: 'VERIFY: Update server group in check mode'
assert:
that:
- grp is changed
- grp.name == '{{ cloudscale_resource_prefix }}-grp'
- grp.uuid == server_group_uuid
- grp.zone.slug == '{{ cloudscale_test_zone }}'
- grp.tags.project == 'ansible-test'
- grp.tags.stage == 'production'
- grp.tags.sla == '24-7'
- name: Update server group
cloudscale_server_group:
uuid: '{{ server_group_uuid }}'
name: '{{ cloudscale_resource_prefix }}-grp2'
tags:
project: ansible-test
stage: staging
sla: 8-5
register: grp
- name: 'VERIFY: Update server group'
assert:
that:
- grp is changed
- grp.name == '{{ cloudscale_resource_prefix }}-grp2'
- grp.uuid == server_group_uuid
- grp.zone.slug == '{{ cloudscale_test_zone }}'
- grp.tags.project == 'ansible-test'
- grp.tags.stage == 'staging'
- grp.tags.sla == '8-5'
- name: Update server group idempotence
cloudscale_server_group:
uuid: '{{ server_group_uuid }}'
name: '{{ cloudscale_resource_prefix }}-grp2'
tags:
project: ansible-test
stage: staging
sla: 8-5
register: grp
- name: 'VERIFY: Update server group idempotence'
assert:
that:
- grp is not changed
- grp.name == '{{ cloudscale_resource_prefix }}-grp2'
- grp.uuid == server_group_uuid
- grp.zone.slug == '{{ cloudscale_test_zone }}'
- grp.tags.project == 'ansible-test'
- grp.tags.stage == 'staging'
- grp.tags.sla == '8-5'
- name: Delete server group in check mode
cloudscale_server_group:
name: '{{ cloudscale_resource_prefix }}-grp2'
state: absent
register: grp
check_mode: yes
- name: 'VERIFY: Delete server group in check mode'
assert:
that:
- grp is changed
- grp.name == '{{ cloudscale_resource_prefix }}-grp2'
- grp.uuid == server_group_uuid
- name: Delete server group
cloudscale_server_group:
name: '{{ cloudscale_resource_prefix }}-grp2'
state: absent
register: grp
- name: 'VERIFY: Delete server group'
assert:
that:
- grp is changed
- grp.name == '{{ cloudscale_resource_prefix }}-grp2'
- grp.uuid == server_group_uuid
- name: Delete server group idempotence
cloudscale_server_group:
name: '{{ cloudscale_resource_prefix }}-grp2'
state: absent
register: grp
- name: 'VERIFY: Delete server group idempotence'
assert:
that:
- grp is not changed
- grp.name == '{{ cloudscale_resource_prefix }}-grp2'
- not grp.uuid