Skip to content

Commit b1ee9bc

Browse files
committed
Add parameter section to find correct subnet
As a subnet can exists in more than one section at all we also need to provide section for an address. This parameter is `api_invisible`, because the phpIPAM api doesn't know anything about this parameter. This will fix #41.
1 parent b8ec3a2 commit b1ee9bc

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

plugins/modules/address.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
description: subnet address belongs to
3434
type: str
3535
required: true
36+
section:
37+
description: name of the section the given subnet belongs to
38+
version_added: 1.4.0
39+
typ: str
40+
required: true
3641
ipaddress:
3742
description: IP address to hanle
3843
type: str
@@ -130,6 +135,7 @@ def main():
130135
module = PhpipamAddressModule(
131136
phpipam_spec=dict(
132137
subnet=dict(type='entity', controller='subnets', required=True, phpipam_name='subnetId'),
138+
section=dict(type='str', api_invisible=True, required=True),
133139
ipaddress=dict(type='str', required=True, aliases=['ip', 'address'], phpipam_name='ip'),
134140
is_gateway=dict(type='bool', phpipam_name='is_gateway'),
135141
description=dict(type='str'),

tests/test_playbooks/tasks/address.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
username: "{{ phpipam_username }}"
77
password: "{{ phpipam_password }}"
88
subnet: "{{ address.subnet }}"
9+
section: "{{ address.section }}"
910
ipaddress: "{{ address.ipaddress }}"
1011
is_gateway: "{{ address.is_gateway | default(omit) }}"
1112
description: "{{ address.description | default(omit) }}"

tests/test_playbooks/vars/address.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
base_address_data:
33
ipaddress: 172.16.0.1
44
subnet: 172.16.0.0/24
5+
section: Customers
56
is_gateway: yes

0 commit comments

Comments
 (0)