From 38b7c80217c4e72b1d8988eb1e60bb6e77334114 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 18 Apr 2024 07:52:22 +0200 Subject: Adding upstream version 9.4.0+dfsg. Signed-off-by: Daniel Baumann --- .../hetzner/hcloud/docs/docsite/rst/guides.rst | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 ansible_collections/hetzner/hcloud/docs/docsite/rst/guides.rst (limited to 'ansible_collections/hetzner/hcloud/docs/docsite/rst') diff --git a/ansible_collections/hetzner/hcloud/docs/docsite/rst/guides.rst b/ansible_collections/hetzner/hcloud/docs/docsite/rst/guides.rst new file mode 100644 index 000000000..14e6b2f05 --- /dev/null +++ b/ansible_collections/hetzner/hcloud/docs/docsite/rst/guides.rst @@ -0,0 +1,50 @@ +.. _ansible_collections.hetzner.hcloud.docsite.authentication: + +Authentication +============== + +To `authenticate the API call against the Hetzner Cloud API `_ when +using the ``hetzner.hcloud`` collection, you can provide the API token by different means: + +You can pass the API token using an environment variable (recommended): + +.. code-block:: bash + + export HCLOUD_TOKEN='LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj' + + # Verify that your token is working + ansible -m hetzner.hcloud.location_info localhost + +Alternatively, you may provide the API token directly as module argument: + +.. code-block:: yaml + + - name: Create server + hetzner.hcloud.server: + api_token: LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj + name: my-server + server_type: cx11 + image: debian-12 + state: present + +To reduce the duplication of the above solution, you may configure the +``hetzner.hcloud.*`` modules using the ``hetzner.hcloud.all`` action group, for +example if you want to store your API token in a vault: + +.. code-block:: yaml + + - name: Demonstrate the usage of the 'hetzner.hcloud.all' module_defaults group + hosts: localhost + connection: local + + module_defaults: + group/hetzner.hcloud.all: + api_token: "{{ _vault_hcloud_api_token }}" + + tasks: + - name: Create server + hetzner.hcloud.server: + name: my-server + server_type: cx11 + image: debian-12 + state: present -- cgit v1.2.3