mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
Allow the creation of servers with enabled backups (#16)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
This commit is contained in:
parent
c2c6065ca3
commit
64c99d9759
3 changed files with 33 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- hcloud_server Allow the creation of servers with enabled backups
|
||||
|
|
@ -352,6 +352,11 @@ class AnsibleHcloudServer(Hcloud):
|
|||
self._get_server()
|
||||
self._set_rescue_mode(rescue_mode)
|
||||
|
||||
backups = self.module.params.get("backups")
|
||||
if backups:
|
||||
self._get_server()
|
||||
self.hcloud_server.enable_backup().wait_until_finished()
|
||||
|
||||
self._mark_as_changed()
|
||||
self._get_server()
|
||||
|
||||
|
|
|
|||
|
|
@ -563,3 +563,29 @@
|
|||
assert:
|
||||
that:
|
||||
- result is success
|
||||
|
||||
- name: test create server with enabled backups
|
||||
hcloud_server:
|
||||
name: "{{ hcloud_server_name }}"
|
||||
server_type: cpx11
|
||||
backups: true
|
||||
image: "ubuntu-18.04"
|
||||
ssh_keys:
|
||||
- ci@ansible.hetzner.cloud
|
||||
state: present
|
||||
register: result
|
||||
- name: verify enable backups
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.hcloud_server.backup_window != ""
|
||||
|
||||
- name: test create server with enabled backups
|
||||
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