add location_id
lmost every object in the phpIPAM database have the option to set a "location" that's correspond to the ID of the location.
would be nice to have that available int the modules.
address device subnet
Example
- name: "Create device"
codeaffen.phpipam.device:
username: "admin"
password: "s3cr3t"
server_url: "https://ipam.example.com"
hostname: "leaf-example-01"
ipaddress: "192.0.2.222"
location_id: 53 <--- New
sections:
- Example Inc.
- DEVOPS department
state: present
@urskog84 thank you for rephrasing your feature request. We accept it, but we can't promise to implement it soon. So we also label it with help wanted.
Regarding the implementation, we prefer location as an extra field in the mentioned entity types. The module resolves the name to an ID, which will used to save it to the entity accordingly.
- name: "Create device"
codeaffen.phpipam.device:
username: "admin"
password: "s3cr3t"
server_url: "https://ipam.example.com"
hostname: "leaf-example-01"
ipaddress: "192.0.2.222"
location: 'my location' <--- New
sections:
- Example Inc.
- DEVOPS department
state: present
For anyone who is keen to implement this feature, the logic for resolving names to its IDs exists for various keys.
Regarding the implementation, we prefer
locationas an extra field in the mentioned entity types. The module resolves the name to an ID, which will used to save it to the entity accordingly.For anyone who is keen to implement this feature, the logic for resolving names to its IDs exists for various keys.
The logic for resolving a location name to the related ID is already there:
https://github.com/codeaffen/phpipam-ansible-modules/blob/340c0f9b6f695b22b0152c473f3bab97d83bbea5/plugins/modules/subnet.py#L226
The task now is to:
- identify the modules which support location
- add the line
location=dict(type='entity', controller='tools/locations'),to eachphpipam_specdict of each identified module - add the following code to the options dict DOCUMENTATION section of each identified module
location: description: Subnet location type: str required: false - ideally the existing tests be updated
- a changelog fragment is placed in
changelogs/fragmentsdescribing the change
Hope this will help to have this feature soon for all supported modules.