* Added new command hcloud_isos_info.py to get informations from all ISOs on HETZNER cloud.
* continue iso_info implementation
* add changelog
* fixes and improvements
* remove return docs choices for ansible 2.12 support
* rebase changes
* fix wording
Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
* run tests in group3
Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
* docs: returned architecture field might be null
* unused/invalid community.general.ipfilter collection in tests
* update wording relevant -> supported
* apply rebase changes
---------
Co-authored-by: patlegu <3754859+patlegu@users.noreply.github.com>
Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
* feat(server_type_info): return deprecation info
Co-authored-by: jo <ljonas@riseup.net>
* feat(server): show warning if server-type is deprecated
Co-authored-by: jo <ljonas@riseup.net>
---------
Co-authored-by: jo <ljonas@riseup.net>
When using a deprecated image with the "allow_deprecated_image" flag,
the script would crash because the string interpolation was not done
correctly. The brackes were in the wrong place.
Error would look like this:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: unsupported operand type(s) for %: 'NoneType' and 'str'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/julian/.ansible/tmp/ansible-tmp-1686564668.6136558-165294-192879183382787/AnsiballZ_hcloud_server.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/julian/.ansible/tmp/ansible-tmp-1686564668.6136558-165294-192879183382787/AnsiballZ_hcloud_server.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/julian/.ansible/tmp/ansible-tmp-1686564668.6136558-165294-192879183382787/AnsiballZ_hcloud_server.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.hetzner.hcloud.plugins.modules.hcloud_server', init_globals=dict(_module_fqn='ansible_collections.hetzner.hcloud.plugins.modules.hcloud_server', _modlib_path=modlib_path),\n File \"/nix/store/95cxzy2hpizr23343b8bskl4yacf4b3l-python3-3.10.11/lib/python3.10/runpy.py\", line 224, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/nix/store/95cxzy2hpizr23343b8bskl4yacf4b3l-python3-3.10.11/lib/python3.10/runpy.py\", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/nix/store/95cxzy2hpizr23343b8bskl4yacf4b3l-python3-3.10.11/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/run/user/1000/ansible_hcloud_server_payload_1g2rf66q/ansible_hcloud_server_payload.zip/ansible_collections/hetzner/hcloud/plugins/modules/hcloud_server.py\", line 927, in <module>\n File \"/run/user/1000/ansible_hcloud_server_payload_1g2rf66q/ansible_hcloud_server_payload.zip/ansible_collections/hetzner/hcloud/plugins/modules/hcloud_server.py\", line 908, in main\n File \"/run/user/1000/ansible_hcloud_server_payload_1g2rf66q/ansible_hcloud_server_payload.zip/ansible_collections/hetzner/hcloud/plugins/modules/hcloud_server.py\", line 843, in present_server\n File \"/run/user/1000/ansible_hcloud_server_payload_1g2rf66q/ansible_hcloud_server_payload.zip/ansible_collections/hetzner/hcloud/plugins/modules/hcloud_server.py\", line 411, in _create_server\n File \"/run/user/1000/ansible_hcloud_server_payload_1g2rf66q/ansible_hcloud_server_payload.zip/ansible_collections/hetzner/hcloud/plugins/modules/hcloud_server.py\", line 518, in _get_image\nTypeError: unsupported operand type(s) for %: 'NoneType' and 'str'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
Make sure that we only log the deprecation warning if force_upgrade was actually
set. Right now it also logs because a default value for the field is set.
* feat: add architecture fields for image & server type
* feat: filter images by architecture
* feat: select right image by arch on server create & rebuild
* feat(inventory): add architecture field to returned servers
* docs: add changelog for arm features
* chore: prepare v1.11.0
The server that was being handled could still exist from previous tests
running in the same suite. This can be fixed by making sure that the
server does not exist at the start of this test suite.
* fix(server): prevent backups from being disabled when undefined
With an existing server with backups enabled and the state being either
present, started, stopped, restarted or rebuild and the backups module
parameter not set, the module would disable backups and in turn delete
all existing backups.
The correct behaviour (leave backups untouched when parameter not set)
is implemented by this commit. Strong typing would have prevented this.
* test: verify fix works
---------
Co-authored-by: Julian Tölle <julian.toelle@hetzner-cloud.de>
* test: update for new locations
* test(cert): fix issues with random name failing the test
The variable hcloud_dns_test_domain used the random function to generate
a number from 1-100. This number changed between every usage of the
variable, so the test that compared the domain name of the cert to the
variable kept failing, as different numbers were generated.
By generating the number once and saving it into a fact, this is fixed.
* test: fix issues with long resource names
Server and volume names have restricted length (63 and 64 respectivly).
This can cause issues when the `hcloud_prefix` is of certain length. By
applying truncate, we can be sure to not reach the limit.
This issue mainly happened in our internal ci, as the hcloud_prefix variable
contains the hostname where the tests were running, and our hostnames are
quite long.
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.