mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
hcloud: Add labels support to hcloud_server (#53514)
This commit is contained in:
parent
8c33ba3ecd
commit
d4bd01c7ac
2 changed files with 60 additions and 0 deletions
|
@ -273,3 +273,51 @@
|
|||
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: 123
|
||||
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 == 123
|
||||
|
||||
- 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: 123
|
||||
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 == 123
|
||||
|
||||
- name: cleanup with labels
|
||||
hcloud_server:
|
||||
name: "{{ hcloud_server_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify cleanup
|
||||
assert:
|
||||
that:
|
||||
- result is success
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue