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.
431 lines
13 KiB
YAML
431 lines
13 KiB
YAML
---
|
|
- name: Test create a running server in check mode
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
flavor: '{{ cloudscale_test_flavor }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
register: server
|
|
check_mode: yes
|
|
- name: Verify create a running server in check mode
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'absent'
|
|
|
|
- name: Test create a running server
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
flavor: '{{ cloudscale_test_flavor }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
register: server
|
|
- name: Verify create a running server
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'running'
|
|
|
|
- name: Test create a running server idempotence
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
flavor: '{{ cloudscale_test_flavor }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
register: server
|
|
- name: Verify create a running server idempotence
|
|
assert:
|
|
that:
|
|
- server is not changed
|
|
- server.state == 'running'
|
|
|
|
- name: Test update flavor of a running server without force in check mode
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
flavor: '{{ cloudscale_test_flavor_2 }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
force: no
|
|
register: server
|
|
check_mode: yes
|
|
- name: Verify update flavor of a running server without force in check mode
|
|
assert:
|
|
that:
|
|
- server is not changed
|
|
- server.state == 'running'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor }}'
|
|
|
|
- name: Test update flavor of a running server without force
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
flavor: '{{ cloudscale_test_flavor_2 }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
force: no
|
|
register: server
|
|
- name: Verify update flavor of a running server without force
|
|
assert:
|
|
that:
|
|
- server is not changed
|
|
- server.state == 'running'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor }}'
|
|
|
|
- name: Test update flavor of a running server without force idempotence
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
flavor: '{{ cloudscale_test_flavor_2 }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
force: no
|
|
register: server
|
|
- name: Verify update flavor of a running server without force idempotence
|
|
assert:
|
|
that:
|
|
- server is not changed
|
|
- server.state == 'running'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor }}'
|
|
|
|
- name: Test update flavor and name of a running server without force in check mode
|
|
cloudscale_server:
|
|
uuid: '{{ server.uuid }}'
|
|
name: '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
flavor: '{{ cloudscale_test_flavor_2 }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
force: no
|
|
register: server
|
|
check_mode: yes
|
|
- name: Verify update flavor and name of a running server without force in check mode
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'running'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor }}'
|
|
- server.name == '{{ cloudscale_resource_prefix }}-test'
|
|
|
|
- name: Test update flavor and name of a running server without force
|
|
cloudscale_server:
|
|
uuid: '{{ server.uuid }}'
|
|
name: '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
flavor: '{{ cloudscale_test_flavor_2 }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
force: no
|
|
register: server
|
|
- name: Verify update flavor and name of a running server without force
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'running'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor }}'
|
|
- server.name == '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
|
|
- name: Test update flavor and name of a running server without force idempotence
|
|
cloudscale_server:
|
|
uuid: '{{ server.uuid }}'
|
|
name: '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
flavor: '{{ cloudscale_test_flavor_2 }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
force: no
|
|
register: server
|
|
- name: Verify update flavor and name of a running server without force idempotence
|
|
assert:
|
|
that:
|
|
- server is not changed
|
|
- server.state == 'running'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor }}'
|
|
- server.name == '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
|
|
- name: Test update flavor of a running server with force in check mode
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
flavor: '{{ cloudscale_test_flavor_2 }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
force: yes
|
|
register: server
|
|
check_mode: yes
|
|
- name: Verify update flavor of a running server with force in check mode
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'running'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor }}'
|
|
- server.name == '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
|
|
- name: Test update flavor of a running server with force
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
flavor: '{{ cloudscale_test_flavor_2 }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
force: yes
|
|
register: server
|
|
- name: Verify update flavor of a running server with force
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'running'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor_2 }}'
|
|
- server.name == '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
|
|
- name: Test update a running server with force idempotence
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
flavor: '{{ cloudscale_test_flavor_2 }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
force: yes
|
|
register: server
|
|
- name: Verify update flavor of a running server with force idempotence
|
|
assert:
|
|
that:
|
|
- server is not changed
|
|
- server.state == 'running'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor_2 }}'
|
|
- server.name == '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
|
|
- name: Test create server stopped in check mode
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test-stopped'
|
|
flavor: '{{ cloudscale_test_flavor }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
state: stopped
|
|
check_mode: yes
|
|
register: server_stopped
|
|
- name: Verify create server stopped
|
|
assert:
|
|
that:
|
|
- server_stopped is changed
|
|
- server_stopped.state == 'absent'
|
|
|
|
- name: Test create server stopped
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_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 is changed
|
|
- server_stopped.state == 'stopped'
|
|
|
|
- name: Test create server stopped idempotence
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_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 idempotence
|
|
assert:
|
|
that:
|
|
- server_stopped is not changed
|
|
- server_stopped.state == 'stopped'
|
|
|
|
- name: Test create server failure without required parameters
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test-failed'
|
|
register: server_failed
|
|
ignore_errors: yes
|
|
- name: Verify create server failure without required parameters
|
|
assert:
|
|
that:
|
|
- server_failed is failed
|
|
- "'missing required arguments' in server_failed.msg"
|
|
|
|
- name: Test stop running server in check mode
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
state: stopped
|
|
check_mode: yes
|
|
register: server
|
|
- name: Verify stop running server in check mode
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'running'
|
|
|
|
- name: Test stop running server
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
state: stopped
|
|
register: server
|
|
- name: Verify stop running server
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'stopped'
|
|
|
|
- name: Test stop running server idempotence
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
state: 'stopped'
|
|
register: server
|
|
- name: Verify stop running server idempotence
|
|
assert:
|
|
that:
|
|
- server is not changed
|
|
- server.state == 'stopped'
|
|
|
|
- name: Test update a stopped server in check mode
|
|
cloudscale_server:
|
|
uuid: '{{ server.uuid }}'
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
flavor: '{{ cloudscale_test_flavor }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
state: stopped
|
|
register: server
|
|
check_mode: yes
|
|
- name: Verify update a stopped server in check mode
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'stopped'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor_2 }}'
|
|
- server.name == '{{ cloudscale_resource_prefix }}-test-renamed'
|
|
|
|
- name: Test update a stopped server without force
|
|
cloudscale_server:
|
|
uuid: '{{ server.uuid }}'
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
flavor: '{{ cloudscale_test_flavor }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
state: stopped
|
|
register: server
|
|
- name: Verify update a stopped server without force
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'stopped'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor }}'
|
|
- server.name == '{{ cloudscale_resource_prefix }}-test'
|
|
|
|
|
|
- name: Test update a stopped server idempotence
|
|
cloudscale_server:
|
|
uuid: '{{ server.uuid }}'
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
flavor: '{{ cloudscale_test_flavor }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
state: stopped
|
|
register: server
|
|
- name: Verify update a stopped server idempotence
|
|
assert:
|
|
that:
|
|
- server is not changed
|
|
- server.state == 'stopped'
|
|
- server.flavor.slug == '{{ cloudscale_test_flavor }}'
|
|
- server.name == '{{ cloudscale_resource_prefix }}-test'
|
|
|
|
- name: Test server running in check mode
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
state: running
|
|
register: server
|
|
check_mode: yes
|
|
- name: Verify server running in check mode
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'stopped'
|
|
|
|
- name: Test server running
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
state: running
|
|
register: server
|
|
- name: Verify server running
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'running'
|
|
|
|
- name: Test server running idempotence
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
state: running
|
|
register: server
|
|
- name: Verify server running idempotence
|
|
assert:
|
|
that:
|
|
- server is not changed
|
|
- server.state == 'running'
|
|
|
|
- name: Test running server deletion by name in check mode
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
state: absent
|
|
register: server
|
|
check_mode: yes
|
|
- name: Verify running server deletion by name in check mode
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'running'
|
|
|
|
- name: Test running server deletion by name
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
state: absent
|
|
register: server
|
|
- name: Verify running server deletion by name
|
|
assert:
|
|
that:
|
|
- server is changed
|
|
- server.state == 'absent'
|
|
|
|
- name: Test running server deletion by name idempotence
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test'
|
|
state: absent
|
|
register: server
|
|
- name: Verify running server deletion by name idempotence
|
|
assert:
|
|
that:
|
|
- server is not changed
|
|
- server.state == 'absent'
|
|
|
|
- name: Test stopped server deletion by uuid in check mode
|
|
cloudscale_server:
|
|
uuid: '{{ server_stopped.uuid }}'
|
|
state: absent
|
|
register: server_stopped
|
|
check_mode: yes
|
|
- name: Verify stopped server deletion by uuid in check mode
|
|
assert:
|
|
that:
|
|
- server_stopped is changed
|
|
- server_stopped.state == 'stopped'
|
|
|
|
- name: Test stopped server deletion by uuid
|
|
cloudscale_server:
|
|
uuid: '{{ server_stopped.uuid }}'
|
|
state: absent
|
|
register: server_stopped
|
|
- name: Verify stopped server deletion by uuid
|
|
assert:
|
|
that:
|
|
- server_stopped is changed
|
|
- server_stopped.state == 'absent'
|
|
|
|
- name: Test stopped server deletion by uuid idempotence
|
|
cloudscale_server:
|
|
uuid: '{{ server_stopped.uuid }}'
|
|
state: absent
|
|
register: server_stopped
|
|
- name: Verify stopped server deletion by uuid idempotence
|
|
assert:
|
|
that:
|
|
- server_stopped is not changed
|
|
- server_stopped.state == 'absent'
|