Commit graph

85 commits

Author SHA1 Message Date
Jonas L
00a4fdd58a
fix: use empty string to remove server from its placement group (#489)
##### SUMMARY
- Do not remove the server from its placement group when the
`placement_group` argument is not specified.
- Pass an empty string to the `placement_group` argument to remove a
server from its placement group.
2024-04-04 16:53:32 +02:00
Jonas L
8738f369d3
test: check for api error code when possible (#486)
##### SUMMARY

Ensure the error code is correct and replace the error message check in
some cases.
2024-04-04 11:55:45 +02:00
Jonas L
7776905321
test: force firewall cleanup before running server cleanup (#485)
##### SUMMARY

Cleanup the firewall before the server to prevent a server deletion
timeout.
2024-04-04 11:54:54 +02:00
Jonas L
cfdaa0fb82
test: disable fact gathering in integration tests (#482)
##### SUMMARY
This should speed up a little our integrations tests by not gather facts
before each test run.

Docs
https://docs.ansible.com/ansible/latest/dev_guide/testing/sanity/integration-aliases.html
2024-04-02 19:21:17 +02:00
jjeff07
51afb23166
feat: assign primary ip to a server on create (#465)
##### SUMMARY

Fixes #464 

##### ISSUE TYPE
- Feature Pull Request

##### COMPONENT NAME
primary_ip

---------

Co-authored-by: jo <ljonas@riseup.net>
2024-03-11 18:20:30 +01:00
Jonas L
46717e2d65
test: improve primary_ip integration using the testing framework (#468)
##### SUMMARY
Use the new testing framework for the primary ip integration tests.
2024-02-29 12:29:18 +01:00
Jonas L
b0cb1a665b
test: do not start server where possible (#461)
##### SUMMARY

Reduce test time by not starting servers when not required.
2024-02-08 17:37:47 +01:00
Jonas L
1ae6769210
fix: return sorted alias_ips in server_network module (#458)
##### SUMMARY

- test: use testing framework for server_network integration tests
- fix: return sorted alias_ips in server_network module

##### ISSUE TYPE

- Bugfix Pull Request


##### COMPONENT NAME

server_network
2024-02-07 11:45:37 +01:00
Jonas L
5358110ed3
test: use longer role namespace to prevent collision (#456)
##### SUMMARY

Use bigger roles namespace, by using the first 2 chars of each word:
`load_balancer_network` => `lobane`

For example, we have such cases:
- `rdns` => `r` => `rd`
- `route` => `r` => `ro`
2024-02-05 15:41:58 +01:00
Jonas L
866e0b564e
test: use testing framework for network integration tests (#448)
##### SUMMARY

Implement the new test framework for the network tests, and reenable the
network tests
2024-02-02 13:42:18 +01:00
Jonas L
559d31561a
feat: allow forcing the deletion of firewalls that are still in use (#447)
##### SUMMARY

  - Do not silence 'firewall still in use' deletions errors.
  - Allow forcing the deletion of a firewall that is still in use.

Fixes #380

##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME

firewall
2024-02-02 09:48:56 +01:00
Jonas L
2757fe745f
feat: improve firewall resources management (#324)
##### SUMMARY

  - firewall - Return resources the firewall is `applied_to`.
- firewall_info - Add new `firewall_info` module to gather firewalls
info.
- firewall_resource - Add new `firewall_resource` module to manage
firewalls resources.

Fixes #111

##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME

firewall
firewall_info
firewall_resource

---------

Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
2024-02-01 16:50:13 +01:00
Jonas L
3910785025
test: use testing framework for firewall integration tests (#425)
##### SUMMARY

Use the new testing framework for the firewall integration tests and fix
linting errors.
2023-12-15 15:25:35 +01:00
Jonas L
86e476f961
test: fix linting error for integrations setup roles (#426)
##### SUMMARY

Fix ansible lint error for the integrations setup roles.
2023-12-15 15:25:20 +01:00
Jonas L
fe4c924594
test: remove jinja templates where unnecessary (#420)
Attempt to fix the unsafe condition by removing unnecessary jinja
templates.

Example of failing CI:
https://dev.azure.com/ansible/hetzner.hcloud/_build/results?buildId=98486&view=logs&j=86ea7956-35b6-5577-ed45-fe20f8c6b276&t=a2e51dbe-b8d9-5c65-a584-138300c332b7&l=2562
2023-12-14 18:17:53 +01:00
Jonas L
4cfdf50b26
feat: replace ansible.netcommon utils with python3 ipaddress module (#416)
##### SUMMARY

Replace `ansible.netcommon` deprecated ipaddr utils with python
`ipaddress` module. The `ansible.netcommon` collection is no longer
required by the collections. We still use the `ansible.utils`
collections for testing
2023-12-12 11:50:45 +01:00
Jonas L
328dfb8b0f
refactor: start using new modules names (#393)
##### SUMMARY

Update all references to modules to use the new module names.
Continuation of #390
2023-11-21 09:40:11 +01:00
Jonas L
933a16249b
feat: remove hcloud_ prefix from all modules names (#390)
##### SUMMARY

This simplifies the name of the modules from
`hetzner.hcloud.hcloud_firewall` to `hetzner.hcloud.firewall`. While
maintaining backward compatibility with the old names.

Further changes such as updating the test or the documentation will be
done in a future PR to maintain the git history when squashing the PRs.

##### ISSUE TYPE

- Feature Pull Request
2023-11-20 13:21:23 +01:00
Jonas L
c336f47f80
test: improve rdns integration using the testing framework (#372)
##### SUMMARY

Use the new testing framework for the rdns integration tests.
2023-10-23 16:23:33 +02:00
Jonas L
a93dbaa428
feat: add load_balancer algorithm option (#368)
##### SUMMARY

Allow to configure load balancers algorithm.

Closes #289

Depends on #367 

##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME
hcloud_load_balancer
2023-10-20 12:20:09 +02:00
Jonas L
10a3e4f01e
test: rework load_balancer module tests (#367)
##### SUMMARY

Use the new testing framework and clean up the load_balancer tests.

---------

Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
2023-10-19 18:14:18 +02:00
Jonas L
5e425c56c2
feat: allow selecting a resource using its ID (#361)
##### SUMMARY

Allow referring to resources using their IDs for:
- hcloud_load_balancer_network
- hcloud_load_balancer_service
- hcloud_load_balancer_target
- hcloud_rdns
- hcloud_route
- hcloud_server_network
- hcloud_subnetwork


##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME
- hcloud_load_balancer_network
- hcloud_load_balancer_service
- hcloud_load_balancer_target
- hcloud_rdns
- hcloud_route
- hcloud_server_network
- hcloud_subnetwork
2023-10-18 10:28:42 +02:00
Jonas L
4044980477
test: fix vswitch subnets ip_range (#359)
##### SUMMARY

The vswitch subnet validation changed: the subnet ip_range must be
smaller than the network ip_range **AND** must not start with the same
IP.
 
See
https://github.com/ansible-collections/hetzner.hcloud/runs/17672011247

In addition, I reworked the tests to use the new testing framework.
2023-10-17 09:18:26 +02:00
Jonas L
76ef636f07
feat: add deprecation field to hcloud_iso_info (#357)
##### SUMMARY

See these changelog entries for the announcement:

-
https://docs.hetzner.cloud/changelog#2023-10-12-deprecation-info-for-isos
-
https://docs.hetzner.cloud/changelog#2023-10-12-field-deprecated-on-isos-is-now-deprecated


##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME
hcloud_iso_info
2023-10-16 11:16:31 +02:00
Jonas L
001c3e2089
ci: clean azp scripts (#340)
##### SUMMARY

Clean old scripts and simplify the CI scripts.
2023-09-27 08:59:26 +02:00
Jonas L
62ab0570c8
test: setup new temporary project service for integration tests (#316)
##### SUMMARY

Setup new temporary project service for integration tests.

- Use the hc-integrations-test.de domain for certificates creation
- Use new Hetzner account vSwitch
- Use new Hetzner account server IP
- Create snapshots during setup (instead of "always-there-snapshot")
2023-09-08 09:37:43 +02:00
Jonas L
5475a9929a
feat: target health status in hcloud_load_balancer_info (#305) 2023-08-17 15:25:14 +02:00
Jonas L
4bb2bb80fa
feat: query floating ip info by name (#303)
##### SUMMARY

Fixes #302 

The feature was missing, this make the floating_ip_info module consistent with what is expected to be implemented. 

##### ISSUE TYPE

- Feature Pull Request


##### COMPONENT NAME

floating_ip_info
2023-08-17 11:50:19 +02:00
Jonas L
8b24cf2522
test: improve *_info modules tests (#299)
##### SUMMARY

- Implement the new testing framework (prepare.yml/cleanup.yml #239)
- Fix some uncovered test scenarios (related to #298).
- Structure all the *_info tests using the following structure:
  ```
  gather all
  [gather all with custom options...]
  gather all in check mode
  gather with id
  gather with name
  gather with labels
  [gather with custom option...]
  ```
2023-08-17 09:44:33 +02:00
Jonas L
e461a890fa
fix: consistently fail on invalid ID in *_info modules (#301)
* fix: consistently fail on invalid ID in `*_info` modules

* remove unused import
2023-08-16 16:14:55 +02:00
Jonas L
5c4079e059
fix: do not error on location_info invalid id (#292)
* test: fix hcloud_location_info with wrong id test

* chore: cleanup hcloud_location_info tests

* fix: error on location_info invalid id
2023-08-09 12:42:22 +02:00
Jonas L
59fe4339d4
chore: add ansible-lint pre-commit hook (#293)
* chore: add ansible-lint pre-commit hook

* chore: galaxy.yml license field should be a list

* chore: fix ansible-lint errors
2023-08-09 11:32:23 +02:00
Jonas L
13868c364b
test: improve tests using new setup_ssh_keypair helper (#285)
* test: use new setup_ssh_keypair helper

Remove the previous setup_sshkey helper

* ci: fix tmp dir location to please chattr
2023-08-04 09:05:59 +02:00
Jonas L
020b3139b3
test: improve tests using setup_selfsigned_certificate (#286) 2023-08-04 09:01:50 +02:00
Jonas L
c5e0d429c5
test: implement integration testing framework (#239)
Fixes #203

The namespace used to differentiate the resources between CI pipelines, CI stages or even between test targets was broken and resulted in conflicting resource names. This PR ensure the resources names don't collide with each other by making sure we use the entire hcloud_prefix value as md5sum, and by including the target role names inside the resource names.

Create a setup/teardown framework to handle testing resources used by the tests.

To simplify the review process, additional changes such as splitting the setup/teardown task in the prepare.yml and cleanup.yml files will be done in future PRs (many files were renamed, and git will not preserve the file history after the PR squash).

* chore: move integrations targets files

* test: create integration common files

* test: fix resources name namespace using the magic hcloud_ns

* test: simplify requirements install

* test: rename hcloud_server test taskfiles
2023-07-26 16:09:48 +02:00
Jonas L
8243d25710
test: reorganize groups to balance test duration (#274)
Before:
```
     10 shippable/hcloud/group1
     19 shippable/hcloud/group2
      2 shippable/hcloud/group3
```

After:
```
      9 shippable/hcloud/group1
     14 shippable/hcloud/group2
      8 shippable/hcloud/group3
```
2023-07-20 13:58:09 +02:00
Jonas L
51f705c343
chore: use fqcn module names (#273) 2023-07-20 12:14:57 +02:00
Jonas L
98022020a1
feat: add hcloud_iso_info module (#237)
* 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>
2023-07-04 09:54:53 +02:00
Jonas L
939e039b9f
test: remove invalid tests collections requirements (#246) 2023-07-04 09:33:09 +02:00
Jonas L
dfff49e31f
chore: setup pre-commit (#234)
* chore: add pre-commit config

* chore: fix pre-commit errors

* chore: add black pre-commit hook

* style: format python files with black

* chore: add isort pre-commit hook

* style: format python files using isort

* chore: add pyupgrade pre-commit hook

* refactor: upgrade code to python3.7

* Allow stacking PRs

Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>

---------

Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
2023-06-27 11:50:13 +02:00
Jonas L
81129f373d
feat(network): add expose_routes_to_vswitch field (#232) 2023-06-22 13:09:10 +02:00
Jonas L
02516d9a7b
refactor: prefer true/false over yes/no (#226)
* style: format md and yml files using prettier

* refactor: prefer true/false over yes/no
2023-06-21 10:49:54 +02:00
Jonas L
97c84e93a4
test: clean ressources before testing (#228) 2023-06-21 10:39:11 +02:00
Jonas L
27821140d7
feat(primary_ip): add hcloud_primary_ip_info module (#225)
Co-authored-by: Kevin Castner <kcastner@kcastner.de>
2023-06-20 14:01:55 +02:00
Julian Tölle
23c2d7d228
ci: ubuntu-18.04 is deprecated/EOL (#224)
Update all references to ubuntu-18.04 (and 20.04) to 22.04, as ubuntu
18.04 is EOL and deprecated in Hetzner Cloud. This causes a CI failure
in the main branch:

https://dev.azure.com/ansible/hetzner.hcloud/_build/results?buildId=80941&view=logs&j=fdb818b8-39d8-529a-d9da-324e304604bc&t=2d52cce2-88ce-5057-da88-145e92cee00f&l=1094
2023-06-20 11:38:51 +02:00
Julian Tölle
082153a700
feat: Server Type Deprecation (#222)
* 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>
2023-06-20 11:38:38 +02:00
Julian Tölle
3c2d4df8bb
feat: add support for ARM APIs (#208)
* 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
2023-04-12 10:43:19 +02:00
Julian Tölle
9700099097
test: flaky test for hcloud_server private_network_only (#205)
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.
2023-04-03 12:40:55 +02:00
lrsksr
25bce7eabd
fix(server): prevent backups from being disabled when undefined (#196)
* 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>
2023-04-03 12:36:33 +02:00
Julian Tölle
e218306028
test: various fixes for integration tests (#193)
* 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.
2023-02-13 10:48:26 +01:00