mirror of https://github.com/ansible/ansible.git
Rename hcloud_*_facts to hcloud_*_info (#60926)
* Rename hcloud_datacenter_facts to hcloud_datacenter_info * Rename hcloud_location_facts to hcloud_location_info * Rename hcloud_image_facts to hcloud_image_info * Rename hcloud_floating_ip_facts to hcloud_floating_ip_info * Rename hcloud_server_type_facts to hcloud_server_type_info * Rename hcloud_server_facts to hcloud_server_info * Rename hcloud_ssh_key_facts to hcloud_ssh_key_info * Rename hcloud_volume_facts to hcloud_volume_info * Fix typo in hcloud_image_info * Add to porting guide and add changelog fragment * Reword porting guidepull/60437/head
parent
839e9019ef
commit
96199be96b
@ -0,0 +1,17 @@
|
||||
minor_changes:
|
||||
- The ``hcloud_datacenter_facts`` module has been renamed to ``hcloud_datacenter_info``.
|
||||
When called with the new name, the module no longer returns ``ansible_facts``.
|
||||
- The ``hcloud_floating_ip_facts`` module has been renamed to ``hcloud_floating_ip_info``.
|
||||
When called with the new name, the module no longer returns ``ansible_facts``.
|
||||
- The ``hcloud_image_facts`` module has been renamed to ``hcloud_image_info``.
|
||||
When called with the new name, the module no longer returns ``ansible_facts``.
|
||||
- The ``hcloud_location_facts`` module has been renamed to ``hcloud_location_info``.
|
||||
When called with the new name, the module no longer returns ``ansible_facts``.
|
||||
- The ``hcloud_server_facts`` module has been renamed to ``hcloud_server_info``.
|
||||
When called with the new name, the module no longer returns ``ansible_facts``.
|
||||
- The ``hcloud_server_type_facts`` module has been renamed to ``hcloud_server_type_info``.
|
||||
When called with the new name, the module no longer returns ``ansible_facts``.
|
||||
- The ``hcloud_ssh_key_facts`` module has been renamed to ``hcloud_ssh_key_info``.
|
||||
When called with the new name, the module no longer returns ``ansible_facts``.
|
||||
- The ``hcloud_volume_facts`` module has been renamed to ``hcloud_volume_info``.
|
||||
When called with the new name, the module no longer returns ``ansible_facts``.
|
@ -0,0 +1 @@
|
||||
hcloud_datacenter_info.py
|
@ -0,0 +1 @@
|
||||
hcloud_floating_ip_info.py
|
@ -0,0 +1 @@
|
||||
hcloud_image_info.py
|
@ -0,0 +1 @@
|
||||
hcloud_location_info.py
|
@ -0,0 +1 @@
|
||||
hcloud_server_info.py
|
@ -0,0 +1 @@
|
||||
hcloud_server_type_info.py
|
@ -0,0 +1 @@
|
||||
hcloud_ssh_key_info.py
|
@ -0,0 +1 @@
|
||||
hcloud_volume_info.py
|
@ -1,36 +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: test gather hcloud datacenter facts
|
||||
hcloud_datacenter_facts:
|
||||
|
||||
- name: verify test gather hcloud datacenter facts
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_datacenter_facts| list | count == 3
|
||||
|
||||
- name: test gather hcloud datacenter facts in check mode
|
||||
hcloud_datacenter_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud datacenter facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_datacenter_facts| list | count == 3
|
||||
|
||||
|
||||
- name: test gather hcloud datacenter facts with correct name
|
||||
hcloud_datacenter_facts:
|
||||
name: "{{hcloud_datacenter_name}}"
|
||||
- name: verify test gather hcloud datacenter with correct name
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_datacenter_facts|selectattr('name','equalto','{{ hcloud_datacenter_name }}') |selectattr('location','equalto','{{ hcloud_location_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud datacenter facts with correct id
|
||||
hcloud_datacenter_facts:
|
||||
id: "{{hcloud_datacenter_id}}"
|
||||
- name: verify test gather hcloud datacenter with correct id
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_datacenter_facts|selectattr('name','equalto','{{ hcloud_datacenter_name }}') | list | count == 1
|
@ -0,0 +1,40 @@
|
||||
# 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: test gather hcloud datacenter infos
|
||||
hcloud_datacenter_info:
|
||||
register: hcloud_datacenters
|
||||
|
||||
- name: verify test gather hcloud datacenter infos
|
||||
assert:
|
||||
that:
|
||||
- hcloud_datacenters.hcloud_datacenter_info| list | count == 3
|
||||
|
||||
- name: test gather hcloud datacenter infos in check mode
|
||||
hcloud_datacenter_info:
|
||||
register: hcloud_datacenters
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud datacenter infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_datacenters.hcloud_datacenter_info| list | count == 3
|
||||
|
||||
|
||||
- name: test gather hcloud datacenter infos with correct name
|
||||
hcloud_datacenter_info:
|
||||
name: "{{hcloud_datacenter_name}}"
|
||||
register: hcloud_datacenter
|
||||
- name: verify test gather hcloud datacenter with correct name
|
||||
assert:
|
||||
that:
|
||||
- hcloud_datacenter.hcloud_datacenter_info|selectattr('name','equalto','{{ hcloud_datacenter_name }}') |selectattr('location','equalto','{{ hcloud_location_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud datacenter infos with correct id
|
||||
hcloud_datacenter_info:
|
||||
id: "{{hcloud_datacenter_id}}"
|
||||
register: hcloud_datacenter
|
||||
- name: verify test gather hcloud datacenter with correct id
|
||||
assert:
|
||||
that:
|
||||
- hcloud_datacenter.hcloud_datacenter_info|selectattr('name','equalto','{{ hcloud_datacenter_name }}') | list | count == 1
|
@ -1,53 +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: test gather hcloud floating ip facts
|
||||
hcloud_floating_ip_facts:
|
||||
- name: verify test gather hcloud floating ip facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_floating_ip_facts| list | count == 1
|
||||
|
||||
- name: test gather hcloud floating ip facts in check mode
|
||||
hcloud_floating_ip_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud floating ip facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_floating_ip_facts| list | count == 1
|
||||
|
||||
|
||||
- name: test gather hcloud floating ip facts with correct label selector
|
||||
hcloud_floating_ip_facts:
|
||||
label_selector: "key=value"
|
||||
- name: verify test gather hcloud floating ip with correct label selector
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_floating_ip_facts|selectattr('description','equalto','{{ hcloud_test_floating_ip_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud floating ip facts with wrong label selector
|
||||
hcloud_floating_ip_facts:
|
||||
label_selector: "key!=value"
|
||||
- name: verify test gather hcloud floating ip with wrong label selector
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_floating_ip_facts | list | count == 0
|
||||
|
||||
- name: test gather hcloud floating ip facts with correct id
|
||||
hcloud_floating_ip_facts:
|
||||
id: "{{hcloud_test_floating_ip_id}}"
|
||||
- name: verify test gather hcloud floating ip with correct id
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_floating_ip_facts|selectattr('description','equalto','{{ hcloud_test_floating_ip_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud floating ip facts with wrong id
|
||||
hcloud_floating_ip_facts:
|
||||
id: "{{hcloud_test_floating_ip_id}}1"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify test gather hcloud floating ip with wrong id
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
@ -0,0 +1,58 @@
|
||||
# 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: test gather hcloud floating ip infos
|
||||
hcloud_floating_ip_info:
|
||||
register: hcloud_floating_ips
|
||||
- name: verify test gather hcloud floating ip infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_floating_ips.hcloud_floating_ip_info| list | count == 1
|
||||
|
||||
- name: test gather hcloud floating ip infos in check mode
|
||||
hcloud_floating_ip_info:
|
||||
check_mode: yes
|
||||
register: hcloud_floating_ips
|
||||
|
||||
- name: verify test gather hcloud floating ip infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_floating_ips.hcloud_floating_ip_info| list | count == 1
|
||||
|
||||
|
||||
- name: test gather hcloud floating ip infos with correct label selector
|
||||
hcloud_floating_ip_info:
|
||||
label_selector: "key=value"
|
||||
register: hcloud_floating_ips
|
||||
- name: verify test gather hcloud floating ip with correct label selector
|
||||
assert:
|
||||
that:
|
||||
- hcloud_floating_ips.hcloud_floating_ip_info|selectattr('description','equalto','{{ hcloud_test_floating_ip_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud floating ip infos with wrong label selector
|
||||
hcloud_floating_ip_info:
|
||||
label_selector: "key!=value"
|
||||
register: hcloud_floating_ips
|
||||
- name: verify test gather hcloud floating ip with wrong label selector
|
||||
assert:
|
||||
that:
|
||||
- hcloud_floating_ips.hcloud_floating_ip_info | list | count == 0
|
||||
|
||||
- name: test gather hcloud floating ip infos with correct id
|
||||
hcloud_floating_ip_info:
|
||||
id: "{{hcloud_test_floating_ip_id}}"
|
||||
register: hcloud_floating_ips
|
||||
- name: verify test gather hcloud floating ip with correct id
|
||||
assert:
|
||||
that:
|
||||
- hcloud_floating_ips.hcloud_floating_ip_info|selectattr('description','equalto','{{ hcloud_test_floating_ip_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud floating ip infos with wrong id
|
||||
hcloud_floating_ip_info:
|
||||
id: "{{hcloud_test_floating_ip_id}}1"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify test gather hcloud floating ip with wrong id
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
@ -1,57 +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: test gather hcloud image facts with type system
|
||||
hcloud_image_facts:
|
||||
- name: verify test gather hcloud image facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_image_facts| list | count > 2
|
||||
|
||||
- name: test gather hcloud image facts in check mode
|
||||
hcloud_image_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud image facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_image_facts| list | count > 2
|
||||
|
||||
|
||||
- name: test gather hcloud image facts with correct label selector
|
||||
hcloud_image_facts:
|
||||
label_selector: "key=value"
|
||||
type: snapshot
|
||||
- name: verify test gather hcloud image with correct label selector
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_image_facts|selectattr('description','equalto','{{ hcloud_test_image_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud image facts with wrong label selector
|
||||
hcloud_image_facts:
|
||||
label_selector: "key!=value"
|
||||
type: snapshot
|
||||
- name: verify test gather hcloud image with wrong label selector
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_image_facts | list | count == 0
|
||||
|
||||
- name: test gather hcloud image facts with correct id
|
||||
hcloud_image_facts:
|
||||
id: "{{hcloud_test_image_id}}"
|
||||
type: snapshot
|
||||
- name: verify test gather hcloud image with correct id
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_image_facts|selectattr('description','equalto','{{ hcloud_test_image_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud image facts with wrong id
|
||||
hcloud_image_facts:
|
||||
id: "{{hcloud_test_image_id}}1"
|
||||
type: snapshot
|
||||
ignore_errors: yes
|
||||
register: result
|
||||
- name: verify test gather hcloud image with wrong id
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
@ -0,0 +1,62 @@
|
||||
# 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: test gather hcloud image infos with type system
|
||||
hcloud_image_info:
|
||||
register: hcloud_images
|
||||
- name: verify test gather hcloud image infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_images.hcloud_image_info| list | count > 2
|
||||
|
||||
- name: test gather hcloud image infos in check mode
|
||||
hcloud_image_info:
|
||||
check_mode: yes
|
||||
register: hcloud_images
|
||||
|
||||
- name: verify test gather hcloud image infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_images.hcloud_image_info| list | count > 2
|
||||
|
||||
|
||||
- name: test gather hcloud image infos with correct label selector
|
||||
hcloud_image_info:
|
||||
label_selector: "key=value"
|
||||
type: snapshot
|
||||
register: hcloud_images
|
||||
- name: verify test gather hcloud image with correct label selector
|
||||
assert:
|
||||
that:
|
||||
- hcloud_images.hcloud_image_info|selectattr('description','equalto','{{ hcloud_test_image_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud image infos with wrong label selector
|
||||
hcloud_image_info:
|
||||
label_selector: "key!=value"
|
||||
type: snapshot
|
||||
register: hcloud_images
|
||||
- name: verify test gather hcloud image with wrong label selector
|
||||
assert:
|
||||
that:
|
||||
- hcloud_images.hcloud_image_info | list | count == 0
|
||||
|
||||
- name: test gather hcloud image infos with correct id
|
||||
hcloud_image_info:
|
||||
id: "{{hcloud_test_image_id}}"
|
||||
type: snapshot
|
||||
register: hcloud_images
|
||||
- name: verify test gather hcloud image with correct id
|
||||
assert:
|
||||
that:
|
||||
- hcloud_images.hcloud_image_info|selectattr('description','equalto','{{ hcloud_test_image_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud image infos with wrong id
|
||||
hcloud_image_info:
|
||||
id: "{{hcloud_test_image_id}}1"
|
||||
type: snapshot
|
||||
ignore_errors: yes
|
||||
register: result
|
||||
- name: verify test gather hcloud image with wrong id
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
@ -1,52 +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: test gather hcloud location facts
|
||||
hcloud_location_facts:
|
||||
|
||||
- name: verify test gather hcloud location facts
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_location_facts| list | count == 3
|
||||
|
||||
- name: test gather hcloud location facts in check mode
|
||||
hcloud_location_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud location facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_location_facts| list | count == 3
|
||||
|
||||
|
||||
- name: test gather hcloud location facts with correct name
|
||||
hcloud_location_facts:
|
||||
name: "{{hcloud_location_name}}"
|
||||
- name: verify test gather hcloud location with correct name
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_location_facts|selectattr('name','equalto','{{ hcloud_location_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud location facts with wrong name
|
||||
hcloud_location_facts:
|
||||
name: "{{hcloud_location_name}}1"
|
||||
- name: verify test gather hcloud location with wrong name
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_location_facts | list | count == 0
|
||||
|
||||
- name: test gather hcloud location facts with correct id
|
||||
hcloud_location_facts:
|
||||
id: "{{hcloud_location_id}}"
|
||||
- name: verify test gather hcloud location with correct id
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_location_facts|selectattr('name','equalto','{{ hcloud_location_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud location facts with wrong id
|
||||
hcloud_location_facts:
|
||||
name: "4711"
|
||||
- name: verify test gather hcloud location with wrong id
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_location_facts | list | count == 0
|
@ -0,0 +1,57 @@
|
||||
# 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: test gather hcloud location infos
|
||||
hcloud_location_info:
|
||||
register: hcloud_location
|
||||
|
||||
- name: verify test gather hcloud location infos
|
||||
assert:
|
||||
that:
|
||||
- hcloud_location.hcloud_location_info | list | count == 3
|
||||
|
||||
- name: test gather hcloud location infos in check mode
|
||||
hcloud_location_info:
|
||||
check_mode: yes
|
||||
register: hcloud_location
|
||||
|
||||
- name: verify test gather hcloud location infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_location.hcloud_location_info | list | count == 3
|
||||
|
||||
- name: test gather hcloud location infos with correct name
|
||||
hcloud_location_info:
|
||||
name: "{{hcloud_location_name}}"
|
||||
register: hcloud_location
|
||||
- name: verify test gather hcloud location with correct name
|
||||
assert:
|
||||
that:
|
||||
- hcloud_location.hcloud_location_info|selectattr('name','equalto','{{ hcloud_location_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud location infos with wrong name
|
||||
hcloud_location_info:
|
||||
name: "{{hcloud_location_name}}1"
|
||||
register: hcloud_location
|
||||
- name: verify test gather hcloud location with wrong name
|
||||
assert:
|
||||
that:
|
||||
- hcloud_location.hcloud_location_info | list | count == 0
|
||||
|
||||
- name: test gather hcloud location infos with correct id
|
||||
hcloud_location_info:
|
||||
id: "{{hcloud_location_id}}"
|
||||
register: hcloud_location
|
||||
- name: verify test gather hcloud location with correct id
|
||||
assert:
|
||||
that:
|
||||
- hcloud_location.hcloud_location_info|selectattr('name','equalto','{{ hcloud_location_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud location infos with wrong id
|
||||
hcloud_location_info:
|
||||
name: "4711"
|
||||
register: hcloud_location
|
||||
- name: verify test gather hcloud location with wrong id
|
||||
assert:
|
||||
that:
|
||||
- hcloud_location.hcloud_location_info | list | count == 0
|
@ -1,90 +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 ensure server is absent
|
||||
hcloud_server:
|
||||
name: "{{ hcloud_server_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: create server
|
||||
hcloud_server:
|
||||
name: "{{ hcloud_server_name }}"
|
||||
server_type: cx11
|
||||
image: ubuntu-18.04
|
||||
state: started
|
||||
labels:
|
||||
key: value
|
||||
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 gather hcloud server facts in check mode
|
||||
hcloud_server_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud server facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_facts|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1
|
||||
|
||||
|
||||
- name: test gather hcloud server facts with correct label selector
|
||||
hcloud_server_facts:
|
||||
label_selector: "key=value"
|
||||
- name: verify test gather hcloud server with correct label selector
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_facts|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud server facts with wrong label selector
|
||||
hcloud_server_facts:
|
||||
label_selector: "key!=value"
|
||||
- name: verify test gather hcloud server with wrong label selector
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_facts | list | count == 0
|
||||
|
||||
- name: test gather hcloud server facts with correct name
|
||||
hcloud_server_facts:
|
||||
name: "{{hcloud_server_name}}"
|
||||
- name: verify test gather hcloud server with correct name
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_facts|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud server facts with wrong name
|
||||
hcloud_server_facts:
|
||||
name: "{{hcloud_server_name}}1"
|
||||
- name: verify test gather hcloud server with wrong name
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_facts | list | count == 0
|
||||
|
||||
- name: test gather hcloud server facts with correct id
|
||||
hcloud_server_facts:
|
||||
id: "{{main_server.hcloud_server.id}}"
|
||||
- name: verify test gather hcloud server with correct id
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_facts|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud server facts with wrong id
|
||||
hcloud_server_facts:
|
||||
name: "4711"
|
||||
- name: verify test gather hcloud server with wrong id
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_facts | list | count == 0
|
||||
|
||||
- name: cleanup
|
||||
hcloud_server:
|
||||
name: "{{ hcloud_server_name }}"
|
||||
state: absent
|
@ -0,0 +1,97 @@
|
||||
# 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 ensure server is absent
|
||||
hcloud_server:
|
||||
name: "{{ hcloud_server_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: create server
|
||||
hcloud_server:
|
||||
name: "{{ hcloud_server_name }}"
|
||||
server_type: cx11
|
||||
image: ubuntu-18.04
|
||||
state: started
|
||||
labels:
|
||||
key: value
|
||||
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 gather hcloud server infos in check mode
|
||||
hcloud_server_info:
|
||||
register: hcloud_server
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud server infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server.hcloud_server_info|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1
|
||||
|
||||
|
||||
- name: test gather hcloud server infos with correct label selector
|
||||
hcloud_server_info:
|
||||
label_selector: "key=value"
|
||||
register: hcloud_server
|
||||
- name: verify test gather hcloud server infos with correct label selector
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server.hcloud_server_info|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud server infos with wrong label selector
|
||||
hcloud_server_info:
|
||||
label_selector: "key!=value"
|
||||
register: hcloud_server
|
||||
- name: verify test gather hcloud server infos with wrong label selector
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server.hcloud_server_info | list | count == 0
|
||||
|
||||
- name: test gather hcloud server infos with correct name
|
||||
hcloud_server_info:
|
||||
name: "{{hcloud_server_name}}"
|
||||
register: hcloud_server
|
||||
- name: verify test gather hcloud server infos with correct name
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server.hcloud_server_info|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud server infos with wrong name
|
||||
hcloud_server_info:
|
||||
name: "{{hcloud_server_name}}1"
|
||||
register: hcloud_server
|
||||
- name: verify test gather hcloud server infos with wrong name
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server.hcloud_server_info | list | count == 0
|
||||
|
||||
- name: test gather hcloud server infos with correct id
|
||||
hcloud_server_info:
|
||||
id: "{{main_server.hcloud_server.id}}"
|
||||
register: hcloud_server
|
||||
- name: verify test gather hcloud server infos with correct id
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server.hcloud_server_info|selectattr('name','equalto','{{ hcloud_server_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud server infos with wrong id
|
||||
hcloud_server_info:
|
||||
name: "4711"
|
||||
register: hcloud_server
|
||||
- name: verify test gather hcloud server infos with wrong id
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server.hcloud_server_info | list | count == 0
|
||||
|
||||
- name: cleanup
|
||||
hcloud_server:
|
||||
name: "{{ hcloud_server_name }}"
|
||||
state: absent
|
@ -1,34 +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: test gather hcloud server type facts
|
||||
hcloud_server_type_facts:
|
||||
- name: verify test gather hcloud server type facts
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_type_facts| list | count > 2
|
||||
|
||||
- name: test gather hcloud server type facts in check mode
|
||||
hcloud_server_type_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud server type facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_type_facts| list | count > 2
|
||||
|
||||
- name: test gather hcloud server type facts with name
|
||||
hcloud_server_type_facts:
|
||||
name: "{{hcloud_server_type_name}}"
|
||||
- name: verify test gather hcloud server type with name
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_type_facts|selectattr('name','equalto','{{ hcloud_server_type_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud server type facts with correct id
|
||||
hcloud_server_type_facts:
|
||||
id: "{{hcloud_server_type_id}}"
|
||||
- name: verify test gather hcloud server type with correct id
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_server_type_facts|selectattr('name','equalto','{{ hcloud_server_type_name }}') | list | count == 1
|
@ -0,0 +1,38 @@
|
||||
# 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: test gather hcloud server type infos
|
||||
hcloud_server_type_info:
|
||||
register: hcloud_server_types
|
||||
- name: verify test gather hcloud server type infos
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server_types.hcloud_server_type_info| list | count > 2
|
||||
|
||||
- name: test gather hcloud server type infos in check mode
|
||||
hcloud_server_type_info:
|
||||
check_mode: yes
|
||||
register: hcloud_server_types
|
||||
|
||||
- name: verify test gather hcloud server type infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server_types.hcloud_server_type_info| list | count > 2
|
||||
|
||||
- name: test gather hcloud server type infos with name
|
||||
hcloud_server_type_info:
|
||||
name: "{{hcloud_server_type_name}}"
|
||||
register: hcloud_server_types
|
||||
- name: verify test gather hcloud server type with name
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server_types.hcloud_server_type_info|selectattr('name','equalto','{{ hcloud_server_type_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud server type infos with correct id
|
||||
hcloud_server_type_info:
|
||||
id: "{{hcloud_server_type_id}}"
|
||||
register: hcloud_server_types
|
||||
- name: verify test gather hcloud server type with correct id
|
||||
assert:
|
||||
that:
|
||||
- hcloud_server_types.hcloud_server_type_info|selectattr('name','equalto','{{ hcloud_server_type_name }}') | list | count == 1
|
@ -1,88 +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 ensure volume is absent
|
||||
hcloud_volume:
|
||||
name: "{{ hcloud_volume_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: setup volume
|
||||
hcloud_volume:
|
||||
name: "{{hcloud_volume_name}}"
|
||||
size: 10
|
||||
location: "fsn1"
|
||||
labels:
|
||||
key: value
|
||||
register: main_volume
|
||||
- name: verify setup volume
|
||||
assert:
|
||||
that:
|
||||
- main_volume is changed
|
||||
|
||||
- name: test gather hcloud volume facts in check mode
|
||||
hcloud_volume_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud volume facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_volume_facts|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud volume facts with correct label selector
|
||||
hcloud_volume_facts:
|
||||
label_selector: "key=value"
|
||||
- name: verify test gather hcloud volume with correct label selector
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_volume_facts|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud volume facts with wrong label selector
|
||||
hcloud_volume_facts:
|
||||
label_selector: "key!=value"
|
||||
- name: verify test gather hcloud volume with wrong label selector
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_volume_facts | list | count == 0
|
||||
|
||||
- name: test gather hcloud volume facts with correct name
|
||||
hcloud_volume_facts:
|
||||
name: "{{hcloud_volume_name}}"
|
||||
- name: verify test gather hcloud volume with correct name
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_volume_facts|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud volume facts with wrong name
|
||||
hcloud_volume_facts:
|
||||
name: "{{hcloud_volume_name}}1"
|
||||
- name: verify test gather hcloud volume with wrong name
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_volume_facts | list | count == 0
|
||||
|
||||
- name: test gather hcloud volume facts with correct id
|
||||
hcloud_volume_facts:
|
||||
id: "{{main_volume.hcloud_volume.id}}"
|
||||
- name: verify test gather hcloud volume with correct id
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_volume_facts|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud volume facts with wrong id
|
||||
hcloud_volume_facts:
|
||||
name: "4711"
|
||||
- name: verify test gather hcloud volume with wrong id
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.hcloud_volume_facts | list | count == 0
|
||||
|
||||
- name: cleanup
|
||||
hcloud_volume:
|
||||
name: "{{ hcloud_volume_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify cleanup
|
||||
assert:
|
||||
that:
|
||||
- result is success
|
@ -0,0 +1,95 @@
|
||||
# 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 ensure volume is absent
|
||||
hcloud_volume:
|
||||
name: "{{ hcloud_volume_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: setup volume
|
||||
hcloud_volume:
|
||||
name: "{{hcloud_volume_name}}"
|
||||
size: 10
|
||||
location: "fsn1"
|
||||
labels:
|
||||
key: value
|
||||
register: main_volume
|
||||
- name: verify setup volume
|
||||
assert:
|
||||
that:
|
||||
- main_volume is changed
|
||||
|
||||
- name: test gather hcloud volume infos in check mode
|
||||
hcloud_volume_info:
|
||||
register: hcloud_volume
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud volume infos in check mode
|
||||
assert:
|
||||
that:
|
||||
- hcloud_volume.hcloud_volume_info|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud volume infos with correct label selector
|
||||
hcloud_volume_info:
|
||||
label_selector: "key=value"
|
||||
register: hcloud_volume
|
||||
- name: verify test gather hcloud volume infos with correct label selector
|
||||
assert:
|
||||
that:
|
||||
- hcloud_volume.hcloud_volume_info|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud volume infos with wrong label selector
|
||||
hcloud_volume_info:
|
||||
label_selector: "key!=value"
|
||||
register: hcloud_volume
|
||||
- name: verify test gather hcloud volume infos with wrong label selector
|
||||
assert:
|
||||
that:
|
||||
- hcloud_volume.hcloud_volume_info | list | count == 0
|
||||
|
||||
- name: test gather hcloud volume infos with correct name
|
||||
hcloud_volume_info:
|
||||
name: "{{hcloud_volume_name}}"
|
||||
register: hcloud_volume
|
||||
- name: verify test gather hcloud volume infos with correct name
|
||||
assert:
|
||||
that:
|
||||
- hcloud_volume.hcloud_volume_info|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud volume infos with wrong name
|
||||
hcloud_volume_info:
|
||||
name: "{{hcloud_volume_name}}1"
|
||||
register: hcloud_volume
|
||||
- name: verify test gather hcloud volume infos with wrong name
|
||||
assert:
|
||||
that:
|
||||
- hcloud_volume.hcloud_volume_info | list | count == 0
|
||||
|
||||
- name: test gather hcloud volume facts with correct id
|
||||
hcloud_volume_info:
|
||||
id: "{{main_volume.hcloud_volume.id}}"
|
||||
register: hcloud_volume
|
||||
- name: verify test gather hcloud volume with correct id
|
||||
assert:
|
||||
that:
|
||||
- hcloud_volume.hcloud_volume_info|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1
|
||||
|
||||
- name: test gather hcloud volume infos with wrong id
|
||||
hcloud_volume_info:
|
||||
name: "4711"
|
||||
register: hcloud_volume
|
||||
- name: verify test gather hcloud volume infos with wrong id
|
||||
assert:
|
||||
that:
|
||||
- hcloud_volume.hcloud_volume_info | list | count == 0
|
||||
|
||||
- name: cleanup
|
||||
hcloud_volume:
|
||||
name: "{{ hcloud_volume_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify cleanup
|
||||
assert:
|
||||
that:
|
||||
- result is success
|
Loading…
Reference in New Issue