Closed ingvarrwvw closed 1 year ago
/related #100
/related #100
not sure if they are related. If you create a folder via gui, then it is impossible to specify it as a master folder when creating a subnet via ansible. It has nothing to do with idempotency, does it?
They are. As folders need to managed throught folders
controller and not subnet
. In phpIPAM both entity types are managed within subnet namespace but the presentation. Same entity parameters are used for different presentations.
See docs, subnet
module has parameter parent
which should work with subnets but not with folders. As resolution of folders does not work we first need to create folders handling. Second we will refactor parent/folder handling in subnet module.
To understand the relation it is a good idea to query the API directly (e.g. via cURL
) to see what data will be returned.
See default data:
Query subnet 10.65.22.0
which is children of My folder
curl -ks -XGET -H "phpipam-token: ${IPAM_TOKEN}" https://localhost:8443/api/ansible/subnets/6 | jq '. | {subnet: .data.subnet, mask: .data.mask, masterSubnetId: .data.masterSubnetId, isFolder: .data.isFolder, description: .data.description}'
{
"subnet": "10.65.22.0",
"mask": "24",
"masterSubnetId": "5",
"isFolder": "0",
"description": "DHCP range"
}
Querying My folder
via subnet
controller will not return any data
curl -ks -XGET -H "phpipam-token: ${IPAM_TOKEN}" https://localhost:8443/api/ansible/subnets/5 | jq '. | {subnet: .data.subnet, mask: .data.mask, masterSubnetId: .data.masterSubnetId, isFolder: .data.isFolder, description: .data.description}'
{
"subnet": null,
"mask": null,
"masterSubnetId": null,
"isFolder": null,
"description": null
}
but via folders
controller
curl -ks -XGET -H "phpipam-token: ${IPAM_TOKEN}" https://localhost:8443/api/ansible/folders/5 | jq '. | {subnet: .data.subnet, mask: .data.mask, masterSubnetId: .data.masterSubnetId, isFolder: .data.isFolder, description: .data.description}'
{
"subnet": "0.0.0.0",
"mask": "",
"masterSubnetId": "0",
"isFolder": "1",
"description": "My folder"
}
Similar story if we query 10.10.1.0/24
which is children of 10.10.0.0/16
curl -ks -XGET -H "phpipam-token: ${IPAM_TOKEN}" https://localhost:8443/api/ansible/subnets/3 | jq '. | {subnet: .data.subnet, mask: .data.mask, masterSubnetId: .data.masterSubnetId, isFolder: .data.isFolder, description: .data.description}'
{
"subnet": "10.10.1.0",
"mask": "24",
"masterSubnetId": "2",
"isFolder": "0",
"description": "Customer 1"
}
subnet
controller will return data for parent
curl -ks -XGET -H "phpipam-token: ${IPAM_TOKEN}" https://localhost:8443/api/ansible/subnets/2 | jq '. | {subnet: .data.subnet, mask: .data.mask, masterSubnetId: .data.masterSubnetId, isFolder: .data.isFolder, description: .data.description}'
{
"subnet": "10.10.0.0",
"mask": "16",
"masterSubnetId": "0",
"isFolder": "0",
"description": "Business customers"
}
But folders
controller will not
curl -ks -XGET -H "phpipam-token: ${IPAM_TOKEN}" https://localhost:8443/api/ansible/folders/2 | jq '. | {subnet: .data.subnet, mask: .data.mask, masterSubnetId: .data.masterSubnetId, isFolder: .data.isFolder, description: .data.description}'
{
"subnet": null,
"mask": null,
"masterSubnetId": null,
"isFolder": null,
"description": null
}
Independently of it seems that the resolving of parent
will not work in the current version of our subnet
module.
"5",
thanks for the detailed explanation, looking forward to fixes
Describe the bug When creating a subnet, there is no way to specify in which folder it should be placed. Apparently the "master_folder" option is missing. This is possible through the web interface.
Screenshot:
Versions:
Additional context Add any other context about the problem here.