summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/cloudscale_server
diff options
context:
space:
mode:
authorRené Moser <mail@renemoser.net>2019-08-14 22:55:31 +0200
committerGitHub <noreply@github.com>2019-08-14 22:55:31 +0200
commitf02f5c4b5dad36d696f028078ab545d75ba93d31 (patch)
tree103de76fa67823b0f09260508d69d6cd0554b354 /test/integration/targets/cloudscale_server
parentcloudscale_server_group: add tags support (#60397) (diff)
downloadansible-f02f5c4b5dad36d696f028078ab545d75ba93d31.tar.xz
ansible-f02f5c4b5dad36d696f028078ab545d75ba93d31.zip
cloudscale_server: add tags support (#60396)
Diffstat (limited to 'test/integration/targets/cloudscale_server')
-rw-r--r--test/integration/targets/cloudscale_server/tasks/tests.yml137
1 files changed, 137 insertions, 0 deletions
diff --git a/test/integration/targets/cloudscale_server/tasks/tests.yml b/test/integration/targets/cloudscale_server/tasks/tests.yml
index 36abc8f9ff..0774b2ece6 100644
--- a/test/integration/targets/cloudscale_server/tasks/tests.yml
+++ b/test/integration/targets/cloudscale_server/tasks/tests.yml
@@ -12,6 +12,10 @@
image: '{{ cloudscale_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
+ tags:
+ project: ansible-test
+ stage: production
+ sla: 24-7
register: server
check_mode: yes
- name: Verify create a running server in check mode
@@ -27,6 +31,10 @@
image: '{{ cloudscale_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
+ tags:
+ project: ansible-test
+ stage: production
+ sla: 24-7
register: server
- name: Verify create a running server
assert:
@@ -34,6 +42,9 @@
- server is changed
- server.state == 'running'
- server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
+ - server.tags.project == 'ansible-test'
+ - server.tags.stage == 'production'
+ - server.tags.sla == '24-7'
- name: Test create a running server idempotence
cloudscale_server:
@@ -42,6 +53,10 @@
image: '{{ cloudscale_test_image }}'
ssh_keys: '{{ cloudscale_test_ssh_key }}'
server_groups: '{{ cloudscale_resource_prefix }}-group-1'
+ tags:
+ project: ansible-test
+ stage: production
+ sla: 24-7
register: server
- name: Verify create a running server idempotence
assert:
@@ -49,6 +64,128 @@
- server is not changed
- server.state == 'running'
- server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
+ - server.tags.project == 'ansible-test'
+ - server.tags.stage == 'production'
+ - server.tags.sla == '24-7'
+
+- name: Test update tags in check mode
+ cloudscale_server:
+ name: '{{ cloudscale_resource_prefix }}-test'
+ flavor: '{{ cloudscale_test_flavor }}'
+ image: '{{ cloudscale_test_image }}'
+ ssh_keys: '{{ cloudscale_test_ssh_key }}'
+ server_groups: '{{ cloudscale_resource_prefix }}-group-1'
+ tags:
+ project: ansible-test
+ stage: staging
+ sla: 8-5
+ register: server
+ check_mode: yes
+- name: Verify update tags in check mode
+ assert:
+ that:
+ - server is changed
+ - server.state == 'running'
+ - server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
+ - server.tags.project == 'ansible-test'
+ - server.tags.stage == 'production'
+ - server.tags.sla == '24-7'
+
+- name: Test update tags
+ cloudscale_server:
+ name: '{{ cloudscale_resource_prefix }}-test'
+ flavor: '{{ cloudscale_test_flavor }}'
+ image: '{{ cloudscale_test_image }}'
+ ssh_keys: '{{ cloudscale_test_ssh_key }}'
+ server_groups: '{{ cloudscale_resource_prefix }}-group-1'
+ tags:
+ project: ansible-test
+ stage: staging
+ sla: 8-5
+ register: server
+- name: Verify update tags
+ assert:
+ that:
+ - server is changed
+ - server.state == 'running'
+ - server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
+ - server.tags.project == 'ansible-test'
+ - server.tags.stage == 'staging'
+ - server.tags.sla == '8-5'
+
+- name: Test update tags idempotence
+ cloudscale_server:
+ name: '{{ cloudscale_resource_prefix }}-test'
+ flavor: '{{ cloudscale_test_flavor }}'
+ image: '{{ cloudscale_test_image }}'
+ ssh_keys: '{{ cloudscale_test_ssh_key }}'
+ server_groups: '{{ cloudscale_resource_prefix }}-group-1'
+ tags:
+ project: ansible-test
+ stage: staging
+ sla: 8-5
+ register: server
+- name: Verify update tags idempotence
+ assert:
+ that:
+ - server is not changed
+ - server.state == 'running'
+ - server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
+ - server.tags.project == 'ansible-test'
+ - server.tags.stage == 'staging'
+ - server.tags.sla == '8-5'
+
+- name: Test omit tags idempotence
+ cloudscale_server:
+ name: '{{ cloudscale_resource_prefix }}-test'
+ flavor: '{{ cloudscale_test_flavor }}'
+ image: '{{ cloudscale_test_image }}'
+ ssh_keys: '{{ cloudscale_test_ssh_key }}'
+ server_groups: '{{ cloudscale_resource_prefix }}-group-1'
+ register: server
+- name: Verify update tags idempotence
+ assert:
+ that:
+ - server is not changed
+ - server.state == 'running'
+ - server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
+ - server.tags.project == 'ansible-test'
+ - server.tags.stage == 'staging'
+ - server.tags.sla == '8-5'
+
+- name: Test delete tags
+ cloudscale_server:
+ name: '{{ cloudscale_resource_prefix }}-test'
+ flavor: '{{ cloudscale_test_flavor }}'
+ image: '{{ cloudscale_test_image }}'
+ ssh_keys: '{{ cloudscale_test_ssh_key }}'
+ server_groups: '{{ cloudscale_resource_prefix }}-group-1'
+ tags: {}
+ register: server
+- name: Verify delete tags
+ assert:
+ that:
+ - server is changed
+ - server.state == 'running'
+ - server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
+ - not server.tags
+
+- name: Test delete tags idempotence
+ cloudscale_server:
+ name: '{{ cloudscale_resource_prefix }}-test'
+ flavor: '{{ cloudscale_test_flavor }}'
+ image: '{{ cloudscale_test_image }}'
+ ssh_keys: '{{ cloudscale_test_ssh_key }}'
+ server_groups: '{{ cloudscale_resource_prefix }}-group-1'
+ tags: {}
+ register: server
+- name: Verify delete tags idempotence
+ assert:
+ that:
+ - server is not changed
+ - server.state == 'running'
+ - server.server_groups.0.name == '{{ cloudscale_resource_prefix }}-group-1'
+ - not server.tags
- name: Test update flavor of a running server without force in check mode
cloudscale_server: