In some cases the server was still marked as locked after attaching it to
a placement_group. This caused potential follow up tasks that use the server
to fail.
This happened because the action returned by `add_to_placement_group()` was
not waited upon.
For the detach case this is handled correctly.
This variable matches the `ansible_host` variable that we set when
`connect_with: public_ipv6`, and allows the user to dynamically choose the
connection method in `compose`.
Currently if any of the servers in the inventory do not work with the
selected `connect_with` mode, the script exits and returns 0 servers.
This can happen for example if one of your servers does not have a public
ipv4 address, but you set `connect_with: public_ipv4` (default).
This commit changes the behaviour to log a warning message, and just skip
setting `ansible_host` for this server. This server will not be reachable
by ansible by default, but users can use `compose` to override the
`ansible_host` that we set based on the other variables.
This can be used in the `compose`, `groups` and `keyed_groups` settings
to dynamically build the inventory.
It also makes it possible for the user to override the `ansible_host`
in `compose`, based on wether or not the server has a public ipv4 address,
with fallback to the address in a specific private network.
* Add possibility to specify private network when creating or updating a server
This allows creating servers without public internet access
* Add integration tests
This fixes the behavior if there is a server without direct internet
connectivity in the examined network.
Previously, the module would throw an AttributeError because
server.public_net.ipv4/ipv6 is None in this case. Now the None propagates
correctly.
- hcloud_server - When state stopped and server is created, do not start the server
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
* Run tests on Python 3.9
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
* Use new test container
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
* Remove tests for Ansible 2.10 and earlier
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
* add status as an option to filter the server list
* Update plugins/inventory/hcloud.py
fix the sanity check
Co-authored-by: Lukas Kämmerling <github@lukas-kaemmerling.de>
Co-authored-by: Tagir Bakirov <tagir.bakirov@reservix.de>
Co-authored-by: Lukas Kämmerling <github@lukas-kaemmerling.de>
* Add placement_groups
* Create server with placement_group
* Add/remove server to/from placement_group
* Remove deprecated tmage test
* Add changelogs
* Add placement groups to hcloud_server_info
* Deprecate force_upgrade flag