mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
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
This commit is contained in:
parent
b0cb43fe5a
commit
4cfdf50b26
5 changed files with 26 additions and 22 deletions
|
|
@ -15,7 +15,7 @@
|
|||
- name: Test create with checkmode
|
||||
hetzner.hcloud.rdns:
|
||||
server: "{{ hcloud_server_name }}"
|
||||
ip_address: "{{ test_server.hcloud_server.ipv6 | ansible.netcommon.ipaddr('next_usable') }}"
|
||||
ip_address: "{{ test_server.hcloud_server.ipv6 | ansible.utils.ipaddr('next_usable') }}"
|
||||
dns_ptr: example.com
|
||||
state: present
|
||||
check_mode: true
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
- name: Test create
|
||||
hetzner.hcloud.rdns:
|
||||
server: "{{ hcloud_server_name }}"
|
||||
ip_address: "{{ test_server.hcloud_server.ipv6 | ansible.netcommon.ipaddr('next_usable') }}"
|
||||
ip_address: "{{ test_server.hcloud_server.ipv6 | ansible.utils.ipaddr('next_usable') }}"
|
||||
dns_ptr: example.com
|
||||
state: present
|
||||
register: result
|
||||
|
|
@ -37,13 +37,13 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.hcloud_rdns.server == "{{ hcloud_server_name }}"
|
||||
- result.hcloud_rdns.ip_address == "{{ test_server.hcloud_server.ipv6 | ansible.netcommon.ipaddr('next_usable') }}"
|
||||
- result.hcloud_rdns.ip_address == test_server.hcloud_server.ipv6 | ansible.utils.ipaddr('next_usable')
|
||||
- result.hcloud_rdns.dns_ptr == "example.com"
|
||||
|
||||
- name: Test create idempotency
|
||||
hetzner.hcloud.rdns:
|
||||
server: "{{ hcloud_server_name }}"
|
||||
ip_address: "{{ test_server.hcloud_server.ipv6 | ansible.netcommon.ipaddr('next_usable') }}"
|
||||
ip_address: "{{ test_server.hcloud_server.ipv6 | ansible.utils.ipaddr('next_usable') }}"
|
||||
dns_ptr: example.com
|
||||
state: present
|
||||
register: result
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.hcloud_rdns.ip_address == "{{ test_server.hcloud_server.ipv4_address }}"
|
||||
- result.hcloud_rdns.ip_address == test_server.hcloud_server.ipv4_address
|
||||
|
||||
- name: Test update reset
|
||||
hetzner.hcloud.rdns:
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
- name: Test delete
|
||||
hetzner.hcloud.rdns:
|
||||
server: "{{ hcloud_server_name }}"
|
||||
ip_address: "{{ test_server.hcloud_server.ipv6 | ansible.netcommon.ipaddr('next_usable') }}"
|
||||
ip_address: "{{ test_server.hcloud_server.ipv6 | ansible.utils.ipaddr('next_usable') }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: Verify delete
|
||||
|
|
@ -113,8 +113,8 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.hcloud_rdns.primary_ip == "{{ hcloud_primary_ip_name }}"
|
||||
- result.hcloud_rdns.ip_address == "{{ test_primary_ip.hcloud_primary_ip.ip }}"
|
||||
- result.hcloud_rdns.primary_ip == hcloud_primary_ip_name
|
||||
- result.hcloud_rdns.ip_address == test_primary_ip.hcloud_primary_ip.ip
|
||||
- result.hcloud_rdns.dns_ptr == "example.com"
|
||||
|
||||
- name: Test create with floating ip
|
||||
|
|
@ -128,8 +128,8 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.hcloud_rdns.floating_ip == "{{ hcloud_floating_ip_name }}"
|
||||
- result.hcloud_rdns.ip_address == "{{ test_floating_ip.hcloud_floating_ip.ip }}"
|
||||
- result.hcloud_rdns.floating_ip == hcloud_floating_ip_name
|
||||
- result.hcloud_rdns.ip_address == test_floating_ip.hcloud_floating_ip.ip
|
||||
- result.hcloud_rdns.dns_ptr == "example.com"
|
||||
|
||||
- name: Test create with load balancer
|
||||
|
|
@ -143,6 +143,6 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.hcloud_rdns.load_balancer == "{{ hcloud_load_balancer_name }}"
|
||||
- result.hcloud_rdns.ip_address == "{{ test_load_balancer.hcloud_load_balancer.ipv4_address }}"
|
||||
- result.hcloud_rdns.load_balancer == hcloud_load_balancer_name
|
||||
- result.hcloud_rdns.ip_address == test_load_balancer.hcloud_load_balancer.ipv4_address
|
||||
- result.hcloud_rdns.dns_ptr == "example.com"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
collections:
|
||||
- ansible.netcommon
|
||||
- ansible.utils
|
||||
- community.crypto
|
||||
- community.general
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue