1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 08:01:49 +00:00

feat: Add integration test for force create ssh-key

with new public_key if key name already exists
This commit is contained in:
shaerpour 2025-05-14 12:34:10 +03:30
parent 728f69bd14
commit 2475969579
No known key found for this signature in database
GPG key ID: D89285D72B39ED8F

View file

@ -93,7 +93,7 @@
key: value
test: "val123"
register: result
- name: test update ssh key with other labels
- name: test update ssh key with other labels
assert:
that:
- result is changed
@ -136,6 +136,31 @@
- result is failed
- result.failure.code == "uniqueness_error"
- name: test force update ssh key with new public key with check mode
hetzner.hcloud.ssh_key:
name: "{{ hcloud_ssh_key_name }}-other-name"
public_key: "{{ test_ssh_keypair_2.public_key }}"
force: true
register: result
check_mode: true
- name: verify force update ssh key with new public key with check mode
assert:
that:
- result is changed
- name: test force update ssh key with new public key
hetzner.hcloud.ssh_key:
name: "{{ hcloud_ssh_key_name }}-other-name"
public_key: "{{ test_ssh_keypair_2.public_key }}"
force: true
register: ssh_key
- name: verify force update ssh key with new public key
assert:
that:
- ssh_key is changed
- ssh_key.hcloud_ssh_key.name == "{{ hcloud_ssh_key_name }}-other-name"
- ssh_key.hcloud_ssh_key.public_key == test_ssh_keypair_2.public_key
- name: test delete ssh key
hetzner.hcloud.ssh_key:
id: "{{ ssh_key.hcloud_ssh_key.id }}"