Skip to content

Commit

Permalink
feat: Add status and facility options to netbox_location module
Browse files Browse the repository at this point in the history
This commit adds the `status` and `facility` options to the `netbox_location` module. The `status` option allows specifying the status of the location, while the `facility` option allows specifying the data center provider or facility. These options were added to enhance the functionality of the module and provide more flexibility in managing locations within NetBox.

Fixes #1279, #1280
  • Loading branch information
richbibby committed Jul 3, 2024
1 parent a271a54 commit 553d15c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/fragments/fix_issues_1279_1280.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- Add ``status`` to ``location`` (https://github.com/netbox-community/ansible_modules/issues/1279)
- Add ``facility`` to ``location`` (https://github.com/netbox-community/ansible_modules/issues/1280)
18 changes: 17 additions & 1 deletion plugins/modules/netbox_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
- The name of the location
required: true
type: str
status:
description:
- Status of the location
required: false
type: raw
version_added: "3.20.0"
slug:
description:
- The slugified version of the name or custom slug.
Expand All @@ -56,6 +62,12 @@
required: false
type: raw
version_added: "3.8.0"
facility:
description:
- Data center provider or facility, ex. Equinix NY7
required: false
type: str
version_added: "3.20.0"
description:
description:
- The description of the location
Expand Down Expand Up @@ -93,14 +105,16 @@
site: Test Site
state: present
- name: Create location within NetBox with a parent location
- name: Create location within NetBox with a parent location, status and facility
netbox.netbox.netbox_location:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
name: Child location
site: Test Site
parent_location: Test location
status: planned
facility : Test Facility

Check failure on line 117 in plugins/modules/netbox_location.py

View workflow job for this annotation

GitHub Actions / ansible-lint / Ansible Lint

yaml[colons]

Too many spaces before colon
state: present
- name: Delete location within NetBox
Expand Down Expand Up @@ -146,10 +160,12 @@ def main():
required=True,
options=dict(
name=dict(required=True, type="str"),
status=dict(required=False, type="raw"),
slug=dict(required=False, type="str"),
site=dict(required=False, type="raw"),
parent_location=dict(required=False, type="raw"),
tenant=dict(required=False, type="raw"),
facility=dict(required=False, type="str"),
description=dict(required=False, type="str"),
tags=dict(required=False, type="list", elements="raw"),
custom_fields=dict(required=False, type="dict"),
Expand Down

0 comments on commit 553d15c

Please sign in to comment.