summaryrefslogtreecommitdiffstats
path: root/test/integration/targets
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets')
-rw-r--r--test/integration/targets/argspec/library/argspec.py5
-rw-r--r--test/integration/targets/argspec/tasks/main.yml11
-rw-r--r--test/integration/targets/incidental_hcloud_server/aliases2
-rw-r--r--test/integration/targets/incidental_hcloud_server/defaults/main.yml5
-rw-r--r--test/integration/targets/incidental_hcloud_server/tasks/main.yml517
5 files changed, 16 insertions, 524 deletions
diff --git a/test/integration/targets/argspec/library/argspec.py b/test/integration/targets/argspec/library/argspec.py
index e14df1eac9..751068c588 100644
--- a/test/integration/targets/argspec/library/argspec.py
+++ b/test/integration/targets/argspec/library/argspec.py
@@ -50,6 +50,8 @@ def main():
'default': [],
},
'needed_param': {},
+ 'required_together_one': {},
+ 'required_together_two': {},
},
required_if=(
('state', 'present', ('path', 'content'), True),
@@ -57,6 +59,9 @@ def main():
mutually_exclusive=(
('path', 'content'),
),
+ required_together=(
+ ('required_together_one', 'required_together_two'),
+ ),
)
module.fail_on_missing_params(module.params['fail_on_missing_params'])
diff --git a/test/integration/targets/argspec/tasks/main.yml b/test/integration/targets/argspec/tasks/main.yml
index 50c2855424..17bbbdbc96 100644
--- a/test/integration/targets/argspec/tasks/main.yml
+++ b/test/integration/targets/argspec/tasks/main.yml
@@ -112,6 +112,15 @@
register: argspec_fail_on_missing_params_bad
ignore_errors: true
+- argspec:
+ required_together_one: foo
+ required_together_two: bar
+
+- argspec:
+ required_together_one: foo
+ register: argspec_fail_required_together
+ ignore_errors: true
+
- assert:
that:
- argspec_required_if_fail is failed
@@ -144,3 +153,5 @@
- argspec_bad_json is failed
- argspec_fail_on_missing_params_bad is failed
+
+ - argspec_fail_required_together is failed
diff --git a/test/integration/targets/incidental_hcloud_server/aliases b/test/integration/targets/incidental_hcloud_server/aliases
deleted file mode 100644
index 6c43c27cf9..0000000000
--- a/test/integration/targets/incidental_hcloud_server/aliases
+++ /dev/null
@@ -1,2 +0,0 @@
-cloud/hcloud
-shippable/hcloud/incidental
diff --git a/test/integration/targets/incidental_hcloud_server/defaults/main.yml b/test/integration/targets/incidental_hcloud_server/defaults/main.yml
deleted file mode 100644
index b9a9a8df7b..0000000000
--- a/test/integration/targets/incidental_hcloud_server/defaults/main.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de>
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
----
-hcloud_prefix: "tests"
-hcloud_server_name: "{{hcloud_prefix}}-integration"
diff --git a/test/integration/targets/incidental_hcloud_server/tasks/main.yml b/test/integration/targets/incidental_hcloud_server/tasks/main.yml
deleted file mode 100644
index 31c7ad97e0..0000000000
--- a/test/integration/targets/incidental_hcloud_server/tasks/main.yml
+++ /dev/null
@@ -1,517 +0,0 @@
-# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de>
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
----
-- name: setup
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: absent
- register: result
-- name: verify setup
- assert:
- that:
- - result is success
-- name: test missing required parameters on create server
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- register: result
- ignore_errors: yes
-- name: verify fail test missing required parameters on create server
- assert:
- that:
- - result is failed
- - 'result.msg == "missing required arguments: server_type, image"'
-
-- name: test create server with check mode
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- server_type: cx11
- image: ubuntu-18.04
- state: present
- register: result
- check_mode: yes
-- name: test create server server
- assert:
- that:
- - result is changed
-
-- name: test create server
- hcloud_server:
- name: "{{ hcloud_server_name}}"
- server_type: cx11
- image: ubuntu-18.04
- state: started
- register: main_server
-- name: verify create server
- assert:
- that:
- - main_server is changed
- - main_server.hcloud_server.name == "{{ hcloud_server_name }}"
- - main_server.hcloud_server.server_type == "cx11"
- - main_server.hcloud_server.status == "running"
- - main_server.root_password != ""
-
-- name: test create server idempotence
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: started
- register: result
-- name: verify create server idempotence
- assert:
- that:
- - result is not changed
-
-- name: test stop server with check mode
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: stopped
- register: result
- check_mode: yes
-- name: verify stop server with check mode
- assert:
- that:
- - result is changed
- - result.hcloud_server.status == "running"
-
-- name: test stop server
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: stopped
- register: result
-- name: verify stop server
- assert:
- that:
- - result is changed
- - result.hcloud_server.status == "off"
-
-- name: test start server with check mode
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: started
- register: result
- check_mode: true
-- name: verify start server with check mode
- assert:
- that:
- - result is changed
-
-- name: test start server
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: started
- register: result
-- name: verify start server
- assert:
- that:
- - result is changed
- - result.hcloud_server.status == "running"
-
-- name: test start server idempotence
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: started
- register: result
-- name: verify start server idempotence
- assert:
- that:
- - result is not changed
- - result.hcloud_server.status == "running"
-
-- name: test stop server by its id
- hcloud_server:
- id: "{{ main_server.hcloud_server.id }}"
- state: stopped
- register: result
-- name: verify stop server by its id
- assert:
- that:
- - result is changed
- - result.hcloud_server.status == "off"
-
-- name: test resize server running without force
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- server_type: "cx21"
- state: present
- register: result
- check_mode: true
-- name: verify test resize server running without force
- assert:
- that:
- - result is changed
- - result.hcloud_server.server_type == "cx11"
-
-- name: test resize server with check mode
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- server_type: "cx21"
- state: stopped
- register: result
- check_mode: true
-- name: verify resize server with check mode
- assert:
- that:
- - result is changed
-
-- name: test enable backups with check mode
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- backups: true
- state: stopped
- register: result
- check_mode: true
-- name: verify enable backups with check mode
- assert:
- that:
- - result is changed
-
-- name: test enable backups
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- backups: true
- state: stopped
- register: result
-- name: verify enable backups
- assert:
- that:
- - result is changed
- - result.hcloud_server.backup_window != ""
-
-- name: test enable backups idempotence
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- backups: true
- state: stopped
- register: result
-- name: verify enable backups idempotence
- assert:
- that:
- - result is not changed
- - result.hcloud_server.backup_window != ""
-
-- name: test rebuild server
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- image: ubuntu-18.04
- state: rebuild
- register: result_after_test
-- name: verify rebuild server
- assert:
- that:
- - result_after_test is changed
- - result.hcloud_server.id == result_after_test.hcloud_server.id
-
-- name: test rebuild server with check mode
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- image: ubuntu-18.04
- state: rebuild
- register: result_after_test
- check_mode: true
-- name: verify rebuild server with check mode
- assert:
- that:
- - result_after_test is changed
-
-- name: test update server protection booth protection arguments are required
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- delete_protection: true
- state: present
- register: result_after_test
- ignore_errors: true
-- name: verify update server protection booth protection arguments are required
- assert:
- that:
- - result_after_test is failed
- - 'result_after_test.msg == "parameters are required together: delete_protection, rebuild_protection"'
-
-- name: test update server protection fails if they are not the same
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- delete_protection: true
- rebuild_protection: false
- state: present
- register: result_after_test
- ignore_errors: true
-- name: verify update server protection fails if they are not the same
- assert:
- that:
- - result_after_test is failed
-
-- name: test update server protection
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- delete_protection: true
- rebuild_protection: true
- state: present
- register: result_after_test
- ignore_errors: true
-- name: verify update server protection
- assert:
- that:
- - result_after_test is changed
- - result_after_test.hcloud_server.delete_protection is sameas true
- - result_after_test.hcloud_server.rebuild_protection is sameas true
-
-- name: test server without protection set to be idempotent
- hcloud_server:
- name: "{{hcloud_server_name}}"
- register: result_after_test
-- name: verify test server without protection set to be idempotent
- assert:
- that:
- - result_after_test is not changed
- - result_after_test.hcloud_server.delete_protection is sameas true
- - result_after_test.hcloud_server.rebuild_protection is sameas true
-
-- name: test delete server fails if it is protected
- hcloud_server:
- name: "{{hcloud_server_name}}"
- state: absent
- ignore_errors: yes
- register: result
-- name: verify delete server fails if it is protected
- assert:
- that:
- - result is failed
- - 'result.msg == "server deletion is protected"'
-
-- name: test rebuild server fails if it is protected
- hcloud_server:
- name: "{{hcloud_server_name}}"
- image: ubuntu-18.04
- state: rebuild
- ignore_errors: yes
- register: result
-- name: verify rebuild server fails if it is protected
- assert:
- that:
- - result is failed
- - 'result.msg == "server rebuild is protected"'
-
-- name: test remove server protection
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- delete_protection: false
- rebuild_protection: false
- state: present
- register: result_after_test
- ignore_errors: true
-- name: verify remove server protection
- assert:
- that:
- - result_after_test is changed
- - result_after_test.hcloud_server.delete_protection is sameas false
- - result_after_test.hcloud_server.rebuild_protection is sameas false
-
-- name: absent server
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: absent
- register: result
-- name: verify absent server
- assert:
- that:
- - result is success
-
-- name: test create server with ssh key
- hcloud_server:
- name: "{{ hcloud_server_name}}"
- server_type: cx11
- image: "ubuntu-18.04"
- ssh_keys:
- - ci@ansible.hetzner.cloud
- state: started
- register: main_server
-- name: verify create server with ssh key
- assert:
- that:
- - main_server is changed
- - main_server.hcloud_server.name == "{{ hcloud_server_name }}"
- - main_server.hcloud_server.server_type == "cx11"
- - main_server.hcloud_server.status == "running"
- - main_server.root_password != ""
-
-- name: absent server
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: absent
- register: result
-- name: verify absent server
- assert:
- that:
- - result is success
-
-- name: test create server with rescue_mode
- hcloud_server:
- name: "{{ hcloud_server_name}}"
- server_type: cx11
- image: "ubuntu-18.04"
- ssh_keys:
- - ci@ansible.hetzner.cloud
- rescue_mode: "linux64"
- state: started
- register: main_server
-- name: verify create server with rescue_mode
- assert:
- that:
- - main_server is changed
- - main_server.hcloud_server.name == "{{ hcloud_server_name }}"
- - main_server.hcloud_server.server_type == "cx11"
- - main_server.hcloud_server.status == "running"
- - main_server.root_password != ""
- - main_server.hcloud_server.rescue_enabled is sameas true
-
-- name: absent server
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: absent
- register: result
-- name: verify absent server
- assert:
- that:
- - result is success
-
-- name: setup server
- hcloud_server:
- name: "{{ hcloud_server_name}}"
- server_type: cx11
- image: ubuntu-18.04
- state: started
- register: main_server
-- name: verify setup server
- assert:
- that:
- - main_server is changed
- - main_server.hcloud_server.name == "{{ hcloud_server_name }}"
- - main_server.hcloud_server.server_type == "cx11"
- - main_server.hcloud_server.status == "running"
- - main_server.root_password != ""
-
-- name: test activate rescue mode with check_mode
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- rescue_mode: "linux64"
- ssh_keys:
- - ci@ansible.hetzner.cloud
- state: present
- register: main_server
- check_mode: true
-- name: verify activate rescue mode
- assert:
- that:
- - main_server is changed
-
-- name: test activate rescue mode
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- rescue_mode: "linux64"
- ssh_keys:
- - ci@ansible.hetzner.cloud
- state: present
- register: main_server
-- name: verify activate rescue mode
- assert:
- that:
- - main_server is changed
- - main_server.hcloud_server.rescue_enabled is sameas true
-
-- name: test disable rescue mode
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- ssh_keys:
- - ci@ansible.hetzner.cloud
- state: present
- register: main_server
-- name: verify activate rescue mode
- assert:
- that:
- - main_server is changed
- - main_server.hcloud_server.rescue_enabled is sameas false
-
-- name: test activate rescue mode without ssh keys
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- rescue_mode: "linux64"
- state: present
- register: main_server
-- name: verify activate rescue mode without ssh keys
- assert:
- that:
- - main_server is changed
- - main_server.hcloud_server.rescue_enabled is sameas true
-
-- name: cleanup
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: absent
- register: result
-- name: verify cleanup
- assert:
- that:
- - result is success
-
-- name: test create server with labels
- hcloud_server:
- name: "{{ hcloud_server_name}}"
- server_type: cx11
- image: "ubuntu-18.04"
- ssh_keys:
- - ci@ansible.hetzner.cloud
- labels:
- key: value
- mylabel: "val123"
- state: started
- register: main_server
-- name: verify create server with labels
- assert:
- that:
- - main_server is changed
- - main_server.hcloud_server.labels.key == "value"
- - main_server.hcloud_server.labels.mylabel == "val123"
-
-- name: test update server with labels
- hcloud_server:
- name: "{{ hcloud_server_name}}"
- server_type: cx11
- image: "ubuntu-18.04"
- ssh_keys:
- - ci@ansible.hetzner.cloud
- labels:
- key: other
- mylabel: "val123"
- state: started
- register: main_server
-- name: verify update server with labels
- assert:
- that:
- - main_server is changed
- - main_server.hcloud_server.labels.key == "other"
- - main_server.hcloud_server.labels.mylabel == "val123"
-
-- name: test update server with labels in other order
- hcloud_server:
- name: "{{ hcloud_server_name}}"
- server_type: cx11
- image: "ubuntu-18.04"
- ssh_keys:
- - ci@ansible.hetzner.cloud
- labels:
- mylabel: "val123"
- key: other
- state: started
- register: main_server
-- name: verify update server with labels in other order
- assert:
- that:
- - main_server is not changed
-
-- name: cleanup with labels
- hcloud_server:
- name: "{{ hcloud_server_name }}"
- state: absent
- register: result
-- name: verify cleanup
- assert:
- that:
- - result is success