mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
##### SUMMARY Add a new state for server creation without immediate start, to allow idempotent network customization before starting ##### ISSUE TYPE - Feature Pull Request ##### COMPONENT NAME server --------- Co-authored-by: jo <ljonas@riseup.net>
24 lines
687 B
YAML
24 lines
687 B
YAML
---
|
|
- name: Create test_server
|
|
hetzner.hcloud.server:
|
|
name: "{{ hcloud_server_name }}"
|
|
server_type: "{{ hcloud_server_type_name }}"
|
|
image: "{{ hcloud_image_name }}"
|
|
location: "{{ hcloud_location_name }}"
|
|
state: created
|
|
register: test_server
|
|
|
|
- name: Create test_snapshot
|
|
ansible.builtin.script:
|
|
cmd: >
|
|
{{ hcloud_cli_path }} server create-image
|
|
--type snapshot
|
|
--description "{{ hcloud_snapshot_name }}"
|
|
--label key=value
|
|
"{{ test_server.hcloud_server.id }}"
|
|
| awk '{print $2}'
|
|
register: test_snapshot
|
|
|
|
- name: Set test_snapshot_id
|
|
ansible.builtin.set_fact:
|
|
test_snapshot_id: "{{ test_snapshot.stdout_lines[0] }}"
|