networktocode / networktocode.nautobot / 5.1.1 / module / location Creates or removes locations from Nautobot | "added in version" 4.3.0 of networktocode.nautobot" Authors: Joe Wesch (@joewesch)networktocode.nautobot.location (5.1.1) — module
Install with ansible-galaxy collection install networktocode.nautobot:==5.1.1
collections: - name: networktocode.nautobot version: 5.1.1
Creates or removes locations from Nautobot
- name: "Test Nautobot location module" connection: local hosts: localhost gather_facts: False tasks: - name: Create location networktocode.nautobot.location: url: http://nautobot.local token: thisIsMyToken name: My Location status: Active location_type: name: My Location Type state: present - name: Delete location networktocode.nautobot.location: url: http://nautobot.local token: thisIsMyToken id: "{{ location_to_delete['key'] }}" state: absent vars: location_to_delete: "{{ lookup('networktocode.nautobot.lookup', 'locations', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=\"My Location\" parent_location=\"Location Parent\" location_type=\"Main Type\"') }}" - name: Create location with all parameters networktocode.nautobot.location: url: http://nautobot.local token: thisIsMyToken name: My Nested Location status: Active location_type: name: My Location Type description: My Nested Location Description tenant: Test Tenant facility: EquinoxCA7 asn: "65001" time_zone: America/Los Angeles physical_address: Hollywood, CA, 90210 shipping_address: Hollywood, CA, 90210 latitude: "10.100000" longitude: "12.200000" contact_name: Jenny contact_phone: 867-5309 contact_email: jenny@example.com comments: "**This** is a `markdown` comment" parent_location: My Location state: present
id: description: - Primary Key of the location, used to delete the location. - Because of hierarchical nature of locations and name being not unique across locations, - it's a user responsibility to query location and pass its id(PK) to the task to delete the location. required: false type: str asn: description: - The ASN associated with the location required: false type: int version_added: 5.1.0 version_added_collection: networktocode.nautobot url: description: - 'The URL of the Nautobot instance resolvable by the Ansible host (for example: http://nautobot.example.com:8000)' required: true type: str name: description: - Name of the location to be created required: false type: str tags: description: - Any tags that this item may need to be associated with elements: raw required: false type: list version_added: 3.0.0 version_added_collection: networktocode.nautobot state: choices: - absent - present default: present description: - Use C(present) or C(absent) for adding or removing. type: str token: description: - The token created within Nautobot to authorize API access required: true type: str status: description: - Status of the location - Required if I(state=present) and does not exist yet required: false type: raw tenant: description: - The tenant the location will be assigned to required: false type: raw version_added: 5.1.0 version_added_collection: networktocode.nautobot comments: description: - Comments for the location. This can be markdown syntax required: false type: str version_added: 5.1.0 version_added_collection: networktocode.nautobot facility: description: - Data center provider or facility, ex. Equinix NY7 required: false type: str version_added: 5.1.0 version_added_collection: networktocode.nautobot latitude: description: - Latitude in decimal format required: false type: str version_added: 5.1.0 version_added_collection: networktocode.nautobot longitude: description: - Longitude in decimal format required: false type: str version_added: 5.1.0 version_added_collection: networktocode.nautobot time_zone: description: - Timezone associated with the location, ex. America/Denver required: false type: str version_added: 5.1.0 version_added_collection: networktocode.nautobot api_version: description: - API Version Nautobot REST API required: false type: str version_added: 4.1.0 version_added_collection: networktocode.nautobot description: description: - Location description required: false type: str contact_name: description: - Name of contact for location required: false type: str version_added: 5.1.0 version_added_collection: networktocode.nautobot query_params: description: - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined - in plugins/module_utils/utils.py and provides control to users on what may make - an object unique in their environment. elements: str required: false type: list version_added: 3.0.0 version_added_collection: networktocode.nautobot contact_email: description: - Contact email for location required: false type: str version_added: 5.1.0 version_added_collection: networktocode.nautobot contact_phone: description: - Contact phone number for location required: false type: str version_added: 5.1.0 version_added_collection: networktocode.nautobot custom_fields: description: - Must exist in Nautobot and in key/value format required: false type: dict version_added: 3.0.0 version_added_collection: networktocode.nautobot location_type: description: - The type of location - Required if I(state=present) and does not exist yet required: false type: raw validate_certs: default: true description: - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. required: false type: raw parent_location: description: - The parent location this location should be tied to required: false type: raw physical_address: description: - Physical address of location required: false type: str version_added: 5.1.0 version_added_collection: networktocode.nautobot shipping_address: description: - Shipping address of location required: false type: str version_added: 5.1.0 version_added_collection: networktocode.nautobot
location: description: Serialized object as created or already existent within Nautobot returned: on creation type: dict msg: description: Message indicating failure or info about what has been achieved returned: always type: str