mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-03 23:51:48 +00:00
The CX Gen 2 and CPX Gen 1 types are deprecated and will be removed from the API at the end of the year. This replaces all usages in our docs, so users do not have to figure it out themselves. Changelog Entry: https://docs.hetzner.cloud/changelog#2025-10-16-server-types-deprecated Co-authored-by: Petteri Räty <github@petteriraty.eu>
35 lines
1,005 B
YAML
35 lines
1,005 B
YAML
---
|
|
- name: Validate server type
|
|
hosts: localhost
|
|
connection: local
|
|
tasks:
|
|
- name: Fetch location info
|
|
hetzner.hcloud.location_info:
|
|
name: fsn1
|
|
register: location
|
|
|
|
- name: Fetch server type info
|
|
hetzner.hcloud.server_type_info:
|
|
name: cpx22
|
|
register: server_type
|
|
|
|
- name: Ensure server type exists
|
|
ansible.builtin.assert:
|
|
fail_msg: server type does not exists
|
|
that:
|
|
- server_type.hcloud_server_type_info | count == 1
|
|
|
|
- name: Extract server type location info
|
|
ansible.builtin.set_fact:
|
|
server_type_location: >
|
|
{{
|
|
server_type.hcloud_server_type_info[0].locations
|
|
| selectattr("name", "eq", location.hcloud_location_info[0].name)
|
|
| first
|
|
}}
|
|
|
|
- name: Ensure server type is not deprecated
|
|
ansible.builtin.assert:
|
|
fail_msg: server type is deprecated in location
|
|
that:
|
|
- server_type_location.deprecation is none
|