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/cloudscale_server/tasks/main.yml

139 lines
3.4 KiB
YAML
Raw Normal View History

2017-01-17 23:15:20 +01:00
---
- name: Test create server
cloudscale_server:
name: '{{ resource_prefix }}-test'
flavor: '{{ cloudscale_test_flavor }}'
image: '{{ cloudscale_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
register: server
- name: Verify create server
assert:
that:
- server|success
- server|changed
- server.state == 'running'
- name: Test create server indempotence
cloudscale_server:
name: '{{ resource_prefix }}-test'
flavor: '{{ cloudscale_test_flavor }}'
image: '{{ cloudscale_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
register: server
- name: Verify create server
assert:
that:
- server|success
- not server|changed
- server.state == 'running'
- name: Test create server stopped
cloudscale_server:
name: '{{ resource_prefix }}-test-stopped'
flavor: '{{ cloudscale_test_flavor }}'
image: '{{ cloudscale_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
state: 'stopped'
register: server_stopped
- name: Verify create server stopped
assert:
that:
- server_stopped|success
- server_stopped|changed
- server_stopped.state == 'stopped'
- name: Test create server failure without required parameters
cloudscale_server:
name: '{{ resource_prefix }}-test-failed'
register: server_failed
ignore_errors: True
- name: Verify create server failure without required parameters
assert:
that:
- server_failed|failed
- "'Missing required parameter' in server_failed.msg"
- name: Test server stopped
cloudscale_server:
name: '{{ resource_prefix }}-test'
state: 'stopped'
register: server
- name: Verify server stopped
assert:
that:
- server|success
- server|changed
- server.state == 'stopped'
- name: Test server stopped indempotence
cloudscale_server:
name: '{{ resource_prefix }}-test'
state: 'stopped'
register: server
- name: Verify server stopped indempotence
assert:
that:
- server|success
- not server|changed
- server.state == 'stopped'
- name: Test server running
cloudscale_server:
name: '{{ resource_prefix }}-test'
state: 'running'
register: server
- name: Verify server running
assert:
that:
- server|success
- server|changed
- server.state == 'running'
- name: Test server running indempotence
cloudscale_server:
name: '{{ resource_prefix }}-test'
state: 'running'
register: server
- name: Verify server running indempotence
assert:
that:
- server|success
- not server|changed
- server.state == 'running'
- name: Test server deletion by name
cloudscale_server:
name: '{{ resource_prefix }}-test'
state: 'absent'
register: server
- name: Verify server deletion
assert:
that:
- server|success
- server|changed
- server.state == 'absent'
- name: Test server deletion by uuid
cloudscale_server:
uuid: '{{ server_stopped.uuid }}'
state: 'absent'
register: server_stopped
- name: Verify server deletion by uuid
assert:
that:
- server_stopped|success
- server_stopped|changed
- server_stopped.state == 'absent'
- name: Test server deletion indempotence
cloudscale_server:
name: '{{ resource_prefix }}-test'
state: 'absent'
register: server
- name: Verify server deletion
assert:
that:
- server|success
- not server|changed
- server.state == 'absent'