Commit graph

56 commits

Author SHA1 Message Date
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
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
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
Konstantin Köhring
ad8958a2ad
Add possibility to specify private network when creating or updating servers (#160)
* Add possibility to specify private network when creating or updating a server

This allows creating servers without public internet access

* Add integration tests
2022-11-09 22:31:03 +01:00
Lukas Kämmerling
fc10dc5b31 Randomize dns test domain
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2022-07-13 12:45:41 +02:00
Lukas Kämmerling
6a7088cf42
- hcloud_server_info - fix crash when having servers without IPs (flexible networks) (#143)
- 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>
2022-07-13 08:54:55 +02:00
Lukas Kämmerling
0965f79093
Add support for Primary IPs (#141)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2022-06-29 09:58:01 +02:00
René Moser
c1ffc52556
tests: hcloud_datacenter_info: fix count should be 4 (#137) 2022-06-20 06:27:36 +02:00
René Moser
1d568f3ac7
loadbalancer_: improve error handlings (#138)
* loadbalancer_: improve error handlings

* streamline a bit to make ansible 2.9 pass

* handle race condition
2022-06-20 06:26:26 +02:00
Adrian Huber
b85f221340
Add support for LB DNS PTRs (#103)
* Add support for Load Balancer DNS PTRs 

* Add changelogs
2021-08-17 14:48:12 +02:00
Adrian Huber
7d3828837c
Placement groups (#102)
* 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
2021-08-16 12:31:02 +02:00
Adrian Huber
8cd7b9f997
Add description field to firewall rules (#101) 2021-08-12 13:13:19 +02:00
Adrian Huber
c1b3c0e5b1
Fix hcloud_certificate_info test (#100) 2021-08-10 20:44:26 +02:00
Lukas Kämmerling
2be9ff3240
hcloud_rdns improve error message on not existing server/Floating IP (#99)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2021-07-22 09:24:11 +02:00
Lukas Kämmerling
ffd998a0d6
hcloud_server: Improve Error Message when attaching a not existing firewall (#96) 2021-07-16 11:37:33 +02:00
Lukas Kämmerling
a3ee69a303
Improve handling of out rules in hcloud_firewall (#89)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2021-05-27 08:13:57 +02:00
Lukas Kämmerling
c5e8e980f6
cloud_server Improve error handling when using not existing server types (#81) 2021-04-22 10:24:41 +02:00
Lukas Kämmerling
04ef10041e
Fix compatibility of hcloud_server module with python version lower than python 3.6 (#80) 2021-04-22 08:39:34 +02:00
Lukas Kämmerling
ded9d9ddf8
hcloud_server - improve image handling (#74) 2021-04-07 08:15:10 +02:00
Lukas Kämmerling
e16ae06ea3
Add managed certs support (#72) 2021-04-06 11:59:59 +02:00
René Moser
cf4b59257a
hcloud_firewall, hcloud_server: fix idempotence (#71)
* hcloud_firewall, hcloud_server: extend tests for idempotence

* trigger tests

* hcloud_firewall, hcloud_server: fix idempotency
2021-04-06 11:28:38 +02:00
Lukas Kämmerling
3c3a4771a7
Implement Firewall Support (#63)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2021-03-11 11:07:41 +01:00
Lukas Kämmerling
eb45ae014c
Fix error handling and add test cases (#58)
* Fix error handling and add test cases

Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2021-02-24 13:37:58 +01:00
Lukas Kämmerling
f59c76de2b
Improve Error handling on SSH Key creation (#57) 2021-02-23 10:05:32 +01:00
Lukas Kämmerling
857a9ce526
Allow updating hcloud_server_network (#42)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2020-11-30 09:42:33 +01:00
Lukas Kämmerling
0617bc65f8
Add hcloud_load_balancer_info module (#41)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2020-11-27 12:25:06 +01:00
Lukas Kämmerling
207d68677a
Add vswitch Integration (#35)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2020-11-06 11:00:16 +01:00
ohdearaugustin
e59b91ca86
Fix Floating IP assignment is not idempotent (#32) 2020-10-05 11:09:00 +02:00
Lukas Kämmerling
fe84174cb6
Allow creating resources with protection (#30)
* Allow all supporting resources to be created with protection

Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2020-10-01 11:09:51 +02:00
Lukas Kämmerling
87d989fcbe
Allow setting Floating IP RDNS entries with hcloud_rdns (#27)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2020-09-08 08:13:10 +02:00
Lukas Kämmerling
603ecbe92b
Implement Label Selector and IP Targets (#23) 2020-08-11 16:16:02 +02:00
Lukas Kämmerling
9deba9db7a
hcloud_load_balancer Allow changing the type of a Load Balancer (#21)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2020-08-10 09:58:30 +02:00
Lukas Kämmerling
19257f6d43
Update sanity test requirements (#18) 2020-08-10 09:04:59 +02:00