ansible / ansible.builtin / v2.8.17 / module / hcloud_server Create and manage cloud servers on the Hetzner Cloud. | "added in version" 2.8 of ansible.builtin" Authors: Lukas Kaemmerling (@lkaemmerling) preview | supported by communityansible.builtin.hcloud_server (v2.8.17) — module
pip
Install with pip install ansible==2.8.17
Create, update and manage cloud servers on the Hetzner Cloud.
- name: Create a basic server hcloud_server: name: my-server server_type: cx11 image: ubuntu-18.04 state: present
- name: Create a basic server with ssh key hcloud_server: name: my-server server_type: cx11 image: ubuntu-18.04 location: fsn1 ssh_keys: - me@myorganisation state: present
- name: Resize an existing server hcloud_server: name: my-server server_type: cx21 keep_disk: yes state: present
- name: Ensure the server is absent (remove if needed) hcloud_server: name: my-server state: absent
- name: Ensure the server is started hcloud_server: name: my-server state: started
- name: Ensure the server is stopped hcloud_server: name: my-server state: stopped
- name: Ensure the server is restarted hcloud_server: name: my-server state: restarted
- name: Ensure the server is rebuild hcloud_server: name: my-server image: ubuntu-18.04 state: rebuild
id: description: - The ID of the Hetzner Cloud server to manage. - Only required if no server I(name) is given type: int name: description: - The Name of the Hetzner Cloud server to manage. - Only required if no server I(id) is given or a server does not exists. type: str image: description: - Image the server should be created from. - Required if server does not exists. type: str state: choices: - absent - present - restarted - started - stopped - rebuild default: present description: - State of the server. type: str labels: description: - User-defined labels (key-value pairs). type: dict backups: default: false description: - Enable or disable Backups for the given Server. type: bool volumes: description: - List of Volumes IDs that should be attached to the server on server creation. type: list endpoint: default: https://api.hetzner.cloud/v1 description: - This is the API Endpoint for the Hetzner Cloud. type: str location: description: - Location of Server. - Required if no I(datacenter) is given and server does not exists. type: str ssh_keys: description: - List of SSH key names - The key names correspond to the SSH keys configured for your Hetzner Cloud account access. type: list api_token: description: - This is the API Token for the Hetzner Cloud. - You can also set this option by using the environment variable HCLOUD_TOKEN required: true type: str user_data: description: - User Data to be passed to the server on creation. - Only used if server does not exists. type: str datacenter: description: - Datacenter of Server. - Required of no I(location) is given and server does not exists. type: str server_type: description: - The Server Type of the Hetzner Cloud server to manage. - Required if server does not exists. type: str upgrade_disk: default: false description: - Resize the disk size, when resizing a server. - If you want to downgrade the server later, this value should be False. type: bool force_upgrade: default: false description: - Force the upgrade of the server. - Power off the server if it is running on upgrade. type: bool
hcloud_server: description: The server instance returned: Always sample: backup_window: null datacenter: nbg1-dc3 id: 1937415 image: ubuntu-18.04 ipv4_address: 116.203.104.109 ipv6: 2a01:4f8:1c1c:c140::/64 labels: {} location: nbg1 name: mein-server-2 rescue_enabled: false server_type: cx11 status: running type: dict