mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
139 lines
3.4 KiB
YAML
139 lines
3.4 KiB
YAML
---
|
|
- 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'
|