Debian Codegraph @

ansible_collections/hetzner/hcloud/examples/validate-server-type.yml

raw
1 ---
2 - name: Validate server type
3 hosts: localhost
4 connection: local
5 tasks:
6 - name: Fetch location info
7 hetzner.hcloud.location_info:
8 name: fsn1
9 register: location
10
11 - name: Fetch server type info
12 hetzner.hcloud.server_type_info:
13 name: cpx22
14 register: server_type
15
16 - name: Ensure server type exists
17 ansible.builtin.assert:
18 fail_msg: server type does not exists
19 that:
20 - server_type.hcloud_server_type_info | count == 1
21
22 - name: Extract server type location info
23 ansible.builtin.set_fact:
24 server_type_location: >
25 {{
26 server_type.hcloud_server_type_info[0].locations
27 | selectattr("name", "eq", location.hcloud_location_info[0].name)
28 | first
29 }}
30
31 - name: Ensure server type is not deprecated
32 ansible.builtin.assert:
33 fail_msg: server type is deprecated in location
34 that:
35 - server_type_location.deprecation is none