Commit graph

104 commits

Author SHA1 Message Date
Jonas L
cf52215864
chore: add dev target helper (#457)
##### SUMMARY

Adds a helper to configure the dev env. For example reexporting a
hcloud_token and reload the integration tests configuration:
```bash
export HCLOUD_TOKEN="$(get-tmp-hcloud-token)"
make dev
```
2024-02-06 14:04:18 +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
96f8009214
feat!: drop support for ansible-core 2.13 (#450)
##### SUMMARY

ansible-core 2.13 is EOL since 6 November 2023.

Fixes #400


https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
2024-02-05 14:26:04 +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
9495b9f25a
docs: improve hcloud inventory documentation (#434)
##### SUMMARY

- Re add some examples that were removed during a dep upgrade.
- Improve link to other reference (plugins/modules/options)
- Remove duplicate docs.
2023-12-21 17:49:24 +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
df8c3b6a59
refactor: add future annotations imports (#398)
##### SUMMARY

This adds future annotations imports to benefit from the modern python
typing system.
2023-11-23 14:53:10 +01:00
Jonas L
7c9fbf85a7
feat: rename api_endpoint module argument (#395)
##### SUMMARY

Make the api endpoint module argument consistent with the api token. 
- Renamed the `endpoint` module argument to `api_endpoint`, backward
compatibility is maintained using an alias.
- Allow to configure it using the `HCLOUD_ENDPOINT` env var.

This makes the inventory config and the modules config a bit more
consistent.

##### ISSUE TYPE

- Feature Pull Request
2023-11-21 10:13:21 +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
f47e49c132
test: fix AnsibleHCloud module unit tests (#337)
##### SUMMARY

We had a race condition between 2 Pull Requests (#336 and #325) and
everything didn't go through the test pipeline. Fixing it now.
2023-09-26 15:44:49 +02:00
Jonas L
9a44bc260f
ci: add unit tests to azure pipelines (#325)
##### SUMMARY

Enable unit testing in the CI. We started to write some unit tests for
the inventory, but they were not enforced in the CI.
2023-09-26 09:41:19 +02:00
Jonas L
94190ae6cb
refactor: move module vars out of __init__ (#336)
##### SUMMARY

- move module vars out of `__init__`
- add modules type hints
- catch hcloud exception for api calls
2023-09-26 09:41:01 +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
a0e91d942a
refactor: rename ansible module classes (#284)
* refactor: rename Hcloud class to AnsibleHCloud

* refactor: rename AnsibleHCloud* modules

* refactor: remove Hcloud deprecation wrapper
2023-08-04 09:24:14 +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
1b83de57ef
chore: add shell pre-commit hooks (#277)
* chore: add shell pre-commit hooks

* chore: fix shell script linting errors
2023-08-02 12:04:20 +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
c15377c672
feat: improve hcloud library exceptions handling (#243) 2023-07-20 14:34: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
73b955c091
feat: drop support for python3.7 (#270) 2023-07-19 14:28:21 +02:00
Jonas L
2946f778e2
test: ignore sanity tests for test scripts (#271) 2023-07-19 14:07:41 +02:00
Jonas L
8a6157e8b2
feat: vendor hcloud python dependency (#244)
* chore: ignore venv directories

* chore: ignore integration test generated inventory

* feat: vendor hcloud package

* import https://github.com/hetznercloud/hcloud-python

* use vendored hcloud in modules

* update integration test requirements

* make vendor script self contained

* chore: add  check-hcloud-vendor pre-commit hook

* pin hcloud version to v.1.24.0

* move vendored __version__.py file to _version.py

* update comment about galaxy-importer filename lint
2023-07-11 11:15:08 +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
8672df2a49
test: fix ansible-tests requirements file (#241) 2023-06-28 10:51:31 +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
e83997517d
test: support python >=3.7 for ansible-test (#235)
* test: only test for python >=3.7

* refactor: remove python 2 utc timezone workaround
2023-06-23 14:43:42 +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