Skip to content

Conversation

cmeissner
Copy link
Member

  • Add location parameter to address and device module
  • Add changelog fragment
  • Extend documentation accordingly
  • Regenerate documentation

@cmeissner cmeissner self-assigned this Jun 27, 2025
@cmeissner
Copy link
Member Author

Test for location in address module

$ ansible-playbook tests/test_playbooks/address.yml -vvv
...
PLAYBOOK: address.yml **********************************************************
1 plays in tests/test_playbooks/address.yml

PLAY [Address module tests] ****************************************************

TASK [Create address] **********************************************************
included: /home/cme/Development/github/cmeissner/phpipam-ansible-modules/tests/test_playbooks/tasks/address.yml for localhost

TASK [Ensure state of ip address: create address] ******************************
changed: [localhost] => {
    "changed": true,
    "diff": {
        "after": {
            "addresses": [
                {
                    "PTR": "0",
                    "PTRignore": "0",
                    "customer_id": null,
                    "description": null,
                    "deviceId": null,
                    "editDate": null,
                    "excludePing": "0",
                    "firewallAddressObject": null,
                    "hostname": "foo.example.com",
                    "id": "23",
                    "ip": "10.65.22.1",
                    "is_gateway": "1",
                    "lastSeen": "1970-01-01 00:00:01",
                    "location": "2",
                    "mac": null,
                    "note": null,
                    "owner": null,
                    "port": null,
                    "subnetId": "6",
                    "tag": "2"
                }
            ]
        },
        "before": {
            "addresses": [
                {}
            ]
        }
    },
    "invocation": {
        "module_args": {
            "app_id": "ansible",
            "description": null,
            "device": null,
            "exclude_ping": null,
            "hostname": "foo.example.com",
            "ignore_ptr": null,
            "ipaddress": "10.65.22.1",
            "is_gateway": true,
            "location": "ansible_test_location",
            "mac_address": null,
            "note": null,
            "owner": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": null,
            "ptr": null,
            "section": "Customers",
            "server_url": "https://localhost:8443",
            "subnet": "10.65.22.0/24",
            "tag": null,
            "username": "admin",
            "validate_certs": false
        }
    }
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

@cmeissner
Copy link
Member Author

Test for location in device module:

$ ansible-playbook tests/test_playbooks/device.yml -vvv
...
PLAYBOOK: device.yml ***********************************************************
1 plays in tests/test_playbooks/device.yml

PLAY [Device module tests] *****************************************************

TASK [Create device] ***********************************************************
included: /home/cme/Development/github/cmeissner/phpipam-ansible-modules/tests/test_playbooks/tasks/device.yml for localhost

TASK [Ensure state of device: create device] ***********************************
changed: [localhost] => {
    "changed": true,
    "diff": {
        "after": {
            "devices": [
                {
                    "description": null,
                    "editDate": null,
                    "hostname": "Test device",
                    "id": "3",
                    "ip": "192.2.0.222",
                    "location": "2",
                    "rack": null,
                    "rack_size": null,
                    "rack_start": null,
                    "sections": "1",
                    "snmp_community": null,
                    "snmp_port": "161",
                    "snmp_queries": null,
                    "snmp_timeout": "1000",
                    "snmp_v3_auth_pass": null,
                    "snmp_v3_auth_protocol": "none",
                    "snmp_v3_ctx_engine_id": null,
                    "snmp_v3_ctx_name": null,
                    "snmp_v3_priv_pass": null,
                    "snmp_v3_priv_protocol": "none",
                    "snmp_v3_sec_level": "none",
                    "snmp_version": "0",
                    "type": "1"
                }
            ]
        },
        "before": {
            "devices": [
                {}
            ]
        }
    },
    "invocation": {
        "module_args": {
            "app_id": "ansible",
            "description": null,
            "hostname": "Test device",
            "ipaddress": "192.2.0.222",
            "location": "ansible_test_location",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "rack": null,
            "rack_units": null,
            "sections": [
                "Customers"
            ],
            "server_url": "https://localhost:8443",
            "snmp_community": null,
            "snmp_port": "161",
            "snmp_queries": null,
            "snmp_timeout": null,
            "snmp_v3_auth_pass": null,
            "snmp_v3_auth_protocol": null,
            "snmp_v3_ctx_engine_id": null,
            "snmp_v3_ctx_name": null,
            "snmp_v3_priv_pass": null,
            "snmp_v3_priv_protocol": null,
            "snmp_v3_sec_level": null,
            "snmp_version": null,
            "starting_rack_unit": null,
            "type": "Switch",
            "username": "admin",
            "validate_certs": false
        }
    }
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

@cmeissner cmeissner linked an issue Jun 27, 2025 that may be closed by this pull request
- Add `location` parameter to `address` and `device` module
- Add changelog fragment
- Extend documentation accordingly
- Regenerate documentation
- Update tests tasks
- Add tags to tests for `location`, `address` and `device` playbooks
@cmeissner cmeissner merged commit 47557e9 into codeaffen:develop Jun 27, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add location_id
1 participant