diff options
Diffstat (limited to 'collections-debian-merged/ansible_collections/netbox')
351 files changed, 73471 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/.github/ISSUE_TEMPLATE/new-issue.md b/collections-debian-merged/ansible_collections/netbox/netbox/.github/ISSUE_TEMPLATE/new-issue.md new file mode 100644 index 00000000..539963e8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/.github/ISSUE_TEMPLATE/new-issue.md @@ -0,0 +1,59 @@ +--- +name: New Issue +about: Report issues +title: '' +labels: '' +assignees: '' + +--- + +<!--- +Verify first that your issue/request is not already reported on GitHub. +Also test if the latest release, and master branch are affected too. +--> + +##### ISSUE TYPE +<!--- Pick one below and delete the rest: --> + - Bug Report + - Feature Idea + - Module question + - Module creation help + - Documentation update + +##### SOFTWARE VERSIONS + +###### Ansible: +<!--- Ansible Version ansible --version --> + +###### Netbox: +<!--- Netbox Version --> + +###### Collection: +<!--- Netbox Ansible Module Collection Version --> + +##### SUMMARY +<!--- Explain the problem briefly --> + +##### STEPS TO REPRODUCE +<!--- +For bugs, show exactly how to reproduce the problem, using a minimal test-case. +For new features, show how the feature would be used. +--> + +<!--- Paste example playbooks or commands between quotes below --> +```yaml + +``` + +<!--- You can also paste gist.github.com links for larger files --> + +##### EXPECTED RESULTS +<!--- What did you expect to happen when running the steps above? --> + +##### ACTUAL RESULTS +<!--- What actually happened? --> + +<!--- Paste verbatim command output between quotes below --> +``` + +``` diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/.github/workflows/main.yml b/collections-debian-merged/ansible_collections/netbox/netbox/.github/workflows/main.yml new file mode 100644 index 00000000..dc4908f0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/.github/workflows/main.yml @@ -0,0 +1,109 @@ +name: All CI related tasks + +# Run this workflow every time a new commit pushed to your repository +on: [push, pull_request] + +jobs: + linting_unit_testing: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [3.6, 3.7] + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install and configure Poetry + uses: snok/install-poetry@v1.1.1 + with: + virtualenvs-create: false + - name: Install Python packages + run: poetry install + - name: Build and install collection + run: | + ansible-galaxy collection build . + ansible-galaxy collection install netbox*.tar.gz -p /home/runner/.ansible/collections + - name: Run Black + run: black . --check --diff + - name: Run Ansible Sanity tests + run: ansible-test sanity -v --requirements --python ${{ matrix.python-version }} --skip-test pep8 plugins/ + working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox + - name: Run Ansible Unit tests + run: ansible-test units -vvv --coverage --python ${{ matrix.python-version }} + working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox + - name: Run Ansible Coverage + run: ansible-test coverage report --all --omit "tests/*,hacking/*,docs/*" --show-missing + working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox + integration: + runs-on: ubuntu-latest + needs: linting_unit_testing + strategy: + fail-fast: false + matrix: + include: + - python-version: 3.6 + VERSION: "v2.9" + INTEGRATION_TESTS: "v2.9" + - python-version: 3.6 + VERSION: "latest" + INTEGRATION_TESTS: "latest" + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Clone & Start netbox-docker containers + env: + VERSION: ${{ matrix.VERSION }} + run: | + cd .. + git clone https://github.com/netbox-community/netbox-docker.git + cd netbox-docker + docker-compose up -d --quiet-pull + docker container ls + cd .. + - name: Build and install collection + run: | + ansible-galaxy collection build . + ansible-galaxy collection install netbox*.tar.gz -p /home/runner/.ansible/collections + - name: Wait for NetBox to be available + run: | + docker container ls + docker logs netbox-docker_netbox_1 + timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:32768)" != "200" ]]; do echo "waiting for Netbox"; sleep 5; done' || false + working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox + - name: Install and configure Poetry + uses: snok/install-poetry@v1.1.1 + with: + virtualenvs-create: false + - name: Install Python packages + run: poetry install + - name: Pre-populate NetBox + run: ./tests/integration/netbox-deploy.py + working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox + - name: Allow scripts to be executed + # Set runme.sh execute permissions stripped by ansible-galaxy. Should be fixed in Ansible 2.10 + # https://github.com/ansible/ansible/issues/68415 + # Run render_config.sh to pass environment variables to integration tests + # https://www.ansible.com/blog/adding-integration-tests-to-ansible-content-collections + run: | + chmod +x tests/integration/targets/inventory-${{ matrix.INTEGRATION_TESTS }}/runme.sh + chmod +x tests/integration/targets/inventory-${{ matrix.INTEGRATION_TESTS }}/compare_inventory_json.py + chmod +x tests/integration/render_config.sh + tests/integration/render_config.sh tests/integration/targets/inventory/runme_config.template > tests/integration/targets/inventory-${{ matrix.INTEGRATION_TESTS }}/runme_config + working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox + - name: Run integration tests + # Run regression and integration tests + # Run the inventory test first, in case any of the other tests modify the data. + run: | + ansible-test integration -v --coverage --python ${{ matrix.python-version }} inventory-${{ matrix.INTEGRATION_TESTS }} + ansible-test integration -v --coverage --python ${{ matrix.python-version }} regression-${{ matrix.INTEGRATION_TESTS }} + ansible-test integration -v --coverage --python ${{ matrix.python-version }} ${{ matrix.INTEGRATION_TESTS }} + ansible-test coverage report --all --omit "tests/*,hacking/*,docs/*" --show-missing + working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/.github/workflows/release.yml b/collections-debian-merged/ansible_collections/netbox/netbox/.github/workflows/release.yml new file mode 100644 index 00000000..aee4c054 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/.github/workflows/release.yml @@ -0,0 +1,21 @@ +name: Deploy collection to Ansible Galaxy +on: + create: + tags: + - "v*" +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Set up Python 3.6 + uses: actions/setup-python@v2 + with: + python-version: 3.6 + - name: Install ansible-base to deploy collection + run: pip install ansible-base + - name: Build and Deploy Collection + uses: artis3n/ansible_galaxy_collection@v2 + with: + api_key: "${{ secrets.GALAXY_API_KEY }}" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/.gitignore b/collections-debian-merged/ansible_collections/netbox/netbox/.gitignore new file mode 100644 index 00000000..bc454c94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/.gitignore @@ -0,0 +1,12 @@ +*.tar.gz +__pycache__/ +*.pyc +tests/output/* +venv/ +.vscode/ +changelogs/.plugin-cache.yaml +docs/_build/* +.python-version + +# https://github.com/ansible/ansible/issues/68499 +# ansible_collections/ diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/.readthedocs.yml b/collections-debian-merged/ansible_collections/netbox/netbox/.readthedocs.yml new file mode 100644 index 00000000..635c65f5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/.readthedocs.yml @@ -0,0 +1,8 @@ +version: 2 +sphinx: + configuration: docs/conf.py + +python: + version: 3.6 + install: + - requirements: docs/requirements.txt diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/.travis.yml b/collections-debian-merged/ansible_collections/netbox/netbox/.travis.yml new file mode 100644 index 00000000..1272c12c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/.travis.yml @@ -0,0 +1,139 @@ +--- +language: python +services: + - docker + +os: linux +dist: bionic + +env: + global: + - COLLECTION_NAMESPACE: "netbox" + - COLLECTION_NAME: "netbox" + - COLLECTION_VERSION: "1.1.0" + - secure: "tE6GtwrRU+Kjobx/94xqR2MqM20pHCnrLcHgPzIHA3npdwuA+GjCBiBLTkEEQM4fUWIfzUTyjSr9bZErm1PTI1GcIRdniTgJ3ZzSSkE7tgeYALB/7xsusB57SlmbBQm2SGwU558uWZ3NHEsi0WTgD8GKZo77OpGX72FZKsVXOz6k2wve51sOtoSVjgCsvWTmZHx4ynGdiA5wFkZfaEcjXECahKtunW+MlB5kpJzkVeLRUEXFMhWlsIYiA5nj8OI/X3Nk9ugh1ribENX9LrjpgrqQ9YariZ8G6py1ONuKZIn2g7xs5kNQ3qL6HL6N7SoUxiwH16CfSyugFaYiMfaxQ4NUVGGRHS4vSGbNIf+gLHcYvP40miI1f/+pntCzqygZMhW73FX2o+KH2OGv09khOl8k1nDg2/XvW0kCc/FU6l+Jp5wCC8H9X2uiULtQpRqts5TzIonlPEzGIpfGFgJ5m54Emhv9gjG1Z5OOyL/qae1Wr+L/uhiFafcglZYh8NHEMWCUCkeqFqR2kDmUMtdgYLD7Q7NdwlL/PSVVs1l7UPiQHlnecQKEHN7CvR3eKByTEmkCKafRYh/JQ9rBt9sZc7aAPVu+w3wWUwbHS4o4vVnmyXvJb1PeJSiuynF7CBo4Qd6qj4YwX8gLK6PylGyaMOp169u6xw1mo5/CX0pJ3x4=" + +jobs: + include: + - name: "Python 3.6 - Netbox 2.8 - Latest PyPi Ansible" + python: 3.6 + env: + - PYTHON_VER=3.6 VERSION=v2.8 INTEGRATION_TESTS=v2.8 + install: + - cd .. + # Setup netbox container for integration testing + - git clone https://github.com/netbox-community/netbox-docker.git + - cd netbox-docker + - sed -i 's/SKIP_STARTUP_SCRIPTS=false/SKIP_STARTUP_SCRIPTS=true/' env/netbox.env + - docker-compose pull + - docker-compose up -d + - cd .. + - pip install -U pip + - pip install -U pytest + - pip install -U pip "setuptools>=46.1.3" + - pip install pytest-mock pytest-xdist jinja2 PyYAML black==19.10b0 "coverage<5" + - pip install pynetbox cryptography codecov jmespath jsondiff ansible + + # Stick to python 3.7 instead of 3.8, as ansible-test sanity is not compatible with 3.7 + # https://github.com/ansible/ansible/issues/67118 + + - name: "Python 3.7 - Netbox 2.9 - Latest PyPi Ansible" + python: 3.7 + env: + - PYTHON_VER=3.7 VERSION=v2.9 INTEGRATION_TESTS=latest + install: + - cd .. + # Setup netbox container for integration testing + - git clone https://github.com/netbox-community/netbox-docker.git + - cd netbox-docker + - docker-compose pull + - docker-compose up -d + - cd .. + - pip install -U pip + - pip install -U pytest + - pip install -U pip "setuptools>=46.1.3" + - pip install pytest-mock pytest-xdist jinja2 PyYAML black==19.10b0 "coverage<5" + - pip install pynetbox cryptography codecov jmespath jsondiff ansible + + # Latest development versions of Netbox and Ansible, newest Python + # This may be broken sometimes by changes in the netbox & ansible projects + # Failures will be allowed in this build + - name: "Python 3.6 - Netbox develop branch (snapshot) - Ansible Develop" + python: 3.6 + env: PYTHON_VER=3.6 VERSION=snapshot INTEGRATION_TESTS=latest + install: + - cd .. + # Setup netbox container for integration testing + - git clone https://github.com/netbox-community/netbox-docker.git + - cd netbox-docker + - docker-compose pull + - docker-compose up -d + - cd .. + - pip install -U pip + - pip install -U pytest + - pip install -U pip "setuptools>=46.1.3" + - pip install pytest-mock pytest-xdist jinja2 PyYAML black==19.10b0 "coverage<5" + - pip install pynetbox cryptography jmespath jsondiff + - git clone https://github.com/ansible/ansible.git + - cd ansible + - source hacking/env-setup + - cd .. + + allow_failures: + # When testing against dev netbox and dev ansible, allow failures + - env: PYTHON_VER=3.6 VERSION=snapshot INTEGRATION_TESTS=latest + +before_script: + - mkdir -p ~/ansible_collections/$COLLECTION_NAMESPACE + - cp -R ansible_modules ~/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + - cd ~/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + - ansible-galaxy collection build . + - ansible-galaxy collection install $COLLECTION_NAMESPACE-$COLLECTION_NAME-$COLLECTION_VERSION.tar.gz -p /home/travis/.ansible/collections + + # Run all further tests from within the installed directory + # Required to resolve imports of other collections + - cd /home/travis/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + + # Set runme.sh execute permissions stripped by ansible-galaxy. Should be fixed in Ansible 2.10 + # https://github.com/ansible/ansible/issues/68415 + - chmod +x tests/integration/targets/inventory-$INTEGRATION_TESTS/runme.sh + - chmod +x tests/integration/targets/inventory-$INTEGRATION_TESTS/compare_inventory_json.py + - chmod +x tests/integration/render_config.sh + + # Run render_config.sh to pass environment variables to integration tests + # https://www.ansible.com/blog/adding-integration-tests-to-ansible-content-collections + - tests/integration/render_config.sh tests/integration/targets/inventory/runme_config.template > tests/integration/targets/inventory-$INTEGRATION_TESTS/runme_config + +script: + # Check python syntax + - black . --check --diff + + # Sanity tests + # --requirements - install pip packages as necessary + # Skip pep8 as we use black instead + - ansible-test sanity -v --requirements --python $PYTHON_VER --skip-test pep8 plugins/ + + # Unit tests, with code coverage + - ansible-test units -v --coverage --python $PYTHON_VER + + # Wait for Netbox containers to be running + - timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:32768)" != "200" ]]; do echo "waiting for Netbox"; sleep 5; done' || false + + # Prepare data in Netbox + - ./tests/integration/netbox-deploy.py + + # Run regression and integration tests + # Run the inventory test first, in case any of the other tests modify the data. + - ansible-test integration -v --coverage --python $PYTHON_VER inventory-$INTEGRATION_TESTS + - ansible-test integration -v --coverage --python $PYTHON_VER regression-$INTEGRATION_TESTS + - ansible-test integration -v --coverage --python $PYTHON_VER $INTEGRATION_TESTS + + # Report code coverage + - ansible-test coverage report --all --omit "tests/*,hacking/*,docs/*" --show-missing + +deploy: + provider: script + skip_cleanup: true + script: ansible-galaxy collection publish ~/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME/$COLLECTION_NAMESPACE-$COLLECTION_NAME-$COLLECTION_VERSION.tar.gz --api-key="$GALAXY_API_TOKEN" + on: + tags: true diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/CHANGELOG.rst b/collections-debian-merged/ansible_collections/netbox/netbox/CHANGELOG.rst new file mode 100644 index 00000000..fbb3313d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/CHANGELOG.rst @@ -0,0 +1,427 @@ +=========================== +Netbox.Netbox Release Notes +=========================== + +.. contents:: Topics + + +v1.2.1 +====== + +Bugfixes +-------- + +- Allow IDs to be passed into objects that accept a list (https://github.com/netbox-community/ansible_modules/issues/407) + +v1.2.0 +====== + +Major Changes +------------- + +- nb_inventory - Add ``dns_name`` option that adds ``dns_name`` to the host when ``True`` and device has a primary IP address. (#394) +- nb_inventory - Add ``status`` as a ``group_by`` option. (398) +- nb_inventory - Move around ``extracted_primary_ip`` to allow for ``config_context`` or ``custom_field`` to overwite. (#377) +- nb_inventory - Services are now a list of integers due to NetBox 2.10 changes. (#396) +- nb_lookup - Allow ID to be passed in and use ``.get`` instead of ``.filter``. (#376) +- nb_lookup - Allow ``api_endpoint`` and ``token`` to be found via env. (#391) + +Minor Changes +------------- + +- nb_inventory - Added ``status`` as host_var. (359) +- nb_inventory - Added documentation for using ``keyed_groups``. (#361) +- nb_inventory - Allow to use virtual chassis name instead of device name. (#383) +- nb_lookup - Allow lookup of plugin endpoints. (#360) +- nb_lookup - Documentation update to show Fully Qualified Collection Name (FQCN). (#355) +- netbox_service - Add ``ports`` option for NetBox 2.10+ and convert ``port`` to ``ports`` if NetBox 2.9 or lower. (#396) +- netbox_virtual_machine - Added ``comments`` option. (#380) +- netbox_virtual_machine - Added ``local_context_data`` option. (#357) + +Bugfixes +-------- + +- Version checks were failing due to converting "2.10" to a float made it an integer of 2.1 which broke version related logic. (#396) +- netbox_device_interface - Fixed copy pasta in documentation. (#371) +- netbox_ip_address - Updated documentation to show that ``family`` option has been deprecated. (#388) +- netbox_utils - Fixed typo for ``circuits.circuittermination`` searches. (#367) +- netbox_utils - Skip all modifications to ``query_params`` when ``user_query_params`` is defined. (#389) +- netbox_vlan - Fixed uniqueness for vlan searches to add ``group``. (#386) + +New Modules +----------- + +- netbox.netbox.netbox_tag - Creates or removes tags from Netbox + +v1.1.0 +====== + +Minor Changes +------------- + +- Add ``follow_redirects`` option to inventory plugin (https://github.com/netbox-community/ansible_modules/pull/323) + +Bugfixes +-------- + +- Prevent inventory plugin from failing on 403 and print warning message (https://github.com/netbox-community/ansible_modules/pull/354) +- Update ``netbox_ip_address`` module to accept ``assigned_object`` to work with NetBox 2.9 (https://github.com/netbox-community/ansible_modules/pull/345) +- Update inventory plugin to properly associate IP address to interfaces with NetBox 2.9 (https://github.com/netbox-community/ansible_modules/pull/334) +- Update inventory plugin to work with tags with NetBox 2.9 (https://github.com/netbox-community/ansible_modules/pull/340) +- Update modules to be able to properly update tags to work with NetBox 2.9 (https://github.com/netbox-community/ansible_modules/pull/345) + +v1.0.2 +====== + +Bugfixes +-------- + +- Add ``virtual_machine_role=slug`` to ``QUERY_TYPES`` to properly search for Virtual Machine roles and not use the default ``q`` search (https://github.com/netbox-community/ansible_modules/pull/327) +- Remove ``device`` being ``required`` and implemented ``required_one_of`` to allow either ``device`` or ``virtual_machine`` to be specified for ``netbox_service`` (https://github.com/netbox-community/ansible_modules/pull/326) +- When tags specified, it prevents other data from being updated on the object. (https://github.com/netbox-community/ansible_modules/pull/325) + +v1.0.1 +====== + +Minor Changes +------------- + +- Inventory - Add group_by option ``rack_role`` and ``rack_group`` +- Inventory - Add group_by option ``services`` (https://github.com/netbox-community/ansible_modules/pull/286) + +Bugfixes +-------- + +- Fix ``nb_inventory`` cache for ip addresses (https://github.com/netbox-community/ansible_modules/issues/276) +- Return HTTPError body output when encountering HTTP errors (https://github.com/netbox-community/ansible_modules/issues/294) + +v1.0.0 +====== + +Bugfixes +-------- + +- Fix query_dict for device_bay/interface_template to use ``devicetype_id`` (https://github.com/netbox-community/ansible_modules/issues/282) +- This expands the fix to all `_template` modules to use `devicetype_id` for the query_dict when attempting to resolve the search (https://github.com/netbox-community/ansible_modules/pull/300) + +v0.3.1 +====== + +Bugfixes +-------- + +- Default ``validate_certs`` to ``True`` (https://github.com/netbox-community/ansible_modules/issues/273) + +v0.3.0 +====== + +Minor Changes +------------- + +- Add ``local_context_data`` and ``flatten_local_context_data`` option to ``nb_inventory`` (https://github.com/netbox-community/ansible_modules/pull/258) +- Add ``local_context_data`` option to ``netbox_device`` (https://github.com/netbox-community/ansible_modules/pull/258) +- Add ``virtual_chassis``, ``vc_position``, ``vc_priority`` to ``netbox_device`` options (https://github.com/netbox-community/ansible_modules/pull/251) + +Breaking Changes / Porting Guide +-------------------------------- + +- To pass in integers via Ansible Jinja filters for a key in ``data`` that + requires querying an endpoint is now done by making it a dictionary with + an ``id`` key. The previous behavior was to just pass in an integer and + it was converted when normalizing the data, but some people may have names + that are all integers and those were being converted erroneously so we made + the decision to change the method to convert to an integer for the NetBox + API. + + :: + + tasks: + - name: Create device within NetBox with only required information + netbox_device: + netbox_url: http://netbox-demo.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test66 + device_type: + id: "{{ some_jinja_variable }}" + device_role: Core Switch + site: Test Site + status: Staged + state: present +- ``pynetbox`` changed to using ``requests.Session()`` to manage the HTTP session + which broke passing in ``ssl_verify`` when building the NetBox API client. + This PR makes ``pynetbox 5.0.4+`` the new required version of `pynetbox` for + the Ansible modules and lookup plugin. (https://github.com/netbox-community/ansible_modules/pull/269) + +Bugfixes +-------- + +- Allows OR operations in API fitlers for ``nb_lookup`` plugin (https://github.com/netbox-community/ansible_modules/issues/246) +- Build the ``rear_port`` and ``rear_port_template`` query_params to properly find rear port (https://github.com/netbox-community/ansible_modules/issues/262) +- Compares tags as a set to prevent issues with order difference between user supplied tags and NetBox API (https://github.com/netbox-community/ansible_modules/issues/242) +- Fixes typo for ``CONVERT_TO_ID`` mapping in ``netbox_utils`` for ``dcim.powerport`` and ``dcim.poweroutlet`` (https://github.com/netbox-community/ansible_modules/pull/265) +- Fixes typo for ``CONVERT_TO_ID`` mapping in ``netbox_utils`` for ``dcim.rearport`` (https://github.com/netbox-community/ansible_modules/pull/261) +- Normalize ``mac_address`` to upper case (https://github.com/netbox-community/ansible_modules/issues/254) +- Normalize descriptions to remove any extra whitespace (https://github.com/netbox-community/ansible_modules/issues/243) + +New Modules +----------- + +- netbox.netbox.netbox_cable - Create, update or delete cables within Netbox +- netbox.netbox.netbox_device_bay_template - Create, update or delete device bay templates within Netbox +- netbox.netbox.netbox_device_interface_template - Creates or removes interfaces on devices from Netbox +- netbox.netbox.netbox_virtual_chassis - Create, update or delete virtual chassis within Netbox + +v0.2.3 +====== + +Minor Changes +------------- + +- Adds ``discovered`` field to ``netbox_inventory_item`` (https://github.com/netbox-community/ansible_modules/issues/187) +- Adds ``query_params`` to all modules to allow users to define the ``query_params`` (https://github.com/netbox-community/ansible_modules/issues/215) +- Adds ``tenant`` field to ``netbox_cluster`` (https://github.com/netbox-community/ansible_modules/pull/219) +- Allows private key to be passed in to ``validate_certs`` within modules (https://github.com/netbox-community/ansible_modules/issues/216) +- Better error handling if read-only token is provided for modules. Updated README as well to say that a ``write-enabled`` token is required (https://github.com/netbox-community/ansible_modules/pull/238) + +Bugfixes +-------- + +- Fixes bug in ``netbox_prefix`` failing when using ``check_mode`` (https://github.com/netbox-community/ansible_modules/issues/228) +- Fixes bug in inventory plugin that fails if there are either no virtual machines, but devices defined in NetBox or vice versa from failing when ``fetch_all`` is set to ``False`` (https://github.com/netbox-community/ansible_modules/issues/214) +- Normalize any string values that are passed in via Jinja into an integer within the `_normalize_data` method (https://github.com/netbox-community/ansible_modules/issues/231) + +New Modules +----------- + +- netbox.netbox.netbox_console_port - Create, update or delete console ports within Netbox +- netbox.netbox.netbox_console_port_template - Create, update or delete console port templates within Netbox +- netbox.netbox.netbox_console_server_port - Create, update or delete console server ports within Netbox +- netbox.netbox.netbox_console_server_port_template - Create, update or delete console server port templates within Netbox +- netbox.netbox.netbox_front_port - Create, update or delete front ports within Netbox +- netbox.netbox.netbox_front_port_template - Create, update or delete front port templates within Netbox +- netbox.netbox.netbox_power_feed - Create, update or delete power feeds within Netbox +- netbox.netbox.netbox_power_outlet - Create, update or delete power outlets within Netbox +- netbox.netbox.netbox_power_outlet_template - Create, update or delete power outlet templates within Netbox +- netbox.netbox.netbox_power_panel - Create, update or delete power panels within Netbox +- netbox.netbox.netbox_power_port - Create, update or delete power ports within Netbox +- netbox.netbox.netbox_power_port_template - Create, update or delete power port templates within Netbox +- netbox.netbox.netbox_rear_port - Create, update or delete rear ports within Netbox +- netbox.netbox.netbox_rear_port_template - Create, update or delete rear port templates within Netbox + +v0.2.2 +====== + +Minor Changes +------------- + +- Changed ``validate_certs`` to ``raw`` to allow private keys to be passed in (https://github.com/netbox-community/ansible_modules/issues/211) + +Bugfixes +-------- + +- Added ``interfaces`` to ``ALLOWED_QUERY_PARAMS`` for ip addresses searches (https://github.com/netbox-community/ansible_modules/issues/201) +- Added ``type`` to ``ALLOWED_QUERY_PARAMS`` for interface searches (https://github.com/netbox-community/ansible_modules/issues/208) +- Remove ``rack`` as a choice when creating virtual machines (https://github.com/netbox-community/ansible_modules/pull/221) + +v0.2.1 +====== + +Minor Changes +------------- + +- Added 21" width to netbox_rack (https://github.com/netbox-community/ansible_modules/pull/190) +- Added cluster, cluster_type, and cluster_group to group_by option in inventory plugin (https://github.com/netbox-community/ansible_modules/issues/188) +- Added option to change host_vars to singular rather than having single element lists (https://github.com/netbox-community/ansible_modules/issues/141) +- Added option to flatten ``config_context`` and ``custom_fields`` (https://github.com/netbox-community/ansible_modules/issues/193) + +Bugfixes +-------- + +- Added ``type`` to ``netbox_device_interface`` and deprecation notice for ``form_factor`` (https://github.com/netbox-community/ansible_modules/issues/193) +- Fixes inventory performance issues, properly shows virtual chassis masters. (https://github.com/netbox-community/ansible_modules/pull/202) + +v0.2.0 +====== + +Minor Changes +------------- + +- Add ``custom_fields`` to ``netbox_virtual_machine`` (https://github.com/netbox-community/ansible_modules/issues/170) +- Add ``device_query_filters`` and ``vm_query_filters`` to allow users to specify query filters for the specific type (https://github.com/netbox-community/ansible_modules/issues/140) +- Added ``group_names_raw`` option to the netbox inventory to allow users have the group names be the slug rather than prepending the group name with the type (https://github.com/netbox-community/ansible_modules/issues/138) +- Added ``raw_output`` option to netbox lookup plugin to return the exact output from the API with no doctoring (https://github.com/netbox-community/ansible_modules/pull/136) +- Added ``services`` option to the netbox inventory to allow users to toggle whether services are included or not (https://github.com/netbox-community/ansible_modules/pull/143) +- Added ``update_vc_child`` option to netbox_device_interface to allow child interfaces to be updated if device specified is the master device within the virtual chassis (https://github.com/netbox-community/ansible_modules/issues/105) +- Remove token from being required for nb_inventory as some NetBox setups don't require authorization for GET functions (https://github.com/netbox-community/ansible_modules/issues/177) +- Remove token from being required for nb_lookup as some NetBox setups don't require authorization for GET functions (https://github.com/netbox-community/ansible_modules/issues/183) + +Breaking Changes / Porting Guide +-------------------------------- + +- Change ``ip-addresses`` key in netbox inventory plugin to ``ip_addresses`` (https://github.com/netbox-community/ansible_modules/issues/139) + +Bugfixes +-------- + +- Allow integers to be passed in via Jinja string to properly convert back to integer (https://github.com/netbox-community/ansible_modules/issues/45) +- Allow services to be created with a different protocol (https://github.com/netbox-community/ansible_modules/issues/174) +- Properly find LAG if defined just as a string rather than dictionary with the relevant data (https://github.com/netbox-community/ansible_modules/issues/166) +- Removed choices within argument_spec for ``mode`` in ``netbox_device_interface`` and ``netbox_vm_interface``. This allows the API to return any error if an invalid choice is selected for ``mode`` (https://github.com/netbox-community/ansible_modules/issues/151) +- Updated rack width choices for latest NetBox version (https://github.com/netbox-community/ansible_modules/issues/167) + +v0.1.10 +======= + +Bugfixes +-------- + +- Updated inventory plugin name from netbox.netbox.netbox to netbox.netbox.nb_inventory (https://github.com/netbox-community/ansible_modules/pull/129) + +v0.1.9 +====== + +Breaking Changes / Porting Guide +-------------------------------- + +- This version has a few breaking changes due to new namespace and collection name. I felt it necessary to change the name of the lookup plugin and inventory plugin just not to have a non descriptive namespace call to use them. Below is an example: + ``netbox.netbox.netbox`` would be used for both inventory plugin and lookup plugin, but in different contexts so no collision will arise, but confusion will. + I renamed the lookup plugin to ``nb_lookup`` so it will be used with the FQCN ``netbox.netbox.nb_lookup``. + The inventory plugin will now be called within an inventory file by ``netbox.netbox.nb_inventory`` + +Bugfixes +-------- + +- Update ``netbox_tenant`` and ``netbox_tenant_group`` to use slugs for searching (available since NetBox 2.6). Added slug options to netbox_site, netbox_tenant, netbox_tenant_group (https://github.com/netbox-community/ansible_modules/pull/120) + +v0.1.8 +====== + +Bugfixes +-------- + +- If interface existed already, caused traceback and crashed playbook (https://github.com/netbox-community/ansible_modules/issues/114) + +v0.1.7 +====== + +Minor Changes +------------- + +- Added fetching services for devices in Netbox Inventory Plugin (https://github.com/netbox-community/ansible_modules/issues/58) +- Added option for interfaces and IP addresses of interfaces to be fetched via inventory plugin (https://github.com/netbox-community/ansible_modules/issues/60) +- Change lookups to property for subclassing of inventory plugin (https://github.com/netbox-community/ansible_modules/issues/62) + +Bugfixes +-------- + +- Assigning to parent log now finds LAG interface type dynamically rather than set statically in code (https://github.com/netbox-community/ansible_modules/issues/106) +- Create device with empty string to assign the device a UUID (https://github.com/netbox-community/ansible_modules/issues/107) +- If query_filters supplied are not allowed for either device or VM lookups, or no valid query filters, it will not attempt to fetch from devices or VMs. This should prevent devices or VMs from being fetched that do not meet the query_filters specified. (https://github.com/netbox-community/ansible_modules/issues/63) +- Properly create interface on correct device when in a VC (https://github.com/netbox-community/ansible_modules/issues/105) +- Updated _to_slug to follow same constructs NetBox uses (https://github.com/netbox-community/ansible_modules/issues/95) + +v0.1.6 +====== + +Minor Changes +------------- + +- Add dns_name to netbox_ip_address (https://github.com/netbox-community/ansible_modules/issues/84) +- Add region and region_id to query_filter for Netbox Inventory plugin (https://github.com/netbox-community/ansible_modules/issues/83) + +Bugfixes +-------- + +- Fixed vlan searching with vlan_group for netbox_prefix (https://github.com/netbox-community/ansible_modules/issues/85) +- Removed static choices from netbox_utils and now pulls the choices for each endpoint from the Netbox API at call time (https://github.com/netbox-community/ansible_modules/issues/67) + +v0.1.5 +====== + +Bugfixes +-------- + +- Add argument specs for every module to validate data passed in. Fixes some idempotency issues. POSSIBLE BREAKING CHANGE (https://github.com/netbox-community/ansible_modules/issues/68) +- Allow name updates to manufacturers (https://github.com/netbox-community/ansible_modules/issues/76) +- Builds slug for netbox_device_type from model which is now required and slug is optional. Model will be slugified if slug is not provided BREAKING CHANGE (https://github.com/netbox-community/ansible_modules/issues/77) +- Fail module with proper exception when connection to Netbox API cannot be established (https://github.com/netbox-community/ansible_modules/issues/80) +- netbox_device_interface Lag no longer has to be a dictionary and the value of the key can be the name of the LAG (https://github.com/netbox-community/ansible_modules/issues/81) +- netbox_ip_address If no address has no CIDR notation, it will convert it into a /32 and pass to Netbox. Fixes idempotency cidr notation is not provided (https://github.com/netbox-community/ansible_modules/issues/78) + +New Modules +----------- + +- netbox.netbox.netbox_service - Creates or removes service from Netbox + +v0.1.3 +====== + +Bugfixes +-------- + +- Add error handling for invalid key_file for lookup plugin (https://github.com/netbox-community/ansible_modules/issues/52) + +v0.1.2 +====== + +Bugfixes +-------- + +- Allow endpoint choices to be an integer of the choice rather than attempting to dynamically determine the choice ID (https://github.com/netbox-community/ansible_modules/issues/47) + +v0.1.1 +====== + +Bugfixes +-------- + +- Fixed issue with netbox_vm_interface where it would fail if different virtual machine had the same interface name (https://github.com/netbox-community/ansible_modules/issues/40) +- Updated netbox_ip_address to find interfaces on virtual machines correctly (https://github.com/netbox-community/ansible_modules/issues/40) + +v0.1.0 +====== + +Minor Changes +------------- + +- Add ``primary_ip4/6`` to ``netbox_ip_address`` (https://github.com/netbox-community/ansible_modules/issues/10) + +Breaking Changes / Porting Guide +-------------------------------- + +- Changed ``group`` to ``tenant_group`` in ``netbox_tenant.py`` (https://github.com/netbox-community/ansible_modules/issues/9) +- Changed ``role`` to ``prefix_role`` in ``netbox_prefix.py`` (https://github.com/netbox-community/ansible_modules/issues/9) +- Module failures when required fields arent provided (https://github.com/netbox-community/ansible_modules/issues/24) +- Renamed ``netbox_interface`` to ``netbox_device_interface`` (https://github.com/netbox-community/ansible_modules/issues/9) + +New Modules +----------- + +- netbox.netbox.netbox_aggregate - Creates or removes aggregates from Netbox +- netbox.netbox.netbox_circuit - Create, update or delete circuits within Netbox +- netbox.netbox.netbox_circuit_termination - Create, update or delete circuit terminations within Netbox +- netbox.netbox.netbox_circuit_type - Create, update or delete circuit types within Netbox +- netbox.netbox.netbox_cluster - Create, update or delete clusters within Netbox +- netbox.netbox.netbox_cluster_group - Create, update or delete cluster groups within Netbox +- netbox.netbox.netbox_cluster_type - Create, update or delete cluster types within Netbox +- netbox.netbox.netbox_device_bay - Create, update or delete device bays within Netbox +- netbox.netbox.netbox_device_role - Create, update or delete devices roles within Netbox +- netbox.netbox.netbox_device_type - Create, update or delete device types within Netbox +- netbox.netbox.netbox_inventory_item - Creates or removes inventory items from Netbox +- netbox.netbox.netbox_ipam_role - Creates or removes ipam roles from Netbox +- netbox.netbox.netbox_manufacturer - Create or delete manufacturers within Netbox +- netbox.netbox.netbox_platform - Create or delete platforms within Netbox +- netbox.netbox.netbox_provider - Create, update or delete providers within Netbox +- netbox.netbox.netbox_rack - Create, update or delete racks within Netbox +- netbox.netbox.netbox_rack_group - Create, update or delete racks groups within Netbox +- netbox.netbox.netbox_rack_role - Create, update or delete racks roles within Netbox +- netbox.netbox.netbox_region - Creates or removes regions from Netbox +- netbox.netbox.netbox_rir - Create, update or delete RIRs within Netbox +- netbox.netbox.netbox_tenant - Creates or removes tenants from Netbox +- netbox.netbox.netbox_tenant_group - Creates or removes tenant groups from Netbox +- netbox.netbox.netbox_virtual_machine - Create, update or delete virtual_machines within Netbox +- netbox.netbox.netbox_vlan - Create, update or delete vlans within Netbox +- netbox.netbox.netbox_vlan_group - Create, update or delete vlans groups within Netbox +- netbox.netbox.netbox_vm_interface - Creates or removes interfaces from virtual machines in Netbox +- netbox.netbox.netbox_vrf - Create, update or delete vrfs within Netbox diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/CONTRIBUTING.md b/collections-debian-merged/ansible_collections/netbox/netbox/CONTRIBUTING.md new file mode 100644 index 00000000..3943742d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/CONTRIBUTING.md @@ -0,0 +1,347 @@ +# Contributing + +## Modules + +The structure of the Netbox modules attempts to follow the layout of the Netbox API by having a module_util for each application (`dcim, ipam, tenancy, etc`) that inherits from a base module (`NetboxModule - netbox_utils.py`) and then implements the specific endpoints within the correct application module. + +e.g. Add logic for adding devices under netbox_dcim.py or ip addresses under netbox_ipam.py + +In turn when creating the actual modules, we're just calling a single function and passing in the Ansible Module and the endpoint. This means all the logic is within the specific application's module_util module and a lot of the logic should be the same for most endpoints since it is a basic operation of using the desired state of the endpoint and then either making sure it exists, updating it if it does exist, or removing it. There may be some special logic for other endpoints, but it should be minimal. + +(Ansible Module) netbox_{{ endpoint }} -> (Module Util) netbox_{{ application }} -> (Module Util) netbox_utils + +These modules are built using the pynetbox Python library which allows you to interact with Netbox using objects. Most of this is abstracted away when creating more modules, but something to be aware of. The reasoning for using underscores within the endpoint names is so the endpoints work with pynetbox. + +An example of connecting to a Netbox instance and then choosing the application, endpoint, and operation: + +```python +import pynetbox + +nb = pynetbox.api("http://localhost:32768", "0123456789abcdef0123456789abcdef01234567") + +# applications +nb.circuits +nb.dcim +nb.extras +nb.ipam +nb.secrets +nb.tenancy +nb.virtualization + +# endpoints (small sample) +nb.circuits.providers +nb.dcim.devices +nb.dcim.device_types +nb.ipam.vrfs +nb.ipam.ip_addresses +nb.tenancy.tenant_groups + +# operations +## Grabs a list of all endpoints +nb.dcim.devices.**all** +## Can pass a list of dicts to create multiple of the endpoints or just a dict to create a single endpoint +nb.dcim.devices.**create** +## Can filter to grab a name of the endpoint being filtered, not an object (Uses the same search criteria as the API) +nb.dcim.devices.**filter** +e.g. nb.dcim.devices.filter(name="test") +## Will retrieve the actual object that can be manipulated (updated, etc.) (Uses the same search criteria as the API) +nb.dcim.devices.**get** +e.g. nb.dcim.devices.get(name="test") + +# Manipulate object after using .get +## Now you can manipulate the object the same as a Python object +device = nb.dcim.devices.get(name="test") +device.description = "Test Description" +## Patch operation (patches the data to the API) +device.save() + +## If you were to just update the data in a fell swoop +serial = {"serial": "FXS10001", "description": "Test Description"} +## this operation will update the device and use the .save() method behind the scenes +device.update(serial) +``` + +## Adding an Endpoint + +### Updating Variables within Module Utils + +First thing is to setup several variables within **netbox_utils** and **netbox_application** module utils: + +Check the following variable to make sure the endpoint is within the correct application within **netbox_utils**: + +```python +API_APPS_ENDPOINTS = dict( + circuits=[], + dcim=[ + "devices", + "device_roles", + "device_types", + "interfaces", + "manufacturers", + "platforms", + "racks", + "rack_groups", + "rack_roles", + "regions", + "sites", + ], + extras=[], + ipam=["ip_addresses", "prefixes", "roles", "vlans", "vlan_groups", "vrfs"], + secrets=[], + tenancy=["tenants", "tenant_groups"], + virtualization=["clusters"], +) +``` + +Create a new variable in the **netbox_application** module until that matches the endpoint with any spaces being converted to underscores and all lowercase: + +```python +NB_DEVICE_TYPES = "device_types" +``` + +Add the endpoint to the **run** method of supported endpoints: + +```python +class NetboxDcimModule(NetboxModule): + def __init__(self, module, endpoint): + super().__init__(module, endpoint) + + def run(self): + """ + This function should have all necessary code for endpoints within the application + to create/update/delete the endpoint objects + Supported endpoints: + - device_types +``` + +Add the endpoint to the **ENDPOINT_NAME_MAPPING** variable within the **netbox_utils** module util. + +```python +ENDPOINT_NAME_MAPPING = { + "device_types": "device_type", +} +``` + +Log into your Netbox instance and navigate to `/api/docs` and searching for the **POST** documents for the given endpoint you're looking to create. +![POST Results](docs/media/postresults.PNG) +The module should implement all available fields that are not the **id** or **readOnly** such as the **created, last_updated, device_count** in the example above. + +Add the endpoint to the **ALLOWED_QUERY_PARAMS** variable within the **netbox_utils** module util. This should be something unique for the endpoint and will be used within the **_build_query_params** method to dynamically build query params. + +```python +ALLOWED_QUERY_PARAMS = { + "device_type": set(["slug"]), +} +``` + +If the endpoint has a key that uses an **Array**, you will need to add the endpoint to **REQUIRED_ID_FIND** and the key that will need to be converted. The lookup is done from the endpoint and pulls the choices from the API. + +```python +REQUIRED_ID_FIND = { + "circuits": set(["status"]), + "devices": set(["status", "face"]), + "device_types": set(["subdevice_role"]), + "interfaces": set(["form_factor", "mode"]), + "ip_addresses": set(["status", "role"]), + "prefixes": set(["status"]), + "racks": set(["status", "outer_unit", "type"]), + "services": set(["protocol"]), + "sites": set(["status"]), + "virtual_machines": set(["status", "face"]), + "vlans": set(["status"]), +} +# This is the method that uses the REQUIRED_ID_FIND variable (no change should be required within the method) + def _fetch_choice_value(self, search, endpoint): + app = self._find_app(endpoint) + nb_app = getattr(self.nb, app) + nb_endpoint = getattr(nb_app, endpoint) + endpoint_choices = nb_endpoint.choices() + + choices = [x for x in chain.from_iterable(endpoint_choices.values())] + + for item in choices: + if item["display_name"].lower() == search.lower(): + return item["value"] + elif item["value"] == search.lower(): + return item["value"] + self._handle_errors( + msg="%s was not found as a valid choice for %s" % (search, endpoint) + ) + + def _change_choices_id(self, endpoint, data): + """Used to change data that is static and under _choices for the application. + ex. DEVICE_STATUS + :returns data (dict): Returns the user defined data back with updated fields for _choices + :params endpoint (str): The endpoint that will be used for mapping to required _choices + :params data (dict): User defined data passed into the module + """ + if REQUIRED_ID_FIND.get(endpoint): + required_choices = REQUIRED_ID_FIND[endpoint] + for choice in required_choices: + if data.get(choice): + if isinstance(data[choice], int): + continue + choice_value = self._fetch_choice_value(data[choice], endpoint) + data[choice] = choice_value + + return data +``` + +If the key is something that pertains to a different endpoint such as **manufacturer** it will need to be added to a few variables within **netbox_utils**. + +```python +CONVERT_TO_ID = dict( + manufacturer="manufacturers", +) +QUERY_TYPES = dict( + manufacturer="slug", +) +``` + +If **slug** and **name** is required, we should leave **slug** out as an option within the module docs and generate it dynamically. Add the endpoint to **SLUG_REQUIRED** within **netbox_utils** module util. + +```python +SLUG_REQUIRED = { + "device_roles", + "ipam_roles", + "rack_groups", + "rack_roles", + "roles", + "manufacturers", + "platforms", + "vlan_groups", +} +``` + +Add code to the **netbox_application** module util to convert name to **slug**" + +```python +if self.endpoint in SLUG_REQUIRED: + if not data.get("slug"): + data["slug"] = self._to_slug(name) +``` + +If either **role** or **group** are within the acceptable keys to POST to the endpoint, we should prefix it with the endpoint name. This is to prevent the code from trying to fetch an ID from the wrong endpoint. +Add the new key to **CONVERT_KEYS** within **netbox_utils** module util. + +```python +CONVERT_KEYS = { + "prefix_role": "role", + "rack_group": "group", + "rack_role": "role", + "tenant_group": "group", + "vlan_role": "role", + "vlan_group": "group", +} + +# Adding the method that uses this code (no change should be required within the method) +def _convert_identical_keys(self, data): + """ + Used to change non-clashing keys for each module into identical keys that are required + to be passed to pynetbox + ex. rack_role back into role to pass to Netbox + Returns data + :params data (dict): Data dictionary after _find_ids method ran + """ + for key in data: + if key in CONVERT_KEYS: + new_key = CONVERT_KEYS[key] + value = data.pop(key) + data[new_key] = value + + return data +``` + +#### Creating **netbox_endpoint** Module + +Copying an existing module that has close to the same options is typically the path to least resistence and then updating portions of it to fit the new module. + +- Change the author: `Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com>` +- Update the **DOCUMENTATION**/**EXAMPLES**/**RETURN** string with the necessary information + - Main things are module, descriptions, author, version and the sub options under data + - The **RETURN** should return the singular of the endpoint name (done dynamically, but needs to be documented correctly) +- Update the module_util, module, and endpoint variable for the endpoint + + ```python + from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_DEVICE_ROLES, + ) + ``` + +- Update the **main()** as necessary: + + ```python + # Add if name is required or change to match required fields + if not module.params["data"].get("name"): + module.fail_json(msg="missing name") + # Make sure the objects are endpoint name and the correct class and variable are being called for the endpoint + netbox_device_role = NetboxDcimModule(module, NB_DEVICE_ROLES) + netbox_device_role.run() + ``` + +#### Testing + +- Please update any associated data within the `tests/unit/module_utils/test_data/` folders for the specified tests. This will most likely be needed as there are a few unit tests that test the data of **ALLOWED_QUERY_PARAMS**, etc. + + ```python + def test_normalize_data_returns_correct_data() + def test_find_app_returns_valid_app() + def test_change_choices_id() + def test_build_query_params_no_child() + def test_build_query_params_child() + ``` + +- Check each test above to see which `test_data` it uses and edit the corresponding data.json file +- Please add or update an existing play to test the new Netbox module for integration testing within `tests/integration/integration-tests.yml`. Make sure to test creation, duplicate, update (if possible), and deletion along with any other conditions that may want to be tested. +- Run `pytest -vv` to make sure all unit tests pass +- Run `black .` within the base directory for black formatting as it's required for tests to pass +- Run `ansible-lint integration-tests.yml` it's required for tests to pass +- Check necessary dependencies defined within `.travis.yml` for now if you're wanting to test locally + + +## Inventory + +Integration tests are run by comparing `ansible-inventory --list` against known output, for a few different inventory files with different options. + +When the inventory plugin is updated in a way that changes this output (or `netbox-deploy.py` is changed), the test data used for comparison will need to be updated. There is a script `./hacking/update_test_inventories.sh` to do this. + +Run from the root project working directory, and make sure you have a clean test instance of Netbox set up with test data loaded into it from `./tests/integration/netbox-deploy.py` + +``` +./hacking/update_test_inventories.sh +``` + +After running the script, to prevent introducing a regression you'll need to manually read through the diff to verify it looks correct. + + +# Setting up a local dev/test environment + +You can see the specific details of what happens in CI in `.travis.yml`. An overview of what you need to do is: + +* Run a test instance of Netbox on port 32768. The `netbox-docker` project makes this easy. + +``` +git clone git@github.com:netbox-community/netbox-docker.git +cd netbox-docker +export VERSION=snapshot +docker-compose pull +docker-compose up -d +``` + +* Check out this repo to a directory named `netbox` in a directory tree `ansible_collections/netbox/netbox` - running some `ansible-test` commands will complain if there's no `ansible_collections` in the current directory path, so you'd have to build/install the collection every time you want to run tests. + +``` +git clone git@github.com:netbox-community/ansible_modules.git ansible_collections/netbox/netbox +``` + +* Recommended - set up a Python virtualenv, in a directory above the collection. If you create a virtualenv inside the `ansible_modules` working directory `ansible-galaxy collection build` will include it as part of the build (until Ansible 2.10 where `build_ignore` is supported) + +``` +cd ../../.. +python3 -m venv venv +source venv/bin/activate +cd ansible_collections/netbox/netbox +``` + +* Install required python packages - see `.travis.yml` for the latest `pip install` list in different environments. diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/FILES.json b/collections-debian-merged/ansible_collections/netbox/netbox/FILES.json new file mode 100644 index 00000000..f62b1a62 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/FILES.json @@ -0,0 +1,3330 @@ +{ + "files": [ + { + "chksum_sha256": null, + "ftype": "dir", + "name": ".", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": ".github", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": ".github/workflows", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "6a5f6a513f7015fc075564ac1b2d40327a023a30a1a2fe791fc1d1e79b9b7a84", + "name": ".github/workflows/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "11b982013000abe46e1e9fe82a4287fdd19dd18b8bba063e6e3a7df40ed885e3", + "name": ".github/workflows/release.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": ".github/ISSUE_TEMPLATE", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "ce67907453c70a80193b48746b471a4e24a0916500ef1a5bebb933e308cdaadf", + "name": ".github/ISSUE_TEMPLATE/new-issue.md", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "meta", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "44f532c7d3e75de3accde7474bb678ca82741fabbea3153b1800405786732cc7", + "name": "meta/runtime.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "7b68a686caa9ce47f16858b547f68189e870f9ba2396157e69e8e77a58329d94", + "name": "pyproject.toml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "changelogs", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "changelogs/fragments", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "name": "changelogs/fragments/.gitkeep", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b6cb0abda8bebdeb1ea88ec2904da6e8b249cbf988c777aa892b23389d8bd892", + "name": "changelogs/config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a7c6454cace6702f83e97672ccc71369561f11d723fcbf79b50df146f3419f93", + "name": "changelogs/changelog.yaml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "076783baf5ef8fbd2d6f1a1a19998bd8ad1b8957bcf522a98dba85d4e5a237a0", + "name": ".gitignore", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b5e219ab076b1e90de2c650d480fe0a4b8724f839ac95f5240ed64a80202dfbf", + "name": "ansible.cfg", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "plugins", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "plugins/modules", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "99f2dec6bd9e895f3f72812e39ec1bb7aed55abacf9f9ce595b1cec318a4666f", + "name": "plugins/modules/netbox_console_port.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "774364ea1f7c7e1a7e9b36d68ba1dbe5ced3e7632b5770250ba3cf5ca2bae680", + "name": "plugins/modules/netbox_circuit_termination.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d2e12f72ebc9f3d75b5c1744514be011312be154696e781185ca0d9df19f2220", + "name": "plugins/modules/netbox_tag.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "c56baadada3ad7b23b7d84c4c728ffd001d69a415ab91de029ffc4fc4bc6cced", + "name": "plugins/modules/netbox_rack_group.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "1d23e9ea095e3e4d4bfa118235b0c59a4f9453be09de74056c0eb6f6786d74e3", + "name": "plugins/modules/netbox_cluster_group.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "08bdc68de22f3af2ce02a927d24ed9e064ccb57fde7a5c4c6e16c998294f9c71", + "name": "plugins/modules/netbox_front_port_template.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "996e867fa75a1242656420d2e69e2a59fff414aabdd663f6166dd6ee76308af8", + "name": "plugins/modules/netbox_power_feed.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "4c3c4ca28a54e18bdd0ee2a1710735f5830a5e9dc3793f1ae28c6eceb98677aa", + "name": "plugins/modules/netbox_vrf.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "6703ffcef48543e392da143abba0743f2082744ba145b61b9e5cfda6ed1ed46d", + "name": "plugins/modules/netbox_rir.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "966a3ef9fbed9a8a41485313c7acb02e1b686b0bc09c6a3d61c355700ad46006", + "name": "plugins/modules/netbox_device_bay.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "03f696c16d342ca32293c0b243d521bf108ac3d0b3618a1bc74826123a9c146b", + "name": "plugins/modules/netbox_device_type.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "982b66d80693c034bc691aea28f16f60f24480e9279d42a388f75d44d3089d39", + "name": "plugins/modules/netbox_power_outlet_template.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "3b436893899a1d4c748f2594c9aa226b121b56fb2b7e7b7cfc897c7c44d026d4", + "name": "plugins/modules/netbox_cluster_type.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "9828b50ee5093377477cf42b48e39f54e32146e3a7d8deee7f8a360869365cb3", + "name": "plugins/modules/netbox_region.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "719a9733380bbeb67f980619415ca9fb4d98dfa7d0e9a12a67c9b83f0d7b5576", + "name": "plugins/modules/netbox_ipam_role.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "623633a82aa91aef34e2d7f14b0cf8f8ec0d13fa9c91e5b01c7c31fefd48b29c", + "name": "plugins/modules/netbox_vm_interface.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "8bf434a07f3f37437298a01ffbfbba1f6e0230c9fde8d0dbf903eb06d7516bb4", + "name": "plugins/modules/netbox_rack_role.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "7dd61b9b5e0627489b560c673aaf2bbb5c91b5298e7dd78bcdd9dbd53751c062", + "name": "plugins/modules/netbox_vlan.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "2ba019745b318b2d06146533d15436208807572002b1d26b97da1b6b2e2e6267", + "name": "plugins/modules/netbox_provider.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "affa2b55fff8700ad3b20a8b2b30e1ef023f9028fcb08e83597f11cd9b517cb9", + "name": "plugins/modules/netbox_circuit_type.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "2d9f10a06a3a1eb56f1e0a3ea171442cdd862e19e7a255e44d1b1693700b54b3", + "name": "plugins/modules/netbox_inventory_item.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "7b0a90aacf1cc3e520625bd1758e5313d54000774e8c4d0e22f709643879de38", + "name": "plugins/modules/netbox_interface.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "da59dc9c1ba084b84c144b740ea671035bf170e336e58a78bb2ac6761c309c89", + "name": "plugins/modules/netbox_rear_port.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "ab81528591d1b31f622ec6631ad54c2c446eec69126060ac6b88cd4bf4339c6f", + "name": "plugins/modules/netbox_ip_address.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "6bbb070e4db656b4745daf075872e3271429d9983415d5361ff89ce1391849a1", + "name": "plugins/modules/netbox_tenant_group.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d8caf2f4c1d7d3a2f427e038250ee093df68d8418697c956ce3538b1979852f2", + "name": "plugins/modules/netbox_site.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "216376e6803c1541b642e5c4494b27dc20dde2af3f0ca12e2de9321877e57521", + "name": "plugins/modules/netbox_device_role.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "2612b8418fbdc56342f2d2d6ad39bcb14d601fe6128a0271bc08fdceafed5d89", + "name": "plugins/modules/netbox_manufacturer.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a0dd427e058d25bf04a563e690553b315f5e5d4d82bce8a53a775511e301fc22", + "name": "plugins/modules/netbox_cluster.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "9ae9304f88a80e3cd350608ba0ec25d8c26401bb2daf6f614dc35c1fdfc54d74", + "name": "plugins/modules/netbox_device_interface_template.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "ad0355baea21875869d341f42d2ca81a6511dd53b79e9971731310a5747acdf3", + "name": "plugins/modules/netbox_console_server_port.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "ea05405b69300752820681f88a9fe1736c081a6b6f31cc387eef2776d52fb4b4", + "name": "plugins/modules/netbox_device_interface.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "98e2bb17ffd0ec9d6e84271176cd2a9877a77ed739d642c2ffa6d203e6ef0d44", + "name": "plugins/modules/netbox_power_port.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "c795f7b54ecedc891ae6c3a08db5423074af68f74ee8c299b54c929a48d131af", + "name": "plugins/modules/netbox_device_bay_template.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "16b778397de6e22462ac12bdad2020315002c86663cd31c7c1562fa51e9f189d", + "name": "plugins/modules/netbox_console_port_template.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "86a0743b635cb68d5cd2bbb087dc2042641c75f8f21d5771c69496367cb41d9c", + "name": "plugins/modules/netbox_virtual_machine.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "f9ca768370ae00546779044c4d39eb725b8f6cfc8a2a5a3f65d8759a1f85103c", + "name": "plugins/modules/netbox_virtual_chassis.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a207365997ba912902ce6b909a8dbf0320f8d24947c3908cbed20163841e7919", + "name": "plugins/modules/netbox_console_server_port_template.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "f6ebbac7dc2008b6a5aee60ef907a021ce290048b8c4df20595eb6ee5e85ada7", + "name": "plugins/modules/netbox_service.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "52d292aa77bda4bbad0379464c024747d9afe79eb3e122d18f4ab7f0749311e3", + "name": "plugins/modules/netbox_cable.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "90eb29de0451c34dc1349ee6d2dd74744aa751d05175ef2c542f29de70fdd534", + "name": "plugins/modules/netbox_power_panel.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "ae3c158d0ed111774f343e2e6ce802c4cdc9afb073971392bb9a70b3d3e8c2c7", + "name": "plugins/modules/netbox_platform.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "2d269e1a5a1a112afd643baef41b588eb72a08d96ab52c5e77d5975d65c3bc43", + "name": "plugins/modules/netbox_prefix.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "0e40ccee0abdfac0bc14a13b348e7c1626eb9e11722860841e74c029bf758f02", + "name": "plugins/modules/netbox_rack.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e176d437d3dc745803e1f80437690ffa1d43802fc3e2e60f9c12706547398224", + "name": "plugins/modules/netbox_power_port_template.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a0678b0fcf13868c72618b2712d1e167f4d324b1e05df4cc6fd5e228e317d187", + "name": "plugins/modules/netbox_vlan_group.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "39a3eb8658b3b27ba488e1d1b13636ffaeb4323f40f3a05c7dcc0eade0c0acef", + "name": "plugins/modules/netbox_aggregate.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "19943e7219c2892b55ce84da646d4adee08cfa03db95d82d2bc8c013ad9d0edf", + "name": "plugins/modules/netbox_front_port.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "9a0584e0808197067f8a0cc6a8e020f8a0b6dc81052e1c9c24a1425bb87e2a9b", + "name": "plugins/modules/netbox_device.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "9e38231816c494621370c06c40c3f4925d02d2f331306076179284b0a46c836d", + "name": "plugins/modules/netbox_tenant.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "name": "plugins/modules/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "91c8a0b843bb8472dd2bcfa800371d5cb4cbb84e67745098f863dab30e50e373", + "name": "plugins/modules/netbox_power_outlet.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "fc23c8761bea41e159e3da70a3d1014d2ab85b69b2b313e47ff1faf7eaf7151e", + "name": "plugins/modules/netbox_rear_port_template.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "9100e845ffeca68a88b7f7b35a8e4509f19c92a6c9718420dc4a0d8700a05ed0", + "name": "plugins/modules/netbox_circuit.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "plugins/lookup", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "0a4d6ff5d9b32e82e802bf3e6dd50b80e4df4fb45d92a19e75c7de4b87c57283", + "name": "plugins/lookup/nb_lookup.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "plugins/module_utils", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "c39ad8234cec572197ae2531cc54802d22398e9d2e01262120b3465e098df606", + "name": "plugins/module_utils/netbox_tenancy.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a44799be11e963b6786c9b79a522566d95a76d76784013c307af3a3390c08343", + "name": "plugins/module_utils/netbox_circuits.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e6f046cd2dd31d30d4599e82f755f2eb68ec8dc71d82c00b87c7766c90f67901", + "name": "plugins/module_utils/netbox_utils.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e0af8eea89163afbb3d96614bed784a02d923dad00e6d2f0a42f8db4ec948cd8", + "name": "plugins/module_utils/netbox_ipam.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b1a9064a37131735ee44ac59f52830ae881637fda8de70da1dc50e897661e058", + "name": "plugins/module_utils/netbox_extras.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "cbd17351dc4b07546e022dfe174ae6fb1c695c46c4575adf583a60974389b133", + "name": "plugins/module_utils/netbox_virtualization.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "name": "plugins/module_utils/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a3a38efa4048796f85d8508f115888909b95afaf15469bd08095ece1ff3f3494", + "name": "plugins/module_utils/netbox_dcim.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b12f0853325dd27f38948cd9da65b72c563ce46612f8cf55cfa5806b1ab784c6", + "name": "plugins/module_utils/netbox_secrets.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "plugins/inventory", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "e110922091dca3751df64a4e0db3e165715637c41ca2bbcb9089f770301938b0", + "name": "plugins/inventory/nb_inventory.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "9374a831df686e0c11545a704561c6488d5bd19b3451052a69e330f443a094c9", + "name": "poetry.lock", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "hacking", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "20e474cee5c8ab272067c1cb4102a980f1c91ac7a242522573f0178f468c0e4e", + "name": "hacking/local-test.sh", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "31b38a6d54cf7fd233d647760c6f9b695bde61762b09b0aba5899ea746d14248", + "name": "hacking/black.sh", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "c02406514a0a53c1328f5397a4df2aae6ed1096159a3a85db20e34b5c73acdbe", + "name": "hacking/update_test_inventories.sh", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "c824f229eafb4ad8fcc24c800b6d08ad8af1c8ca866e9cdbfd543429b2a04a24", + "name": "hacking/build.sh", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "4f452a398baa0ad5a73bc651c0fe399a304e5803756b0575b6d139cb4a33d602", + "name": ".readthedocs.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "0a4f582875ab5a28d929d779fcfeaa6d8af4cda839e8f75b9d5cba1ef112bb3c", + "name": "CHANGELOG.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "fd9252cdaca1fcb5fe7a7827366bc7c54ff0911e8b3d6d96de0a12cc90d11a05", + "name": "CONTRIBUTING.md", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "50c6912a51c17fc5ab6b2ec7f38180bd09b0a24486876cf14c4fe40479bbd675", + "name": "docs/conf.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/_extensions", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "107938987445c408fdbefe4064f92d60821b880e2f76d6a75d9ca45c51264144", + "name": "docs/_extensions/pygments_lexer.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/changelog", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "d8a74a8989015f6ff8f2e9c52c07518770e91dd69c81b078eec816aafc8ab9a2", + "name": "docs/changelog/changelog_include.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b6b988f10c2e46f3745f50ba502c8c50af13d0138722796f789c13b5ddf9fa54", + "name": "docs/changelog/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_circuit", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "8778348f9e0b11cd71c53b0492306fe2af53d1390bd73fb24a4106bfe513b6ed", + "name": "docs/plugins/modules/netbox_circuit/netbox.netbox.netbox_circuit_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_cluster", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "23bd842b8052436aadeaf663854b37336694d87be9710f6c1cf5707e6342a5ee", + "name": "docs/plugins/modules/netbox_cluster/netbox.netbox.netbox_cluster_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_device_interface_template", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "b2a549a75a10d918e6fca32d7141aa9f36e8237c3700c8b607ab8d60eca5f409", + "name": "docs/plugins/modules/netbox_device_interface_template/netbox.netbox.netbox_device_interface_template_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_console_server_port_template", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "e0babf659b2abd3c4a0c99ecddc7c1bc1458f23310bccdd8d2c1d38ed373e9a0", + "name": "docs/plugins/modules/netbox_console_server_port_template/netbox.netbox.netbox_console_server_port_template_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_ip_address", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "0f08b2e91b744500e12c003c8566bfacf838ac64990e179982682acc79a1055c", + "name": "docs/plugins/modules/netbox_ip_address/netbox.netbox.netbox_ip_address_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_cable", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "f133906ea0a86879253e2f999d3b6196cdc84d5352bc3dd0561642d21b770546", + "name": "docs/plugins/modules/netbox_cable/netbox.netbox.netbox_cable_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_rack_role", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "9f8201dbbde4bc3daee12f2326345bfc3c676e14cefe0237f9b3c35aece56787", + "name": "docs/plugins/modules/netbox_rack_role/netbox.netbox.netbox_rack_role_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_vlan", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "8160ffb34f9c0441d9d53b88c30ffc610a14605d811b5881e9473f8f3169d372", + "name": "docs/plugins/modules/netbox_vlan/netbox.netbox.netbox_vlan_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_power_outlet", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "7ef9ad912ca14b3bbaf0ea0f00a30ca3429cd2b13c5e2a27fac6451ddf5c9c7a", + "name": "docs/plugins/modules/netbox_power_outlet/netbox.netbox.netbox_power_outlet_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_power_panel", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "2ae8707da1e3a30b3db7191bedb3a6420e2e9cd8513b5ca7182a2bf04879d72d", + "name": "docs/plugins/modules/netbox_power_panel/netbox.netbox.netbox_power_panel_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_device_interface", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "fb309dca4c968d976b1065d830d767ccfdbe3f5fa8b42a113d04d6d4ea8dccba", + "name": "docs/plugins/modules/netbox_device_interface/netbox.netbox.netbox_device_interface_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_cluster_type", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "02b411d42bb9508748c9517fa3957404b5532b22382ae2b3ecb81148c7c5a921", + "name": "docs/plugins/modules/netbox_cluster_type/netbox.netbox.netbox_cluster_type_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_vlan_group", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "eef6c76371877bbeaf9b5e019aae24f6eb560210ac0beaf61496a03eba7ac2de", + "name": "docs/plugins/modules/netbox_vlan_group/netbox.netbox.netbox_vlan_group_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_power_port", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "eb8d45f3039e75a06d37b49aa8a92e7066afbfc89ba31ff17cba4862b1fd7ccc", + "name": "docs/plugins/modules/netbox_power_port/netbox.netbox.netbox_power_port_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_cluster_group", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "65fa362e0d4ecc669a57fcab32a5e1cd8222e0cb188f4884026b150fa1b6ae67", + "name": "docs/plugins/modules/netbox_cluster_group/netbox.netbox.netbox_cluster_group_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_interface", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "0378cb02420e095810769db845138f97a4fad68171ca8a533d7913b17c8c2e28", + "name": "docs/plugins/modules/netbox_interface/netbox.netbox.netbox_interface_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_device", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "a52923199458c724ba2b517672ce09f7f3ed54a7cffd84898368ee9c460ce392", + "name": "docs/plugins/modules/netbox_device/netbox.netbox.netbox_device_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_provider", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "9d2534c235d50902a500996f2544d41284ee71618579b8c1d39ca3f3a1c6bcb8", + "name": "docs/plugins/modules/netbox_provider/netbox.netbox.netbox_provider_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_power_feed", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "645a12a6128fbf7330057f1fae40e8ef5ce08cc26be583cc9fbcbc36c2cf1d3c", + "name": "docs/plugins/modules/netbox_power_feed/netbox.netbox.netbox_power_feed_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_aggregate", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "0b05822656809cba096ff6b2c5a83423f097a816bfaa70519c325aee4f939065", + "name": "docs/plugins/modules/netbox_aggregate/netbox.netbox.netbox_aggregate_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_ipam_role", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "0bf1400a53027698df05c49eba66451bd1abd4f600954f7587d1aa0434270fca", + "name": "docs/plugins/modules/netbox_ipam_role/netbox.netbox.netbox_ipam_role_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_console_server_port", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "27a69f433dc564818ca3adc170427a3b190e8cf5e306ae2c6c6468636db32dca", + "name": "docs/plugins/modules/netbox_console_server_port/netbox.netbox.netbox_console_server_port_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_region", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "917164df34ce7ff3522b4adc04e2885ee216f7336362d97fba67b3105b0cb526", + "name": "docs/plugins/modules/netbox_region/netbox.netbox.netbox_region_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_tenant", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "1cbe484348ba7c08d2f3e51d31418ea749a17434adfaa2b7ca28644a3fe2b671", + "name": "docs/plugins/modules/netbox_tenant/netbox.netbox.netbox_tenant_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_rir", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "f6c8653407ce42c6be633e46bcf4c85d78bee3b98115d1aeb6e3719dbf0f661d", + "name": "docs/plugins/modules/netbox_rir/netbox.netbox.netbox_rir_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_device_role", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "59398570f33fc6acc41b4c06e1445f6b47dcf262e371472a665dc46c501d37bb", + "name": "docs/plugins/modules/netbox_device_role/netbox.netbox.netbox_device_role_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_device_bay", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "a8b957155a723106b654790b08296abf327ddabcba484666c8da72cf72425dda", + "name": "docs/plugins/modules/netbox_device_bay/netbox.netbox.netbox_device_bay_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_circuit_termination", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "3cb11f1d6282475a9f5f1968070a96c8f2cd074866f1d8c87d39d894d2576121", + "name": "docs/plugins/modules/netbox_circuit_termination/netbox.netbox.netbox_circuit_termination_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_power_port_template", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "68d8ee6635a1949bb3f5876bbe08a303508835427ca743ce1511436bfb0e75b0", + "name": "docs/plugins/modules/netbox_power_port_template/netbox.netbox.netbox_power_port_template_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_circuit_type", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "81ed06553efb347c2fecf58750803a430ac2ffc614198643da4a3418f005be26", + "name": "docs/plugins/modules/netbox_circuit_type/netbox.netbox.netbox_circuit_type_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_rear_port_template", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "ba538368cadcddeea31742320d289f62d35b8ed6a28919bfe032abdce4030d18", + "name": "docs/plugins/modules/netbox_rear_port_template/netbox.netbox.netbox_rear_port_template_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_virtual_machine", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "cf625c7e04f7ceeda701c6e13dbc12b3cf6e2d2aaba837fcb82455ec86ec8d55", + "name": "docs/plugins/modules/netbox_virtual_machine/netbox.netbox.netbox_virtual_machine_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_platform", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "623890ff1539a793d227e681cb34590a1790cf8e371d92b8483e1cd7370385a3", + "name": "docs/plugins/modules/netbox_platform/netbox.netbox.netbox_platform_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b328b6d238ed53fcd387f049ae65a8b213fe7ee6201b44bdcfb4dd0a4dfac2ab", + "name": "docs/plugins/modules/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_prefix", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "58c8780092c7b771b42fbce4ceb6365e50ee52d7995ff04bf6a699f1d6f60d3f", + "name": "docs/plugins/modules/netbox_prefix/netbox.netbox.netbox_prefix_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_virtual_chassis", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "2e38ca32dfa71ee56ee0e5d6367e5ab70a710ef3007f1acdb795deb830459d6f", + "name": "docs/plugins/modules/netbox_virtual_chassis/netbox.netbox.netbox_virtual_chassis_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_console_port", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "3a1689cf61dc3eb00d253c5551d71e34063edf0f09d327ddc0df3015f82f6955", + "name": "docs/plugins/modules/netbox_console_port/netbox.netbox.netbox_console_port_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_front_port_template", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "bda8554b1acda27a78af82a1474f9e202399486ddc46c46e44ff57430b0fe4b5", + "name": "docs/plugins/modules/netbox_front_port_template/netbox.netbox.netbox_front_port_template_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_device_type", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "045e5806b9ed2944537d350cefb1ea39b63591d3ca62a017611635a8d39a2f48", + "name": "docs/plugins/modules/netbox_device_type/netbox.netbox.netbox_device_type_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_tenant_group", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "57b3028f798a49f7c928d0c205690d52a354f682447bbbdaeb0d1ca9e43047ef", + "name": "docs/plugins/modules/netbox_tenant_group/netbox.netbox.netbox_tenant_group_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_rear_port", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "6d8677ca53a758b4424d43e078a924e07d63e4f83688a4108f0a276ac6dff9a1", + "name": "docs/plugins/modules/netbox_rear_port/netbox.netbox.netbox_rear_port_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_site", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "0b76d18332fe1e01be9e45c79fa7a9e99be6d061bd984a0b7477d160f51fb9c9", + "name": "docs/plugins/modules/netbox_site/netbox.netbox.netbox_site_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_rack", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "dde5a2ab6f3858f986b8c12bf6b2e22bc27bc1f73988fe00889f8ed0670df12e", + "name": "docs/plugins/modules/netbox_rack/netbox.netbox.netbox_rack_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_console_port_template", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "279a76f3ee740001a30da575fe61f74455a574f76b793a82df41abc107165ad5", + "name": "docs/plugins/modules/netbox_console_port_template/netbox.netbox.netbox_console_port_template_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_service", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "a1001b960b05239971f053a6fc81b096aeff9af89946636e1e29c93ef936f216", + "name": "docs/plugins/modules/netbox_service/netbox.netbox.netbox_service_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_manufacturer", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "e678278e8a790b0754afe483c33ca232ef9bee16a4372943804d9b2b886537a1", + "name": "docs/plugins/modules/netbox_manufacturer/netbox.netbox.netbox_manufacturer_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_vrf", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "ae77f780e419ebfbb72b3ebe1e60428a7ec2c177fb13680211ae8ebfd57b30ef", + "name": "docs/plugins/modules/netbox_vrf/netbox.netbox.netbox_vrf_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_rack_group", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "16cb88788c8441ecf7c4baf47d9eec986d0dd22378e684fc13969fe117aed469", + "name": "docs/plugins/modules/netbox_rack_group/netbox.netbox.netbox_rack_group_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_power_outlet_template", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "d3e04bf8f0dd4f3da64e37bb651b73ec33db2b5e8c1a43fb7ea6b5e799b78535", + "name": "docs/plugins/modules/netbox_power_outlet_template/netbox.netbox.netbox_power_outlet_template_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_inventory_item", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "315c8af7c35e3ca2c2cef595ce1a846473164d66316732039d1b49cc15cb837d", + "name": "docs/plugins/modules/netbox_inventory_item/netbox.netbox.netbox_inventory_item_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_vm_interface", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "94568260a2c44b3f3434d5d61d8461009c53770e6bf50975222ee763ed081860", + "name": "docs/plugins/modules/netbox_vm_interface/netbox.netbox.netbox_vm_interface_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_front_port", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "811aadabca8592bd9182536f030917e5c3e0888ea32f6a7b58b73bf6adc033db", + "name": "docs/plugins/modules/netbox_front_port/netbox.netbox.netbox_front_port_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/modules/netbox_device_bay_template", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "936a6665d628b037b68778eada96466e8b1ff99c6c98427c4839da3921e7071c", + "name": "docs/plugins/modules/netbox_device_bay_template/netbox.netbox.netbox_device_bay_template_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "1bccdb6eeb91acd7d2e5810fb2a15bc16c391ab99952fa0a19511844e7f1247f", + "name": "docs/plugins/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/lookup", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "b810b2bcd84e9ce205bf576b19f1fe2377d9a77e5d29be6571287fbb6425855f", + "name": "docs/plugins/lookup/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/lookup/nb_lookup", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "5c659af881dad024168a41854841529a167753563f60342c42b8c7f6733a53fa", + "name": "docs/plugins/lookup/nb_lookup/netbox.netbox.nb_lookup_lookup.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/module_utils", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/module_utils/netbox_dcim", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "aac738555b1754e47e6a3b632cde1a825c7af6f831382487ccad4eccc8910f13", + "name": "docs/plugins/module_utils/netbox_dcim/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/module_utils/netbox_virtualization", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "96fccbb031a84baaa22a47b0feca0bd05c5471eecaceb2908caf75f5d20384a4", + "name": "docs/plugins/module_utils/netbox_virtualization/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/module_utils/netbox_ipam", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "5c83d597e8b57c1fc6e1b240b361802f04cf5b2b93ed5b163430c2ad2a25c700", + "name": "docs/plugins/module_utils/netbox_ipam/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b4fdf0597f752c618b999e67fb63624f430780bf693e4b2b408ab5666df9d1bd", + "name": "docs/plugins/module_utils/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/module_utils/netbox_extras", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "91e0d05c958f3fd4bddd1f90fcffd40cb838ca9fe10ddb23fed96c96c29f925b", + "name": "docs/plugins/module_utils/netbox_extras/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/module_utils/netbox_tenancy", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "d3aae8ae61995eda566696ff9322a02bcd663128520294b5dbcee6c2d7b62f71", + "name": "docs/plugins/module_utils/netbox_tenancy/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/module_utils/netbox_utils", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "51b1dc879f2785c838a3a573ceeef3c09cf6d169d36f4e856d25cb60fde62463", + "name": "docs/plugins/module_utils/netbox_utils/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/module_utils/netbox_circuits", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "69b4f0147da11b460812a18e1a30c46cf783038607e8aa15b8104ebcf745971b", + "name": "docs/plugins/module_utils/netbox_circuits/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/module_utils/netbox_secrets", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "8fe38c525cf5a8c333411a9c0266960fb55f3360ec7aaf981a0765d126326c89", + "name": "docs/plugins/module_utils/netbox_secrets/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/inventory", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "461e36c633a005d037bfb9ceffcce8699b997868a32f699318d26f509a825722", + "name": "docs/plugins/inventory/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/plugins/inventory/nb_inventory", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "4b1ff0dd3ea0f206873fe758823e5449d0a551e4e21ebb8e080a82fd2aada933", + "name": "docs/plugins/inventory/nb_inventory/netbox.netbox.nb_inventory_inventory.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d918357b373afd010fb6dc4175500a2b69395e7403b2de5f90f3839f5f421de6", + "name": "docs/requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "bb9c1c44802ea59e2bd3082c2035458e449b497eddaf3759c5fdb6145ed73c3c", + "name": "docs/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/getting_started", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/getting_started/how-to-use", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "2209977de55cac27e5635bf2fb69d47ded104879d8bafcc5410f7de222bf3fac", + "name": "docs/getting_started/how-to-use/advanced.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "4837ec9570a075ec689cf7f705055923b49c8f1e98d2963bd020bd741dbc32ce", + "name": "docs/getting_started/how-to-use/modules.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/getting_started/how-to-use/media", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "abdd29c2a0dc029c4aa6d4176b1a205dbc5d4d1f434d821e04b9a08a26175221", + "name": "docs/getting_started/how-to-use/media/api_device_post.png", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b0d011fef324a804f6cbb2778e65d69c6373c8123fac576d9f49072471a6e908", + "name": "docs/getting_started/how-to-use/media/advanced_dict.png", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "3f4c6892f90e4b7a2ef8ce70fbe04c4c1cee8806d2aa37ffe09955045eb96bb2", + "name": "docs/getting_started/how-to-use/media/advanced_dns_name.png", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "7b28ca7e2a6cf1d0549a4eb2cafc901e3b2adfc449c3de6950bdf165daeb2b35", + "name": "docs/getting_started/how-to-use/inventory.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "774a3851c0f40047085702cbe031184cdb591d4b71edfbdf70dafee63275f7b4", + "name": "docs/getting_started/index.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a4a35f73d6e5c37ffbc2e117b4c11a1f9ebeaa78d93b9c36efca62080792c7ca", + "name": "docs/getting_started/installation.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "24afa8389fadeb19111920ff8dedfad7bbbe0cf54c9fefa238c564b8809a39e9", + "name": "docs/getting_started/how-to-use.rst", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "8b6587b859607f200f116e2cb043fc358e1c3a26c326b563bf348453cfc68307", + "name": "docs/Makefile", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/media", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "12ce503f9c545a573466e75cf028f316afc893e41f056be1ce6838b44db49537", + "name": "docs/media/postresults.PNG", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/js", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/js/ansible", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "2a63425844f360eba3a0f4548933729f58ec6e6df6fbf1906bf2986e394cf149", + "name": "docs/js/ansible/application.js", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "docs/_static", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "74318b36e2302111536796af5aa86a9ceab09faa3eedc3e7d28878b8751896d6", + "name": "docs/_static/pygments.css", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "0787ca656847c399975c5cca01be77f08d4ff9344b87bec1c1ba1aaa3cff56a8", + "name": "docs/_static/ansible.css", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "65b6ee4332407a1540ba70c026f044b11ef1b5019972c0fc64d2d0072338d5e5", + "name": "tests/test_data.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "b5e219ab076b1e90de2c650d480fe0a4b8724f839ac95f5240ed64a80202dfbf", + "name": "tests/integration/integration.cfg", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "76c5a19289c4ca86c9124b748e1a7d7d338ba92a46a451dfede864a91c96075c", + "name": "tests/integration/render_config.sh", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "203b14a7344dd161ffa5d57823855ad41c4b79b6915cb6a7705807d38d165718", + "name": "tests/integration/netbox-deploy.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/inventory-v2.9", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "de40fd34a465f7da8925f1e9ba52359e10ac740e08f2dfa398691810fcc03bd7", + "name": "tests/integration/targets/inventory-v2.9/runme_config.template", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "deacc9eea815485333d506e5bd64fb0c4a4a9980a33ff1b443a2deb0ca488209", + "name": "tests/integration/targets/inventory-v2.9/.gitignore", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a2d7d73b798332d8c33f405be79c1bfd423b0a8a253382f306ce2d9a10b88c97", + "name": "tests/integration/targets/inventory-v2.9/compare_inventory_json.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "60c34b02d7ad6501bc99e8dc006bf03de2d659429f736b9832789fedf8fa7a4c", + "name": "tests/integration/targets/inventory-v2.9/runme.sh", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "3efbf182d151ffe527a8a250a044a83997eec84d250c8651dcdfe6f62c60a97d", + "name": "tests/integration/targets/inventory-v2.9/aliases", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/inventory-v2.9/files", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "cc3b7936934f816b5deb8582b0a2f63e014efe69705756656511f44d06b27076", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "68ae42833ed1b434d8bed1e2790ec249d246bf8a185561fccf1ede08e9471fd2", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "05c61f414cce7613010b95597a0bac82e1e5fe368e0bdb0c89bce856303313ab", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a9a52b16db5a150a0cbd4ee0bc3aa47de0c3dd1eb076d76f14608ccc21ad267a", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "795ea156d25cb02bb366760248d53fec87606d7eddf9c46d8e2ecb5ecb900cbe", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "0b6bd0cebe81d542841ebef9cb3d6733394d5b433c45f038c4424a0e87a8ee92", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "011d9e23349afbee2d9c6ad63e17da2686a4d3ce372bdce3b1d6964e1eda284a", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "fe2715bdb953fa5bcfc66116cc6338bebc661ab515e7980e2dd01d4338a510fa", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "9fd0bf4b629d6ebd1d8d2d54ef28b5187db448d3997ae9260eac5af275d0fcaa", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory-options.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a8f440acd3b91f9d984c3645f71e04104fbdf4ba08da5a2f4beda64e8f004604", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "73fc7708cf5d4f968c7da3c3607e7f0e3353a7c6db089672df52477723561210", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory-options.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "94f58896127e47908da3d6ea22d6b42238bf258c6dfda4b5ab0fb120293ace65", + "name": "tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/v2.9", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/v2.9/tasks", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "12293e5057c80b6b491b0c99ec05d3556d2642f5fcb981fa0f215857b5855b3a", + "name": "tests/integration/targets/v2.9/tasks/netbox_tenant.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "5c9420a08702344179b8fb57622f176f2fa7643c880bec2ee3ea268eec0e9a62", + "name": "tests/integration/targets/v2.9/tasks/netbox_power_panel.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "280fb5eb850e14e7874ada263f1c03f15da3ed24f4730f960967cf8993eb81e3", + "name": "tests/integration/targets/v2.9/tasks/netbox_rir.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "beb8453c7e490b5b8b9412c0d8bc4cd6c234e24368aa1f7c6a3c2a7e651b61c6", + "name": "tests/integration/targets/v2.9/tasks/netbox_cluster_group.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e30a36a23b59b62e1713d5e30e78e396bdb2f11dc57b02c0e5319f0c25ac2b59", + "name": "tests/integration/targets/v2.9/tasks/netbox_site.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d3d62cd318b253c9f41f11d93ce4ccfa348c61bd0c5f281e7b33110ff9ca1d0f", + "name": "tests/integration/targets/v2.9/tasks/netbox_rear_port_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "298e7bd7ce01d6222d291e3d6a0dc4cce5389bdcbdeedb3da059c2c58335083d", + "name": "tests/integration/targets/v2.9/tasks/netbox_prefix.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d1c5d0d6e586d445667dd44b70a72e7d50564ba7e95cd2321289859eee3e3f6a", + "name": "tests/integration/targets/v2.9/tasks/netbox_console_server_port.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "961155a3a4abfda44ec2fef8512e7bf78304aa0c7aa366ce6756a054fe55a668", + "name": "tests/integration/targets/v2.9/tasks/netbox_front_port_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e577b0565ebe4c0dc03d48ab374370f1e0cd32f527fafae03b77f6d150a92f23", + "name": "tests/integration/targets/v2.9/tasks/netbox_aggregate.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "eb8a6debdb70720b139b7846ff875db7a9b3784c381b7c8d34b69e78ea18b9f7", + "name": "tests/integration/targets/v2.9/tasks/netbox_tenant_group.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "97d65d0eb476fc8cb429a865efc720acacf50b8c728f353ab5530a470d0357be", + "name": "tests/integration/targets/v2.9/tasks/netbox_virtual_machine.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "27d94ccbac16cb22212a445a84c30c603de859931cd2cf24d3cee8817fec7838", + "name": "tests/integration/targets/v2.9/tasks/netbox_provider.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a0f5b420ba0e259d28ed11d0f9a81f3e6e67744ae3bfdaaf5beb737343a44cef", + "name": "tests/integration/targets/v2.9/tasks/netbox_console_port_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "fa2e8d09e82a3f099913dc9cf23356a22626895123e59ef9528a183fa5d18dec", + "name": "tests/integration/targets/v2.9/tasks/netbox_device_role.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "8ecff0d071d115f52794bd1a6beac79bbd7ec1be177d97195f0aa4d9ac88fd0d", + "name": "tests/integration/targets/v2.9/tasks/netbox_device_interface.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d321931c4326f90e62a38c4edec1f64e8288dd838916dfa2aa298204f0af283e", + "name": "tests/integration/targets/v2.9/tasks/netbox_circuit_termination.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "58594bcb53cab2ed3306c3eddba71abb6b02491396463f83939a09013dbdfe59", + "name": "tests/integration/targets/v2.9/tasks/netbox_circuit.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d5ad8d2b8d1de9477715daba305db9098792119d4ff40c6ec7cfa92a06ff7c2e", + "name": "tests/integration/targets/v2.9/tasks/netbox_device_type.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "dd4e08a0654cdab2903b63053e4fc6e8c9b76a3ca5a566d4b0670bec3336df28", + "name": "tests/integration/targets/v2.9/tasks/netbox_service.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d51e0c69d26bf3bb64ae02399ceb1a59f05105e73d17c9c1b0144b85657f5bac", + "name": "tests/integration/targets/v2.9/tasks/netbox_power_port.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "42e0db37c6b39541457057109c81a5ac539997b0d24f4af5629296c0b444ee8e", + "name": "tests/integration/targets/v2.9/tasks/netbox_cluster_type.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d330e1ef4dac8983d7a0564df9492a1c651858dde2c4186577e8f86c6325b744", + "name": "tests/integration/targets/v2.9/tasks/netbox_power_outlet_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "64dc7aa36b711eb0b89a85019edfc52e6b77a8e6d6a8504730141565f58508ee", + "name": "tests/integration/targets/v2.9/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "2967ce7f5f94401bfba564fa22901be8a7c81ba4eb848eb018c317538a5cc22e", + "name": "tests/integration/targets/v2.9/tasks/netbox_cluster.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e2786fe8e17ffbc691657da44d5f7b26ca0a09afb52d851c6894eafe8766b422", + "name": "tests/integration/targets/v2.9/tasks/netbox_lookup.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "6b1ca66f7d02366fe705bc037cfed618b3c6395659ca5d261a518dca6c1881b2", + "name": "tests/integration/targets/v2.9/tasks/netbox_device.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "482fe4849d9caff69a8604ab3e8324b0beaceb49e66360d0c3eb7c79d7ac8c34", + "name": "tests/integration/targets/v2.9/tasks/netbox_device_bay.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "2a784756ec7c4cf50c065187f7c92e6f14117e59f86f32d148304f8ebb4deb46", + "name": "tests/integration/targets/v2.9/tasks/netbox_power_feed.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "64c202f343c3b22244058176bdbe027d1cbc629d189d8dca03f8e2797758d93c", + "name": "tests/integration/targets/v2.9/tasks/netbox_region.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "41d096f363b65d502ba0295c82e73ebaee59195c639d513689facc63afd3439f", + "name": "tests/integration/targets/v2.9/tasks/netbox_rack.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "0b1e4ff5a8a0341bf0e4e123a523abfb9d194d420b83563536ea837750aa5ec1", + "name": "tests/integration/targets/v2.9/tasks/netbox_circuit_type.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "952d715fc4c1dbca7f8d83128b67a0234a37666b9f553506ac749684dd80ebfb", + "name": "tests/integration/targets/v2.9/tasks/netbox_virtual_chassis.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "7b66cf37dbde92ab7eb1082fdcda2acc17662a70ac6ff4cbf879ce2be22257fd", + "name": "tests/integration/targets/v2.9/tasks/netbox_inventory_item.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "1666c782ed4990fe3999b1bce19b7cca29dabdedcecb4ec3a08f0a7bdece08e1", + "name": "tests/integration/targets/v2.9/tasks/netbox_vm_interface.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "f59f8e98b134cb5ee5df1345b1d6c467e2ac3160bd0efaed1ba7f6b48dbb5ba8", + "name": "tests/integration/targets/v2.9/tasks/netbox_vlan_group.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "32e11eea93510a83b15b736bdf46995492dd0dcbdb025993f16532aad6de2b22", + "name": "tests/integration/targets/v2.9/tasks/netbox_tag.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "4f94df7d99ba01a989c829231e3a2eab8ff955cb31e8bd1a19afa1b89c266f5f", + "name": "tests/integration/targets/v2.9/tasks/netbox_power_outlet.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "09972de795dcea23c8c0c17bfca7f75e780e0d07d532f3c99242eb1e311a00db", + "name": "tests/integration/targets/v2.9/tasks/netbox_cable.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "61501632bf0456ba39fbcebc22660f51d3e3000c6bf497c05e207851456537b6", + "name": "tests/integration/targets/v2.9/tasks/netbox_rack_role.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "dea0c2b1cf05598516633dcb71441502b002dd65cf6d0ec5c8c8691f251e256a", + "name": "tests/integration/targets/v2.9/tasks/netbox_ip_address.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "6f45b1dfe652beff573994e37d534d6c421f428d984f43d1bab497618009fef8", + "name": "tests/integration/targets/v2.9/tasks/netbox_manufacturer.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b013bde7259d29fb3bc35de81fec4f2a0c24c09d54ada22355a39e406d0a9554", + "name": "tests/integration/targets/v2.9/tasks/netbox_device_bay_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "3b56521d53c9a818916cb718e018214e7123db6b3feb0456532d476955d0aa28", + "name": "tests/integration/targets/v2.9/tasks/netbox_front_port.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "87927259bdf063bc202fa76992dc4ea7fdf3953cb181261271af32c0464fef6b", + "name": "tests/integration/targets/v2.9/tasks/netbox_ipam_role.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "f3de3e0d80daef5d6def7c55b974a6c88d4322ac35cb397ca1cbbfe90ef2fd8e", + "name": "tests/integration/targets/v2.9/tasks/netbox_vlan.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "f22bf91272f6001c1a9d8819ca38a0524c8a442640e5ba2eef2d1d53f4f4340e", + "name": "tests/integration/targets/v2.9/tasks/netbox_console_port.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a14bdfe2e9b2c5dc723a6da6b812da1163057f03cf19fe2e5aec663ee6f1452e", + "name": "tests/integration/targets/v2.9/tasks/netbox_rear_port.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "35583509824aac0905c990d980a1e677ce4f259a82c1d2cd3addb0975f6a007d", + "name": "tests/integration/targets/v2.9/tasks/netbox_platform.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "31efff083088eb516aa5e7769b52024bee646ab8f996a708fc09d2445c16ce7d", + "name": "tests/integration/targets/v2.9/tasks/netbox_console_server_port_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "ff125b2f31d99d90775fb6167b857f25465d0124dab2ae228315eb17f9c67860", + "name": "tests/integration/targets/v2.9/tasks/netbox_power_port_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b8e3c495f289093c94d3612213c45a6f89624e4d762fd04e74d3062dab34cf1a", + "name": "tests/integration/targets/v2.9/tasks/netbox_rack_group.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e5e071bccd038ddbae0dc33ed5b2ea7b9cce00cd28f29d8160f0d308784d30dc", + "name": "tests/integration/targets/v2.9/tasks/netbox_device_interface_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d7d228b4f15c51ecb5f52f83a999ba5576185adc8a42d224069211821600a42d", + "name": "tests/integration/targets/v2.9/tasks/netbox_vrf.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/inventory-latest", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "de40fd34a465f7da8925f1e9ba52359e10ac740e08f2dfa398691810fcc03bd7", + "name": "tests/integration/targets/inventory-latest/runme_config.template", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "deacc9eea815485333d506e5bd64fb0c4a4a9980a33ff1b443a2deb0ca488209", + "name": "tests/integration/targets/inventory-latest/.gitignore", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a2d7d73b798332d8c33f405be79c1bfd423b0a8a253382f306ce2d9a10b88c97", + "name": "tests/integration/targets/inventory-latest/compare_inventory_json.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "60c34b02d7ad6501bc99e8dc006bf03de2d659429f736b9832789fedf8fa7a4c", + "name": "tests/integration/targets/inventory-latest/runme.sh", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "3efbf182d151ffe527a8a250a044a83997eec84d250c8651dcdfe6f62c60a97d", + "name": "tests/integration/targets/inventory-latest/aliases", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/inventory-latest/files", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "455874eb76202769c12e23f6815ddc7016084a56f6101431753bf15469fbed18", + "name": "tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "fb73f0593b167c635ba413d743f70de34c9effafbb35c85bb457b5b35cd387b0", + "name": "tests/integration/targets/inventory-latest/files/test-inventory-plurals.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "1c263a6aef40650ddadf78875d8929ebbfb4915686c7028f074790205bc23488", + "name": "tests/integration/targets/inventory-latest/files/test-inventory-legacy.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a9a52b16db5a150a0cbd4ee0bc3aa47de0c3dd1eb076d76f14608ccc21ad267a", + "name": "tests/integration/targets/inventory-latest/files/test-inventory-legacy.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "bffe8231bcd4c0165b506a9cc4e52824ae54064e1b956f11e85da5584a437109", + "name": "tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "fb61a3e3746e7d4a29c821658d1ac8c03dbbb9956247871fdacafc5797de2bef", + "name": "tests/integration/targets/inventory-latest/files/test-inventory.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "3926dc184647410c93fe972ec6bb54df7fd1e925e0b9436c804fae8be5beee17", + "name": "tests/integration/targets/inventory-latest/files/test-inventory.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "99d9416140420535db5552093edabf2139d49c00e3d6e43ec693ace22e449198", + "name": "tests/integration/targets/inventory-latest/files/test-inventory-plurals.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "6ba28468c73fad9c6ae25887d621fe7ef52ff2321fb2f71b19632f28b851230a", + "name": "tests/integration/targets/inventory-latest/files/test-inventory-options.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "55e132c3a479ff164ed77264191d1679690f1ea7d2ffdb24bcd0c34ad57a4c5f", + "name": "tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "0e4893e9b4a7b20a2f742c714fa4106ad1d05a0ce5b16a9ff8afd2f90fccff44", + "name": "tests/integration/targets/inventory-latest/files/test-inventory-options.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "914be21007e658a56aa8b265034cfdf00ad721d353dea9b2419d0f956bd0f021", + "name": "tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/latest", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/latest/tasks", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "12293e5057c80b6b491b0c99ec05d3556d2642f5fcb981fa0f215857b5855b3a", + "name": "tests/integration/targets/latest/tasks/netbox_tenant.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "5c9420a08702344179b8fb57622f176f2fa7643c880bec2ee3ea268eec0e9a62", + "name": "tests/integration/targets/latest/tasks/netbox_power_panel.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "280fb5eb850e14e7874ada263f1c03f15da3ed24f4730f960967cf8993eb81e3", + "name": "tests/integration/targets/latest/tasks/netbox_rir.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "beb8453c7e490b5b8b9412c0d8bc4cd6c234e24368aa1f7c6a3c2a7e651b61c6", + "name": "tests/integration/targets/latest/tasks/netbox_cluster_group.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e30a36a23b59b62e1713d5e30e78e396bdb2f11dc57b02c0e5319f0c25ac2b59", + "name": "tests/integration/targets/latest/tasks/netbox_site.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d3d62cd318b253c9f41f11d93ce4ccfa348c61bd0c5f281e7b33110ff9ca1d0f", + "name": "tests/integration/targets/latest/tasks/netbox_rear_port_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "298e7bd7ce01d6222d291e3d6a0dc4cce5389bdcbdeedb3da059c2c58335083d", + "name": "tests/integration/targets/latest/tasks/netbox_prefix.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d1c5d0d6e586d445667dd44b70a72e7d50564ba7e95cd2321289859eee3e3f6a", + "name": "tests/integration/targets/latest/tasks/netbox_console_server_port.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "961155a3a4abfda44ec2fef8512e7bf78304aa0c7aa366ce6756a054fe55a668", + "name": "tests/integration/targets/latest/tasks/netbox_front_port_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e577b0565ebe4c0dc03d48ab374370f1e0cd32f527fafae03b77f6d150a92f23", + "name": "tests/integration/targets/latest/tasks/netbox_aggregate.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "eb8a6debdb70720b139b7846ff875db7a9b3784c381b7c8d34b69e78ea18b9f7", + "name": "tests/integration/targets/latest/tasks/netbox_tenant_group.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "97d65d0eb476fc8cb429a865efc720acacf50b8c728f353ab5530a470d0357be", + "name": "tests/integration/targets/latest/tasks/netbox_virtual_machine.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "27d94ccbac16cb22212a445a84c30c603de859931cd2cf24d3cee8817fec7838", + "name": "tests/integration/targets/latest/tasks/netbox_provider.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a0f5b420ba0e259d28ed11d0f9a81f3e6e67744ae3bfdaaf5beb737343a44cef", + "name": "tests/integration/targets/latest/tasks/netbox_console_port_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "fa2e8d09e82a3f099913dc9cf23356a22626895123e59ef9528a183fa5d18dec", + "name": "tests/integration/targets/latest/tasks/netbox_device_role.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "8ecff0d071d115f52794bd1a6beac79bbd7ec1be177d97195f0aa4d9ac88fd0d", + "name": "tests/integration/targets/latest/tasks/netbox_device_interface.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d321931c4326f90e62a38c4edec1f64e8288dd838916dfa2aa298204f0af283e", + "name": "tests/integration/targets/latest/tasks/netbox_circuit_termination.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "58594bcb53cab2ed3306c3eddba71abb6b02491396463f83939a09013dbdfe59", + "name": "tests/integration/targets/latest/tasks/netbox_circuit.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d5ad8d2b8d1de9477715daba305db9098792119d4ff40c6ec7cfa92a06ff7c2e", + "name": "tests/integration/targets/latest/tasks/netbox_device_type.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "1e3384a81b3bc49bcaf3f7d82268cc03a9dd609e2a88e18eeac2677bcf604154", + "name": "tests/integration/targets/latest/tasks/netbox_service.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d51e0c69d26bf3bb64ae02399ceb1a59f05105e73d17c9c1b0144b85657f5bac", + "name": "tests/integration/targets/latest/tasks/netbox_power_port.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "42e0db37c6b39541457057109c81a5ac539997b0d24f4af5629296c0b444ee8e", + "name": "tests/integration/targets/latest/tasks/netbox_cluster_type.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d330e1ef4dac8983d7a0564df9492a1c651858dde2c4186577e8f86c6325b744", + "name": "tests/integration/targets/latest/tasks/netbox_power_outlet_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "64dc7aa36b711eb0b89a85019edfc52e6b77a8e6d6a8504730141565f58508ee", + "name": "tests/integration/targets/latest/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "2967ce7f5f94401bfba564fa22901be8a7c81ba4eb848eb018c317538a5cc22e", + "name": "tests/integration/targets/latest/tasks/netbox_cluster.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e2786fe8e17ffbc691657da44d5f7b26ca0a09afb52d851c6894eafe8766b422", + "name": "tests/integration/targets/latest/tasks/netbox_lookup.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "6b1ca66f7d02366fe705bc037cfed618b3c6395659ca5d261a518dca6c1881b2", + "name": "tests/integration/targets/latest/tasks/netbox_device.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "482fe4849d9caff69a8604ab3e8324b0beaceb49e66360d0c3eb7c79d7ac8c34", + "name": "tests/integration/targets/latest/tasks/netbox_device_bay.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "2a784756ec7c4cf50c065187f7c92e6f14117e59f86f32d148304f8ebb4deb46", + "name": "tests/integration/targets/latest/tasks/netbox_power_feed.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "64c202f343c3b22244058176bdbe027d1cbc629d189d8dca03f8e2797758d93c", + "name": "tests/integration/targets/latest/tasks/netbox_region.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "41d096f363b65d502ba0295c82e73ebaee59195c639d513689facc63afd3439f", + "name": "tests/integration/targets/latest/tasks/netbox_rack.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "0b1e4ff5a8a0341bf0e4e123a523abfb9d194d420b83563536ea837750aa5ec1", + "name": "tests/integration/targets/latest/tasks/netbox_circuit_type.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "952d715fc4c1dbca7f8d83128b67a0234a37666b9f553506ac749684dd80ebfb", + "name": "tests/integration/targets/latest/tasks/netbox_virtual_chassis.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "7b66cf37dbde92ab7eb1082fdcda2acc17662a70ac6ff4cbf879ce2be22257fd", + "name": "tests/integration/targets/latest/tasks/netbox_inventory_item.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "1666c782ed4990fe3999b1bce19b7cca29dabdedcecb4ec3a08f0a7bdece08e1", + "name": "tests/integration/targets/latest/tasks/netbox_vm_interface.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "f59f8e98b134cb5ee5df1345b1d6c467e2ac3160bd0efaed1ba7f6b48dbb5ba8", + "name": "tests/integration/targets/latest/tasks/netbox_vlan_group.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "32e11eea93510a83b15b736bdf46995492dd0dcbdb025993f16532aad6de2b22", + "name": "tests/integration/targets/latest/tasks/netbox_tag.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "4f94df7d99ba01a989c829231e3a2eab8ff955cb31e8bd1a19afa1b89c266f5f", + "name": "tests/integration/targets/latest/tasks/netbox_power_outlet.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "09972de795dcea23c8c0c17bfca7f75e780e0d07d532f3c99242eb1e311a00db", + "name": "tests/integration/targets/latest/tasks/netbox_cable.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "61501632bf0456ba39fbcebc22660f51d3e3000c6bf497c05e207851456537b6", + "name": "tests/integration/targets/latest/tasks/netbox_rack_role.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "dea0c2b1cf05598516633dcb71441502b002dd65cf6d0ec5c8c8691f251e256a", + "name": "tests/integration/targets/latest/tasks/netbox_ip_address.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "6f45b1dfe652beff573994e37d534d6c421f428d984f43d1bab497618009fef8", + "name": "tests/integration/targets/latest/tasks/netbox_manufacturer.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b013bde7259d29fb3bc35de81fec4f2a0c24c09d54ada22355a39e406d0a9554", + "name": "tests/integration/targets/latest/tasks/netbox_device_bay_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "3b56521d53c9a818916cb718e018214e7123db6b3feb0456532d476955d0aa28", + "name": "tests/integration/targets/latest/tasks/netbox_front_port.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "87927259bdf063bc202fa76992dc4ea7fdf3953cb181261271af32c0464fef6b", + "name": "tests/integration/targets/latest/tasks/netbox_ipam_role.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "f3de3e0d80daef5d6def7c55b974a6c88d4322ac35cb397ca1cbbfe90ef2fd8e", + "name": "tests/integration/targets/latest/tasks/netbox_vlan.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "f22bf91272f6001c1a9d8819ca38a0524c8a442640e5ba2eef2d1d53f4f4340e", + "name": "tests/integration/targets/latest/tasks/netbox_console_port.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "a14bdfe2e9b2c5dc723a6da6b812da1163057f03cf19fe2e5aec663ee6f1452e", + "name": "tests/integration/targets/latest/tasks/netbox_rear_port.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "35583509824aac0905c990d980a1e677ce4f259a82c1d2cd3addb0975f6a007d", + "name": "tests/integration/targets/latest/tasks/netbox_platform.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "31efff083088eb516aa5e7769b52024bee646ab8f996a708fc09d2445c16ce7d", + "name": "tests/integration/targets/latest/tasks/netbox_console_server_port_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "ff125b2f31d99d90775fb6167b857f25465d0124dab2ae228315eb17f9c67860", + "name": "tests/integration/targets/latest/tasks/netbox_power_port_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "b8e3c495f289093c94d3612213c45a6f89624e4d762fd04e74d3062dab34cf1a", + "name": "tests/integration/targets/latest/tasks/netbox_rack_group.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e5e071bccd038ddbae0dc33ed5b2ea7b9cce00cd28f29d8160f0d308784d30dc", + "name": "tests/integration/targets/latest/tasks/netbox_device_interface_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d7d228b4f15c51ecb5f52f83a999ba5576185adc8a42d224069211821600a42d", + "name": "tests/integration/targets/latest/tasks/netbox_vrf.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/regression-v2.9", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/regression-v2.9/tasks", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "e31bdeaa4afb0a321061f13fa54fb3d894ab1667a5f38bae812a71be408feaee", + "name": "tests/integration/targets/regression-v2.9/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/regression-latest", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/integration/targets/regression-latest/tasks", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "e31bdeaa4afb0a321061f13fa54fb3d894ab1667a5f38bae812a71be408feaee", + "name": "tests/integration/targets/regression-latest/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/fixtures", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/fixtures/choices", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "31d58287f5b07e8aa0c0e1c1ca12b907f88d8ab987b98b5ef09beef01a49a090", + "name": "tests/unit/module_utils/fixtures/choices/sites.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "3a7f82c633273e126c2455161a1c832460b368d8e40677a0cb290ec9910e2bcf", + "name": "tests/unit/module_utils/fixtures/choices/prefixes.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "d28c8ab2e5a53cf617e96c37caa10d4881e19f2756e59ce036610d3ac13935af", + "name": "tests/unit/module_utils/fixtures/choices/devices.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "710913087d5fe7c6250ac7a6bbdb378fd2a98f5425595ed92a452e6789ea62e1", + "name": "tests/unit/module_utils/fixtures/choices/racks.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "1eee733c9069414f6294f64ecf0bd65c0afb42053c0ee8e1d9bf0ac48ca9e59c", + "name": "tests/unit/module_utils/fixtures/choices/services.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "065d95e75aa2b700f265e33133b94b5c9f93bd30d9be9a0fdcfe4a17671421ee", + "name": "tests/unit/module_utils/fixtures/choices/device_types.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "8a019714226dd0208003a775d05c48aed8195b0f09a23ad4c5e976a31f2f4b91", + "name": "tests/unit/module_utils/fixtures/choices/virtual_machines.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "eef93b5c65458cac7b33b1e1365518d381d3e12bcc73b7afbdd163a42350a521", + "name": "tests/unit/module_utils/fixtures/choices/circuits.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "c4b951095ee4c7443616cda2f26ed9e778226bf4b8e193e0f67cc5b0b96a6636", + "name": "tests/unit/module_utils/fixtures/choices/vlans.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "69edd276a4d6ff23a24aa290de80ed861b94cba637207a9edb481d7b4dfa9a59", + "name": "tests/unit/module_utils/fixtures/choices/interfaces.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/test_data", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/test_data/build_query_params_user_query_params", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "362739ebc62d83999764392653b6347662f5fadf3f88b5b38a9ce0924db2acea", + "name": "tests/unit/module_utils/test_data/build_query_params_user_query_params/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/test_data/choices_id", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "0ef637ce49cb7fbf3fb67f39641b2db2ddddae41a4a5c772e65cb401fc21d595", + "name": "tests/unit/module_utils/test_data/choices_id/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/test_data/slug", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "d38464486cef0b272cd7879626d2fbccaba6359c5166c2aed483fcd0c108645c", + "name": "tests/unit/module_utils/test_data/slug/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/test_data/normalize_data", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "fb8e60b069fb6b847cc286cf83c8df8ea5c8b19078f614be83983e85616036aa", + "name": "tests/unit/module_utils/test_data/normalize_data/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/test_data/arg_spec_default", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "f48dd7aea115db209d32d4ce0fc6b9836c877a08bf035ee588bbc3f436b4a076", + "name": "tests/unit/module_utils/test_data/arg_spec_default/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/test_data/build_query_params_child", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "36c3022784f9c013ae4d6621b25036069289046a05298fd903ba291830b9838c", + "name": "tests/unit/module_utils/test_data/build_query_params_child/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/test_data/find_app", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "f57619e431da1db5f3459f0d390e0f98ed8422dd1dfaea0a322faa6689762e2f", + "name": "tests/unit/module_utils/test_data/find_app/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/module_utils/test_data/build_query_params_no_child", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "9bbabe640e4d0f9179270cc4825f1bc8262fab3e91987dc0acc5af82d2799dc2", + "name": "tests/unit/module_utils/test_data/build_query_params_no_child/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "ba7e7ccc8f8ed71acfcae17e88da6f9ec71c8a5ac96b8e97e2096c93ef57b259", + "name": "tests/unit/module_utils/test_netbox_base_class.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "name": "tests/unit/module_utils/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/inventory", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "0ea4483417b08e3523c6d781b2f028c2be69360927e43f193a39d2cec9422a4b", + "name": "tests/unit/inventory/test_nb_inventory.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/inventory/test_data", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/inventory/test_data/validate_query_parameter", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "c38afa75bd45672caa3cae3eef0306f045828f98f47f3ee8f41e2a51296e4f79", + "name": "tests/unit/inventory/test_data/validate_query_parameter/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/inventory/test_data/filter_query_parameters", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "3ecebe7994f1acfae3e196b3f8bce30dab18114fa92f662a4e06a57f338870be", + "name": "tests/unit/inventory/test_data/filter_query_parameters/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/inventory/test_data/get_resource_list_chunked", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "09bee34133057a8261ff63b1392f689076a161cefca45e489fe9ed0b9846dee4", + "name": "tests/unit/inventory/test_data/get_resource_list_chunked/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/inventory/test_data/refresh_url", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "26ce71fb70dc9b712c6c61495f8e03308f03a1d38efce476737100cde2664d93", + "name": "tests/unit/inventory/test_data/refresh_url/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/unit/inventory/test_data/group_extractors", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "98ab91835e8c579f1c91faab113b7777d304654f22e5dd9696e5714abffa3f1e", + "name": "tests/unit/inventory/test_data/group_extractors/data.json", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "name": "tests/unit/inventory/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": null, + "name": "tests/sanity", + "ftype": "dir", + "chksum_type": null, + "format": 1 + }, + { + "chksum_sha256": "e516db73208100f743df81a1bc29fff33ab993bbba478f82433a60d8e291da2c", + "name": "tests/sanity/ignore-2.10.txt", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "6ce311fede629b2098b1b2718fe80c5cfb844b97f68c9f8db21a45f91cc8a62a", + "name": "README.md", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "605e9047a563c5c8396ffb18232aa4304ec56586aee537c45064c6fb425e44ad", + "name": "LICENSE", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + }, + { + "chksum_sha256": "9e5ff878398269610694214afbe7ac8a22d56750953e6332815beb0d13ceb02b", + "name": ".travis.yml", + "ftype": "file", + "chksum_type": "sha256", + "format": 1 + } + ], + "format": 1 +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/LICENSE b/collections-debian-merged/ansible_collections/netbox/netbox/LICENSE new file mode 100644 index 00000000..e62ec04c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/LICENSE @@ -0,0 +1,674 @@ +GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<https://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/MANIFEST.json b/collections-debian-merged/ansible_collections/netbox/netbox/MANIFEST.json new file mode 100644 index 00000000..ddd50cbe --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/MANIFEST.json @@ -0,0 +1,36 @@ +{ + "file_manifest_file": { + "chksum_sha256": "32a7af273a003e033a81ea9a1ad1f2ad9373a8ab9981cc78409fa00449b11015", + "ftype": "file", + "name": "FILES.json", + "chksum_type": "sha256", + "format": 1 + }, + "collection_info": { + "documentation": "https://netbox-ansible-collection.readthedocs.io/en/latest/", + "dependencies": { + "community.general": ">=1.0.0", + "ansible.netcommon": ">=1.0.0" + }, + "name": "netbox", + "tags": [ + "dcim", + "system", + "ipam", + "networking" + ], + "authors": [ + "Mikhail Yohman <mikhail.yohman@gmail.com>" + ], + "namespace": "netbox", + "issues": "https://github.com/netbox-community/ansible_modules/issues", + "license_file": "LICENSE", + "license": [], + "description": "This is a collection of Netbox Ansible modules", + "readme": "README.md", + "version": "1.2.1", + "repository": "https://github.com/netbox-community/ansible_modules", + "homepage": null + }, + "format": 1 +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/README.md b/collections-debian-merged/ansible_collections/netbox/netbox/README.md new file mode 100644 index 00000000..fc59c107 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/README.md @@ -0,0 +1,23 @@ +![Devel CI Status](https://github.com/netbox-community/ansible_modules/workflows/All%20CI%20related%20tasks/badge.svg?branch=devel) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) +![Release](https://img.shields.io/github/v/release/netbox-community/ansible_modules) + +# NetBox modules for Ansible using Ansible Collections + +We have moved this collection to a different namespace and collection name on Ansible Galaxy. The new versions will be at `netbox.netbox`. + +To keep the code simple, we only officially support the two latest releases of NetBox and don't guarantee backwards compatibility beyond that. We do try and keep these breaking changes to a minimum, but sometimes changes to NetBox's API cause us to have to make breaking changes. + +## Requirements + +- NetBox 2.6+ or the two latest NetBox releases +- Python 3.6+ +- Python modules: **pynetbox 5.0.4+** +- Ansible 2.9+ +- NetBox write-enabled token when using modules or read-only token for `nb_lookup/nb_inventory` + +We have a new docs site live that can be found [here](https://netbox-ansible-collection.readthedocs.io/en/latest/) + +## How to Contribute + +Please read ![Contributing](CONTRIBUTING.md) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/ansible.cfg b/collections-debian-merged/ansible_collections/netbox/netbox/ansible.cfg new file mode 100644 index 00000000..4501b1d8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/ansible.cfg @@ -0,0 +1,5 @@ +[defaults] +force_valid_group_names = always + +[inventory] +enable_plugins = netbox.netbox.nb_inventory, auto, host_list, yaml, ini, toml, script diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/changelogs/changelog.yaml b/collections-debian-merged/ansible_collections/netbox/netbox/changelogs/changelog.yaml new file mode 100644 index 00000000..6f793a1c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/changelogs/changelog.yaml @@ -0,0 +1,456 @@ +ancestor: null +releases: + 0.1.0: + changes: + breaking_changes: + - Changed ``group`` to ``tenant_group`` in ``netbox_tenant.py`` (https://github.com/netbox-community/ansible_modules/issues/9) + - Changed ``role`` to ``prefix_role`` in ``netbox_prefix.py`` (https://github.com/netbox-community/ansible_modules/issues/9) + - Module failures when required fields arent provided (https://github.com/netbox-community/ansible_modules/issues/24) + - Renamed ``netbox_interface`` to ``netbox_device_interface`` (https://github.com/netbox-community/ansible_modules/issues/9) + minor_changes: + - Add ``primary_ip4/6`` to ``netbox_ip_address`` (https://github.com/netbox-community/ansible_modules/issues/10) + modules: + - description: Creates or removes aggregates from Netbox + name: netbox_aggregate + namespace: '' + - description: Create, update or delete circuits within Netbox + name: netbox_circuit + namespace: '' + - description: Create, update or delete circuit terminations within Netbox + name: netbox_circuit_termination + namespace: '' + - description: Create, update or delete circuit types within Netbox + name: netbox_circuit_type + namespace: '' + - description: Create, update or delete clusters within Netbox + name: netbox_cluster + namespace: '' + - description: Create, update or delete cluster groups within Netbox + name: netbox_cluster_group + namespace: '' + - description: Create, update or delete cluster types within Netbox + name: netbox_cluster_type + namespace: '' + - description: Create, update or delete device bays within Netbox + name: netbox_device_bay + namespace: '' + - description: Create, update or delete devices roles within Netbox + name: netbox_device_role + namespace: '' + - description: Create, update or delete device types within Netbox + name: netbox_device_type + namespace: '' + - description: Creates or removes inventory items from Netbox + name: netbox_inventory_item + namespace: '' + - description: Creates or removes ipam roles from Netbox + name: netbox_ipam_role + namespace: '' + - description: Create or delete manufacturers within Netbox + name: netbox_manufacturer + namespace: '' + - description: Create or delete platforms within Netbox + name: netbox_platform + namespace: '' + - description: Create, update or delete providers within Netbox + name: netbox_provider + namespace: '' + - description: Create, update or delete racks within Netbox + name: netbox_rack + namespace: '' + - description: Create, update or delete racks groups within Netbox + name: netbox_rack_group + namespace: '' + - description: Create, update or delete racks roles within Netbox + name: netbox_rack_role + namespace: '' + - description: Creates or removes regions from Netbox + name: netbox_region + namespace: '' + - description: Create, update or delete RIRs within Netbox + name: netbox_rir + namespace: '' + - description: Creates or removes tenants from Netbox + name: netbox_tenant + namespace: '' + - description: Creates or removes tenant groups from Netbox + name: netbox_tenant_group + namespace: '' + - description: Create, update or delete virtual_machines within Netbox + name: netbox_virtual_machine + namespace: '' + - description: Create, update or delete vlans within Netbox + name: netbox_vlan + namespace: '' + - description: Create, update or delete vlans groups within Netbox + name: netbox_vlan_group + namespace: '' + - description: Creates or removes interfaces from virtual machines in Netbox + name: netbox_vm_interface + namespace: '' + - description: Create, update or delete vrfs within Netbox + name: netbox_vrf + namespace: '' + 0.1.1: + changes: + bugfixes: + - Fixed issue with netbox_vm_interface where it would fail if different virtual + machine had the same interface name (https://github.com/netbox-community/ansible_modules/issues/40) + - Updated netbox_ip_address to find interfaces on virtual machines correctly + (https://github.com/netbox-community/ansible_modules/issues/40) + 0.1.10: + changes: + bugfixes: + - Updated inventory plugin name from netbox.netbox.netbox to netbox.netbox.nb_inventory + (https://github.com/netbox-community/ansible_modules/pull/129) + 0.1.2: + changes: + bugfixes: + - Allow endpoint choices to be an integer of the choice rather than attempting + to dynamically determine the choice ID (https://github.com/netbox-community/ansible_modules/issues/47) + 0.1.3: + changes: + bugfixes: + - Add error handling for invalid key_file for lookup plugin (https://github.com/netbox-community/ansible_modules/issues/52) + 0.1.5: + changes: + bugfixes: + - Add argument specs for every module to validate data passed in. Fixes some + idempotency issues. POSSIBLE BREAKING CHANGE (https://github.com/netbox-community/ansible_modules/issues/68) + - Allow name updates to manufacturers (https://github.com/netbox-community/ansible_modules/issues/76) + - Builds slug for netbox_device_type from model which is now required and slug + is optional. Model will be slugified if slug is not provided BREAKING CHANGE + (https://github.com/netbox-community/ansible_modules/issues/77) + - Fail module with proper exception when connection to Netbox API cannot be + established (https://github.com/netbox-community/ansible_modules/issues/80) + - netbox_device_interface Lag no longer has to be a dictionary and the value + of the key can be the name of the LAG (https://github.com/netbox-community/ansible_modules/issues/81) + - netbox_ip_address If no address has no CIDR notation, it will convert it into + a /32 and pass to Netbox. Fixes idempotency cidr notation is not provided + (https://github.com/netbox-community/ansible_modules/issues/78) + modules: + - description: Creates or removes service from Netbox + name: netbox_service + namespace: '' + 0.1.6: + changes: + bugfixes: + - Fixed vlan searching with vlan_group for netbox_prefix (https://github.com/netbox-community/ansible_modules/issues/85) + - Removed static choices from netbox_utils and now pulls the choices for each + endpoint from the Netbox API at call time (https://github.com/netbox-community/ansible_modules/issues/67) + minor_changes: + - Add dns_name to netbox_ip_address (https://github.com/netbox-community/ansible_modules/issues/84) + - Add region and region_id to query_filter for Netbox Inventory plugin (https://github.com/netbox-community/ansible_modules/issues/83) + 0.1.7: + changes: + bugfixes: + - Assigning to parent log now finds LAG interface type dynamically rather than + set statically in code (https://github.com/netbox-community/ansible_modules/issues/106) + - Create device with empty string to assign the device a UUID (https://github.com/netbox-community/ansible_modules/issues/107) + - If query_filters supplied are not allowed for either device or VM lookups, + or no valid query filters, it will not attempt to fetch from devices or VMs. + This should prevent devices or VMs from being fetched that do not meet the + query_filters specified. (https://github.com/netbox-community/ansible_modules/issues/63) + - Properly create interface on correct device when in a VC (https://github.com/netbox-community/ansible_modules/issues/105) + - Updated _to_slug to follow same constructs NetBox uses (https://github.com/netbox-community/ansible_modules/issues/95) + minor_changes: + - Added fetching services for devices in Netbox Inventory Plugin (https://github.com/netbox-community/ansible_modules/issues/58) + - Added option for interfaces and IP addresses of interfaces to be fetched via + inventory plugin (https://github.com/netbox-community/ansible_modules/issues/60) + - Change lookups to property for subclassing of inventory plugin (https://github.com/netbox-community/ansible_modules/issues/62) + 0.1.8: + changes: + bugfixes: + - If interface existed already, caused traceback and crashed playbook (https://github.com/netbox-community/ansible_modules/issues/114) + 0.1.9: + changes: + breaking_changes: + - 'This version has a few breaking changes due to new namespace and collection + name. I felt it necessary to change the name of the lookup plugin and inventory + plugin just not to have a non descriptive namespace call to use them. Below + is an example: + + ``netbox.netbox.netbox`` would be used for both inventory plugin and lookup + plugin, but in different contexts so no collision will arise, but confusion + will. + + I renamed the lookup plugin to ``nb_lookup`` so it will be used with the FQCN + ``netbox.netbox.nb_lookup``. + + The inventory plugin will now be called within an inventory file by ``netbox.netbox.nb_inventory`` + + ' + bugfixes: + - Update ``netbox_tenant`` and ``netbox_tenant_group`` to use slugs for searching + (available since NetBox 2.6). Added slug options to netbox_site, netbox_tenant, + netbox_tenant_group (https://github.com/netbox-community/ansible_modules/pull/120) + 0.2.0: + changes: + breaking_changes: + - Change ``ip-addresses`` key in netbox inventory plugin to ``ip_addresses`` + (https://github.com/netbox-community/ansible_modules/issues/139) + bugfixes: + - Allow integers to be passed in via Jinja string to properly convert back to + integer (https://github.com/netbox-community/ansible_modules/issues/45) + - Allow services to be created with a different protocol (https://github.com/netbox-community/ansible_modules/issues/174) + - Properly find LAG if defined just as a string rather than dictionary with + the relevant data (https://github.com/netbox-community/ansible_modules/issues/166) + - Removed choices within argument_spec for ``mode`` in ``netbox_device_interface`` + and ``netbox_vm_interface``. This allows the API to return any error if an + invalid choice is selected for ``mode`` (https://github.com/netbox-community/ansible_modules/issues/151) + - Updated rack width choices for latest NetBox version (https://github.com/netbox-community/ansible_modules/issues/167) + minor_changes: + - Add ``custom_fields`` to ``netbox_virtual_machine`` (https://github.com/netbox-community/ansible_modules/issues/170) + - Add ``device_query_filters`` and ``vm_query_filters`` to allow users to specify + query filters for the specific type (https://github.com/netbox-community/ansible_modules/issues/140) + - Added ``group_names_raw`` option to the netbox inventory to allow users have + the group names be the slug rather than prepending the group name with the + type (https://github.com/netbox-community/ansible_modules/issues/138) + - Added ``raw_output`` option to netbox lookup plugin to return the exact output + from the API with no doctoring (https://github.com/netbox-community/ansible_modules/pull/136) + - Added ``services`` option to the netbox inventory to allow users to toggle + whether services are included or not (https://github.com/netbox-community/ansible_modules/pull/143) + - Added ``update_vc_child`` option to netbox_device_interface to allow child + interfaces to be updated if device specified is the master device within the + virtual chassis (https://github.com/netbox-community/ansible_modules/issues/105) + - Remove token from being required for nb_inventory as some NetBox setups don't + require authorization for GET functions (https://github.com/netbox-community/ansible_modules/issues/177) + - Remove token from being required for nb_lookup as some NetBox setups don't + require authorization for GET functions (https://github.com/netbox-community/ansible_modules/issues/183) + 0.2.1: + changes: + bugfixes: + - Added ``type`` to ``netbox_device_interface`` and deprecation notice for ``form_factor`` + (https://github.com/netbox-community/ansible_modules/issues/193) + - Fixes inventory performance issues, properly shows virtual chassis masters. + (https://github.com/netbox-community/ansible_modules/pull/202) + minor_changes: + - Added 21" width to netbox_rack (https://github.com/netbox-community/ansible_modules/pull/190) + - Added cluster, cluster_type, and cluster_group to group_by option in inventory + plugin (https://github.com/netbox-community/ansible_modules/issues/188) + - Added option to change host_vars to singular rather than having single element + lists (https://github.com/netbox-community/ansible_modules/issues/141) + - Added option to flatten ``config_context`` and ``custom_fields`` (https://github.com/netbox-community/ansible_modules/issues/193) + 0.2.2: + changes: + bugfixes: + - Added ``interfaces`` to ``ALLOWED_QUERY_PARAMS`` for ip addresses searches + (https://github.com/netbox-community/ansible_modules/issues/201) + - Added ``type`` to ``ALLOWED_QUERY_PARAMS`` for interface searches (https://github.com/netbox-community/ansible_modules/issues/208) + - Remove ``rack`` as a choice when creating virtual machines (https://github.com/netbox-community/ansible_modules/pull/221) + minor_changes: + - Changed ``validate_certs`` to ``raw`` to allow private keys to be passed in + (https://github.com/netbox-community/ansible_modules/issues/211) + 0.2.3: + changes: + bugfixes: + - Fixes bug in ``netbox_prefix`` failing when using ``check_mode`` (https://github.com/netbox-community/ansible_modules/issues/228) + - Fixes bug in inventory plugin that fails if there are either no virtual machines, + but devices defined in NetBox or vice versa from failing when ``fetch_all`` + is set to ``False`` (https://github.com/netbox-community/ansible_modules/issues/214) + - Normalize any string values that are passed in via Jinja into an integer within + the `_normalize_data` method (https://github.com/netbox-community/ansible_modules/issues/231) + minor_changes: + - Adds ``discovered`` field to ``netbox_inventory_item`` (https://github.com/netbox-community/ansible_modules/issues/187) + - Adds ``query_params`` to all modules to allow users to define the ``query_params`` + (https://github.com/netbox-community/ansible_modules/issues/215) + - Adds ``tenant`` field to ``netbox_cluster`` (https://github.com/netbox-community/ansible_modules/pull/219) + - Allows private key to be passed in to ``validate_certs`` within modules (https://github.com/netbox-community/ansible_modules/issues/216) + - Better error handling if read-only token is provided for modules. Updated + README as well to say that a ``write-enabled`` token is required (https://github.com/netbox-community/ansible_modules/pull/238) + modules: + - description: Create, update or delete console ports within Netbox + name: netbox_console_port + namespace: '' + - description: Create, update or delete console port templates within Netbox + name: netbox_console_port_template + namespace: '' + - description: Create, update or delete console server ports within Netbox + name: netbox_console_server_port + namespace: '' + - description: Create, update or delete console server port templates within Netbox + name: netbox_console_server_port_template + namespace: '' + - description: Create, update or delete front ports within Netbox + name: netbox_front_port + namespace: '' + - description: Create, update or delete front port templates within Netbox + name: netbox_front_port_template + namespace: '' + - description: Create, update or delete power feeds within Netbox + name: netbox_power_feed + namespace: '' + - description: Create, update or delete power outlets within Netbox + name: netbox_power_outlet + namespace: '' + - description: Create, update or delete power outlet templates within Netbox + name: netbox_power_outlet_template + namespace: '' + - description: Create, update or delete power panels within Netbox + name: netbox_power_panel + namespace: '' + - description: Create, update or delete power ports within Netbox + name: netbox_power_port + namespace: '' + - description: Create, update or delete power port templates within Netbox + name: netbox_power_port_template + namespace: '' + - description: Create, update or delete rear ports within Netbox + name: netbox_rear_port + namespace: '' + - description: Create, update or delete rear port templates within Netbox + name: netbox_rear_port_template + namespace: '' + 0.3.0: + changes: + breaking_changes: + - "To pass in integers via Ansible Jinja filters for a key in ``data`` that\n\ + requires querying an endpoint is now done by making it a dictionary with\n\ + an ``id`` key. The previous behavior was to just pass in an integer and\n\ + it was converted when normalizing the data, but some people may have names\n\ + that are all integers and those were being converted erroneously so we made\n\ + the decision to change the method to convert to an integer for the NetBox\n\ + API.\n\n::\n\n tasks:\n - name: Create device within NetBox with only\ + \ required information\n netbox_device:\n netbox_url: http://netbox-demo.org:32768\n\ + \ netbox_token: 0123456789abcdef0123456789abcdef01234567\n data:\n\ + \ name: Test66\n device_type:\n id: \"{{ some_jinja_variable\ + \ }}\"\n device_role: Core Switch\n site: Test Site\n \ + \ status: Staged\n state: present\n" + - '``pynetbox`` changed to using ``requests.Session()`` to manage the HTTP session + + which broke passing in ``ssl_verify`` when building the NetBox API client. + + This PR makes ``pynetbox 5.0.4+`` the new required version of `pynetbox` for + + the Ansible modules and lookup plugin. (https://github.com/netbox-community/ansible_modules/pull/269) + + ' + bugfixes: + - Allows OR operations in API fitlers for ``nb_lookup`` plugin (https://github.com/netbox-community/ansible_modules/issues/246) + - Build the ``rear_port`` and ``rear_port_template`` query_params to properly + find rear port (https://github.com/netbox-community/ansible_modules/issues/262) + - Compares tags as a set to prevent issues with order difference between user + supplied tags and NetBox API (https://github.com/netbox-community/ansible_modules/issues/242) + - Fixes typo for ``CONVERT_TO_ID`` mapping in ``netbox_utils`` for ``dcim.powerport`` + and ``dcim.poweroutlet`` (https://github.com/netbox-community/ansible_modules/pull/265) + - Fixes typo for ``CONVERT_TO_ID`` mapping in ``netbox_utils`` for ``dcim.rearport`` + (https://github.com/netbox-community/ansible_modules/pull/261) + - Normalize ``mac_address`` to upper case (https://github.com/netbox-community/ansible_modules/issues/254) + - Normalize descriptions to remove any extra whitespace (https://github.com/netbox-community/ansible_modules/issues/243) + minor_changes: + - Add ``local_context_data`` and ``flatten_local_context_data`` option to ``nb_inventory`` + (https://github.com/netbox-community/ansible_modules/pull/258) + - Add ``local_context_data`` option to ``netbox_device`` (https://github.com/netbox-community/ansible_modules/pull/258) + - Add ``virtual_chassis``, ``vc_position``, ``vc_priority`` to ``netbox_device`` + options (https://github.com/netbox-community/ansible_modules/pull/251) + modules: + - description: Create, update or delete cables within Netbox + name: netbox_cable + namespace: '' + - description: Create, update or delete device bay templates within Netbox + name: netbox_device_bay_template + namespace: '' + - description: Creates or removes interfaces on devices from Netbox + name: netbox_device_interface_template + namespace: '' + - description: Create, update or delete virtual chassis within Netbox + name: netbox_virtual_chassis + namespace: '' + 0.3.1: + changes: + bugfixes: + - Default ``validate_certs`` to ``True`` (https://github.com/netbox-community/ansible_modules/issues/273) + 1.0.0: + changes: + bugfixes: + - Fix query_dict for device_bay/interface_template to use ``devicetype_id`` + (https://github.com/netbox-community/ansible_modules/issues/282) + - This expands the fix to all `_template` modules to use `devicetype_id` for + the query_dict when attempting to resolve the search (https://github.com/netbox-community/ansible_modules/pull/300) + 1.0.1: + changes: + bugfixes: + - Fix ``nb_inventory`` cache for ip addresses (https://github.com/netbox-community/ansible_modules/issues/276) + - Return HTTPError body output when encountering HTTP errors (https://github.com/netbox-community/ansible_modules/issues/294) + minor_changes: + - Inventory - Add group_by option ``rack_role`` and ``rack_group`` + - Inventory - Add group_by option ``services`` (https://github.com/netbox-community/ansible_modules/pull/286) + 1.0.2: + changes: + bugfixes: + - Add ``virtual_machine_role=slug`` to ``QUERY_TYPES`` to properly search for + Virtual Machine roles and not use the default ``q`` search (https://github.com/netbox-community/ansible_modules/pull/327) + - Remove ``device`` being ``required`` and implemented ``required_one_of`` to + allow either ``device`` or ``virtual_machine`` to be specified for ``netbox_service`` + (https://github.com/netbox-community/ansible_modules/pull/326) + - When tags specified, it prevents other data from being updated on the object. + (https://github.com/netbox-community/ansible_modules/pull/325) + fragments: + - fix_service.yml + - fix_tags.yml + - fix_vm_role.yml + release_date: '2020-08-29' + 1.1.0: + changes: + bugfixes: + - Prevent inventory plugin from failing on 403 and print warning message (https://github.com/netbox-community/ansible_modules/pull/354) + - Update ``netbox_ip_address`` module to accept ``assigned_object`` to work + with NetBox 2.9 (https://github.com/netbox-community/ansible_modules/pull/345) + - Update inventory plugin to properly associate IP address to interfaces with + NetBox 2.9 (https://github.com/netbox-community/ansible_modules/pull/334) + - Update inventory plugin to work with tags with NetBox 2.9 (https://github.com/netbox-community/ansible_modules/pull/340) + - Update modules to be able to properly update tags to work with NetBox 2.9 + (https://github.com/netbox-community/ansible_modules/pull/345) + minor_changes: + - Add ``follow_redirects`` option to inventory plugin (https://github.com/netbox-community/ansible_modules/pull/323) + fragments: + - release-1.1.0.yml + release_date: '2020-10-06' + 1.2.0: + changes: + bugfixes: + - Version checks were failing due to converting "2.10" to a float made it an + integer of 2.1 which broke version related logic. (#396) + - netbox_device_interface - Fixed copy pasta in documentation. (#371) + - netbox_ip_address - Updated documentation to show that ``family`` option has + been deprecated. (#388) + - netbox_utils - Fixed typo for ``circuits.circuittermination`` searches. (#367) + - netbox_utils - Skip all modifications to ``query_params`` when ``user_query_params`` + is defined. (#389) + - netbox_vlan - Fixed uniqueness for vlan searches to add ``group``. (#386) + major_changes: + - nb_inventory - Add ``dns_name`` option that adds ``dns_name`` to the host + when ``True`` and device has a primary IP address. (#394) + - nb_inventory - Add ``status`` as a ``group_by`` option. (398) + - nb_inventory - Move around ``extracted_primary_ip`` to allow for ``config_context`` + or ``custom_field`` to overwite. (#377) + - nb_inventory - Services are now a list of integers due to NetBox 2.10 changes. + (#396) + - nb_lookup - Allow ID to be passed in and use ``.get`` instead of ``.filter``. + (#376) + - nb_lookup - Allow ``api_endpoint`` and ``token`` to be found via env. (#391) + minor_changes: + - nb_inventory - Added ``status`` as host_var. (359) + - nb_inventory - Added documentation for using ``keyed_groups``. (#361) + - nb_inventory - Allow to use virtual chassis name instead of device name. (#383) + - nb_lookup - Allow lookup of plugin endpoints. (#360) + - nb_lookup - Documentation update to show Fully Qualified Collection Name (FQCN). + (#355) + - netbox_service - Add ``ports`` option for NetBox 2.10+ and convert ``port`` + to ``ports`` if NetBox 2.9 or lower. (#396) + - netbox_virtual_machine - Added ``comments`` option. (#380) + - netbox_virtual_machine - Added ``local_context_data`` option. (#357) + fragments: + - release1.2.0.yml + modules: + - description: Creates or removes tags from Netbox + name: netbox_tag + namespace: '' + release_date: '2020-12-27' + 1.2.1: + changes: + bugfixes: + - Allow IDs to be passed into objects that accept a list (https://github.com/netbox-community/ansible_modules/issues/407) + fragments: + - tags.yml + release_date: '2021-01-10' diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/changelogs/config.yaml b/collections-debian-merged/ansible_collections/netbox/netbox/changelogs/config.yaml new file mode 100644 index 00000000..90d6f2d9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/changelogs/config.yaml @@ -0,0 +1,31 @@ +changelog_filename_template: ../CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +ignore_other_fragment_extensions: true +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +sections: + - - major_changes + - Major Changes + - - minor_changes + - Minor Changes + - - breaking_changes + - Breaking Changes / Porting Guide + - - deprecated_features + - Deprecated Features + - - removed_features + - Removed Features (previously deprecated) + - - security_fixes + - Security Fixes + - - bugfixes + - Bugfixes + - - known_issues + - Known Issues +title: Netbox.Netbox +trivial_section_name: trivial +use_fqcn: true diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/changelogs/fragments/.gitkeep b/collections-debian-merged/ansible_collections/netbox/netbox/changelogs/fragments/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/changelogs/fragments/.gitkeep diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/Makefile b/collections-debian-merged/ansible_collections/netbox/netbox/docs/Makefile new file mode 100644 index 00000000..d4bb2cbb --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/_extensions/pygments_lexer.py b/collections-debian-merged/ansible_collections/netbox/netbox/docs/_extensions/pygments_lexer.py new file mode 100644 index 00000000..d5990993 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/_extensions/pygments_lexer.py @@ -0,0 +1,230 @@ +# -*- coding: utf-8 -*- +# pylint: disable=no-self-argument +# +# Copyright 2006-2017 by the Pygments team, see AUTHORS at +# https://bitbucket.org/birkenfeld/pygments-main/raw/7941677dc77d4f2bf0bbd6140ade85a9454b8b80/AUTHORS +# Copyright by Norman Richards (original author of JSON lexer). +# +# Licensed under BSD license: +# +# Copyright (c) 2006-2017 by the respective authors (see AUTHORS file). +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from pygments.lexer import ( + LexerContext, + ExtendedRegexLexer, + DelegatingLexer, + RegexLexer, + bygroups, + include, +) +from pygments.lexers import DiffLexer +from pygments import token + +import re + + +class AnsibleOutputPrimaryLexer(RegexLexer): + name = "Ansible-output-primary" + + # The following definitions are borrowed from Pygment's JSON lexer. + # It has been originally authored by Norman Richards. + + # integer part of a number + int_part = r"-?(0|[1-9]\d*)" + + # fractional part of a number + frac_part = r"\.\d+" + + # exponential part of a number + exp_part = r"[eE](\+|-)?\d+" + + tokens = { + # ######################################### + # # BEGIN: states from JSON lexer ######### + # ######################################### + "whitespace": [(r"\s+", token.Text),], + # represents a simple terminal value + "simplevalue": [ + (r"(true|false|null)\b", token.Keyword.Constant), + ( + ( + "%(int_part)s(%(frac_part)s%(exp_part)s|" + "%(exp_part)s|%(frac_part)s)" + ) + % vars(), + token.Number.Float, + ), + (int_part, token.Number.Integer), + (r'"(\\\\|\\"|[^"])*"', token.String), + ], + # the right hand side of an object, after the attribute name + "objectattribute": [ + include("value"), + (r":", token.Punctuation), + # comma terminates the attribute but expects more + (r",", token.Punctuation, "#pop"), + # a closing bracket terminates the entire object, so pop twice + (r"\}", token.Punctuation, "#pop:2"), + ], + # a json object - { attr, attr, ... } + "objectvalue": [ + include("whitespace"), + (r'"(\\\\|\\"|[^"])*"', token.Name.Tag, "objectattribute"), + (r"\}", token.Punctuation, "#pop"), + ], + # json array - [ value, value, ... } + "arrayvalue": [ + include("whitespace"), + include("value"), + (r",", token.Punctuation), + (r"\]", token.Punctuation, "#pop"), + ], + # a json value - either a simple value or a complex value (object or array) + "value": [ + include("whitespace"), + include("simplevalue"), + (r"\{", token.Punctuation, "objectvalue"), + (r"\[", token.Punctuation, "arrayvalue"), + ], + # ######################################### + # # END: states from JSON lexer ########### + # ######################################### + "host-postfix": [ + (r"\n", token.Text, "#pop:3"), + ( + r"( )(=>)( )(\{)", + bygroups(token.Text, token.Punctuation, token.Text, token.Punctuation), + "objectvalue", + ), + ], + "host-error": [ + ( + r"(?:(:)( )(UNREACHABLE|FAILED)(!))?", + bygroups( + token.Punctuation, token.Text, token.Keyword, token.Punctuation + ), + "host-postfix", + ), + (r"", token.Text, "host-postfix"), + ], + "host-name": [ + ( + r"(\[)([^ \]]+)(?:( )(=>)( )([^\]]+))?(\])", + bygroups( + token.Punctuation, + token.Name.Variable, + token.Text, + token.Punctuation, + token.Text, + token.Name.Variable, + token.Punctuation, + ), + "host-error", + ) + ], + "host-result": [ + (r"\n", token.Text, "#pop"), + ( + r"( +)(ok|changed|failed|skipped|unreachable)(=)([0-9]+)", + bygroups( + token.Text, token.Keyword, token.Punctuation, token.Number.Integer + ), + ), + ], + "root": [ + ( + r"(PLAY|TASK|PLAY RECAP)(?:( )(\[)([^\]]+)(\]))?( )(\*+)(\n)", + bygroups( + token.Keyword, + token.Text, + token.Punctuation, + token.Literal, + token.Punctuation, + token.Text, + token.Name.Variable, + token.Text, + ), + ), + ( + r"(fatal|ok|changed|skipping)(:)( )", + bygroups(token.Keyword, token.Punctuation, token.Text), + "host-name", + ), + ( + r"(\[)(WARNING)(\]:)([^\n]+)", + bygroups( + token.Punctuation, token.Keyword, token.Punctuation, token.Text + ), + ), + ( + r"([^ ]+)( +)(:)", + bygroups(token.Name, token.Text, token.Punctuation), + "host-result", + ), + ( + r"(\tto retry, use: )(.*)(\n)", + bygroups(token.Text, token.Literal.String, token.Text), + ), + (r".*\n", token.Other), + ], + } + + +class AnsibleOutputLexer(DelegatingLexer): + name = "Ansible-output" + aliases = ["ansible-output"] + + def __init__(self, **options): + super(AnsibleOutputLexer, self).__init__( + DiffLexer, AnsibleOutputPrimaryLexer, **options + ) + + +# #################################################################################################### +# # Sphinx plugin #################################################################################### +# #################################################################################################### + +__version__ = "0.1.0" +__license__ = "BSD license" +__author__ = "Felix Fontein" +__author_email__ = "felix@fontein.de" + + +def setup(app): + """Initializer for Sphinx extension API. + See http://www.sphinx-doc.org/en/stable/extdev/index.html#dev-extensions. + """ + for lexer in [AnsibleOutputLexer(startinline=True)]: + app.add_lexer(lexer.name, lexer) + for alias in lexer.aliases: + app.add_lexer(alias, lexer) + + return dict(version=__version__, parallel_read_safe=True) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/_static/ansible.css b/collections-debian-merged/ansible_collections/netbox/netbox/docs/_static/ansible.css new file mode 100644 index 00000000..98973465 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/_static/ansible.css @@ -0,0 +1,59 @@ +/*! minified with http://css-minify.online-domain-tools.com/ - all comments + * must have ! to preserve during minifying with that tool *//*! Fix for read the docs theme: + * https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html + *//*! override table width restrictions */@media screen and (min-width:767px){/*! If we ever publish to read the docs, we need to use !important for these + * two styles as read the docs itself loads their theme in a way that we + * can't otherwise override it. + */.wy-table-responsive table td{white-space:normal}.wy-table-responsive{overflow:visible}}/*! + * We use the class documentation-table for attribute tables where the first + * column is the name of an attribute and the second column is the description. + *//*! These tables look like this: + * + * Attribute Name Description + * -------------- ----------- + * **NAME** This is a multi-line description + * str/required that can span multiple lines + * added in x.y + * With multiple paragraphs + * -------------- ----------- + * + * **NAME** is given the class .value-name + * str is given the class .value-type + * / is given the class .value-separator + * required is given the class .value-required + * added in x.y is given the class .value-added-in + *//*! The extra .rst-content is so this will override rtd theme */.rst-content table.documentation-table td{vertical-align:top}table.documentation-table td:first-child{white-space:nowrap;vertical-align:top}table.documentation-table td:first-child p:first-child{font-weight:700;display:inline}/*! This is now redundant with above position-based styling *//*! +table.documentation-table .value-name { + font-weight: bold; + display: inline; +} +*/table.documentation-table .value-type{font-size:x-small;color:purple;display:inline}table.documentation-table .value-separator{font-size:x-small;display:inline}table.documentation-table .value-required{font-size:x-small;color:red;display:inline}.value-added-in{font-size:x-small;font-style:italic;color:green;display:inline}/*! Ansible-specific CSS pulled out of rtd theme for 2.9 */.DocSiteProduct-header{flex:1;-webkit-flex:1;padding:10px 20px 20px;display:flex;display:-webkit-flex;flex-direction:column;-webkit-flex-direction:column;align-items:center;-webkit-align-items:center;justify-content:flex-start;-webkit-justify-content:flex-start;margin-left:20px;margin-right:20px;text-decoration:none;font-weight:400;font-family:'Open Sans',sans-serif}.DocSiteProduct-header:active,.DocSiteProduct-header:focus,.DocSiteProduct-header:visited{color:#fff}.DocSiteProduct-header--core{font-size:25px;background-color:#5bbdbf;border:2px solid #5bbdbf;border-top-left-radius:4px;border-top-right-radius:4px;color:#fff;padding-left:2px;margin-left:2px}.DocSiteProduct-headerAlign{width:100%}.DocSiteProduct-logo{width:60px;height:60px;margin-bottom:-9px}.DocSiteProduct-logoText{margin-top:6px;font-size:25px;text-align:left}.DocSiteProduct-CheckVersionPara{margin-left:2px;padding-bottom:4px;margin-right:2px;margin-bottom:10px}/*! Ansible color scheme *//*.wy-nav-top,.wy-side-nav-search{background-color:#5bbdbf}.wy-menu-vertical header,.wy-menu-vertical p.caption{color:#5bbdbf}.wy-menu-vertical a{padding:0}.wy-menu-vertical a.reference.internal{padding:.4045em 1.618em}*//*! Override sphinx rtd theme max-with of 800px */.wy-nav-content{max-width:100%}/*! Override sphinx_rtd_theme - keeps left-nav from overwriting Documentation title *//*.wy-nav-side{top:45px}*//*! Ansible - changed absolute to relative to remove extraneous side scroll bar */.wy-grid-for-nav{position:relative}/*! Ansible narrow the search box */.wy-side-nav-search input[type=text]{width:90%;padding-left:24px}/*! Ansible - remove so highlight indenting is correct */.rst-content .highlighted{padding:0}.DocSiteBanner{display:flex;display:-webkit-flex;justify-content:center;-webkit-justify-content:center;flex-wrap:wrap;-webkit-flex-wrap:wrap;margin-bottom:25px}.DocSiteBanner-imgWrapper{max-width:100%}td,th{min-width:100px}table{overflow-x:auto;display:block;max-width:100%}.documentation-table td.elbow-placeholder{border-left:1px solid #000;border-top:0;width:30px;min-width:30px}.documentation-table td,.documentation-table th{padding:4px;border-left:1px solid #000;border-top:1px solid #000}.documentation-table{border-right:1px solid #000;border-bottom:1px solid #000}@media print{*{background:0 0!important;color:#000!important;text-shadow:none!important;filter:none!important;-ms-filter:none!important}#nav,a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}/*! Don't show links for images, or javascript/internal links */pre,blockquote{border:0 solid #999;page-break-inside:avoid}thead{display:table-header-group}/*! h5bp.com/t */tr,img{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}#google_image_div,.DocSiteBanner{display:none!important}}#sideBanner,.DocSite-globalNav{display:none}.DocSite-sideNav{display:block;margin-bottom:40px}.DocSite-nav{display:none}.ansibleNav{background:#000;padding:0 20px;width:auto;border-bottom:1px solid #444;font-size:14px;z-index:1}.ansibleNav ul{list-style:none;padding-left:0;margin-top:0}.ansibleNav ul li{padding:7px 0;border-bottom:1px solid #444}.ansibleNav ul li:last-child{border:none}.ansibleNav ul li a{color:#fff;text-decoration:none;text-transform:uppercase;padding:6px 0}.ansibleNav ul li a:hover{color:#5bbdbf;background:0 0}h4{font-size:105%}h5{font-size:90%}h6{font-size:80%}@media screen and (min-width:768px){.DocSite-globalNav{display:block;position:fixed}#sideBanner{display:block}.DocSite-sideNav{display:none}.DocSite-nav{flex:initial;-webkit-flex:initial;display:flex;display:-webkit-flex;flex-direction:row;-webkit-flex-direction:row;justify-content:flex-start;-webkit-justify-content:flex-start;padding:15px;background-color:#000;text-decoration:none;font-family:'Open Sans',sans-serif}.DocSiteNav-logo{width:28px;height:28px;margin-right:8px;margin-top:-6px;position:fixed;z-index:1}.DocSiteNav-title{color:#fff;font-size:20px;position:fixed;margin-left:40px;margin-top:-4px;z-index:1}.ansibleNav{height:45px;width:100%;font-size:13px;padding:0 60px 0 0}.ansibleNav ul{float:right;display:flex;flex-wrap:nowrap;margin-top:13px}.ansibleNav ul li{padding:0;border-bottom:none}.ansibleNav ul li a{color:#fff;text-decoration:none;text-transform:uppercase;padding:8px 13px}h4{font-size:105%}h5{font-size:90%}h6{font-size:80%}}@media screen and (min-width:768px){#sideBanner,.DocSite-globalNav{display:block}.DocSite-sideNav{display:none}.DocSite-nav{flex:initial;-webkit-flex:initial;display:flex;display:-webkit-flex;flex-direction:row;-webkit-flex-direction:row;justify-content:flex-start;-webkit-justify-content:flex-start;padding:15px;background-color:#000;text-decoration:none;font-family:'Open Sans',sans-serif}.DocSiteNav-logo{width:28px;height:28px;margin-right:8px;margin-top:-6px;position:fixed}.DocSiteNav-title{color:#fff;font-size:20px;position:fixed;margin-left:40px;margin-top:-4px}.ansibleNav{height:45px;font-size:13px;padding:0 60px 0 0}.ansibleNav ul{float:right;display:flex;flex-wrap:nowrap;margin-top:13px}.ansibleNav ul li{padding:0;border-bottom:none}.ansibleNav ul li a{color:#fff;text-decoration:none;text-transform:uppercase;padding:8px 13px}h4{font-size:105%}h5{font-size:90%}h6{font-size:80%}} +/* ansibleOptionLink is adapted from h1 .headerlink in sphinx_rtd_theme */ +tr:hover .ansibleOptionLink::after { + visibility: visible; +} +tr .ansibleOptionLink::after { + content: ""; + font-family: FontAwesome; +} +tr .ansibleOptionLink { + visibility: hidden; + display: inline-block; + font: normal normal normal 14px/1 FontAwesome; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +@media screen and (min-width:767px){ + /* Move anchors a bit up so that they aren't hidden by the header bar */ + section [id] { + padding-top: 45px; + margin-top: -45px; + } + /* Without this, for example most links in the page's TOC aren't usable anymore */ + section a[id] { + padding-top: 0; + margin-top: 0; + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/_static/pygments.css b/collections-debian-merged/ansible_collections/netbox/netbox/docs/_static/pygments.css new file mode 100644 index 00000000..ac1f0dd7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/_static/pygments.css @@ -0,0 +1,76 @@ +.highlight { background: #f8f8f8 } +.highlight .hll { background-color: #ffffcc; border: 1px solid #edff00; padding-top: 2px; border-radius: 3px; display: block } +.highlight .c { color: #6a737d; font-style: italic } /* Comment */ +.highlight .err { color: #a61717; background-color: #e3d2d2; color: #a61717; border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #007020; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666; font-weight: bold } /* Operator */ +.highlight .ch { color: #6a737d; font-style: italic } /* Comment.Hashbang */ +.highlight .cm { color: #6a737d; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #007020 } /* Comment.Preproc */ +.highlight .cpf { color: #6a737d; font-style: italic } /* Comment.PreprocFile */ +.highlight .c1 { color: #6a737d; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #999999; font-weight: bold; font-style: italic; background-color: #fff0f0 } /* Comment.Special */ +.highlight .gd { color: #A00000; background-color: #ffdddd } /* Generic.Deleted */ +.highlight .gd .x { color: #A00000; background-color: #ffaaaa } +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #aa0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000; background-color: #ddffdd } /* Generic.Inserted */ +.highlight .gi .x { color: #00A000; background-color: #aaffaa; } +.highlight .go { color: #333333 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0040D0 } /* Generic.Traceback */ +.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #007020 } /* Keyword.Pseudo */ +.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #902000 } /* Keyword.Type */ +.highlight .l { color: #032f62 } /* Literal */ +.highlight .m { color: #208050 } /* Literal.Number */ +.highlight .s { color: #4070a0 } /* Literal.String */ +.highlight .n { color: #333333 } +.highlight .p { font-weight: bold } +.highlight .na { color: teal } /* Name.Attribute */ +.highlight .nb { color: #0086b3 } /* Name.Builtin */ +.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */ +.highlight .no { color: teal; } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: purple; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */ +.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #555555; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #22863a } /* Name.Tag */ +.highlight .nv { color: #9960b5; font-weight: bold } /* Name.Variable */ +.highlight .p { color: font-weight: bold } /* Indicator */ +.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #009999 } /* Literal.Number.Bin */ +.highlight .mf { color: #009999 } /* Literal.Number.Float */ +.highlight .mh { color: #009999 } /* Literal.Number.Hex */ +.highlight .mi { color: #009999 } /* Literal.Number.Integer */ +.highlight .mo { color: #009999 } /* Literal.Number.Oct */ +.highlight .sa { color: #dd1144 } /* Literal.String.Affix */ +.highlight .sb { color: #dd1144 } /* Literal.String.Backtick */ +.highlight .sc { color: #dd1144 } /* Literal.String.Char */ +.highlight .dl { color: #dd1144 } /* Literal.String.Delimiter */ +.highlight .sd { color: #dd1144; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #dd1144 } /* Literal.String.Double */ +.highlight .se { color: #dd1144; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #dd1144 } /* Literal.String.Heredoc */ +.highlight .si { color: #dd1144; font-style: italic } /* Literal.String.Interpol */ +.highlight .sx { color: #dd1144 } /* Literal.String.Other */ +.highlight .sr { color: #009926 } /* Literal.String.Regex */ +.highlight .s1 { color: #dd1144 } /* Literal.String.Single */ +.highlight .ss { color: #990073 } /* Literal.String.Symbol */ +.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #06287e } /* Name.Function.Magic */ +.highlight .vc { color: teal } /* Name.Variable.Class */ +.highlight .vg { color: teal } /* Name.Variable.Global */ +.highlight .vi { color: teal } /* Name.Variable.Instance */ +.highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ +.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ +.highlight .gc { color: #909090; background-color: #eaf2f5 }
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/changelog/changelog_include.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/changelog/changelog_include.rst new file mode 100644 index 00000000..09929fe4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/changelog/changelog_include.rst @@ -0,0 +1 @@ +.. include:: ../../CHANGELOG.rst diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/changelog/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/changelog/index.rst new file mode 100644 index 00000000..56628249 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/changelog/index.rst @@ -0,0 +1,5 @@ + +.. toctree:: + :maxdepth: 4 + + changelog_include
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/conf.py b/collections-debian-merged/ansible_collections/netbox/netbox/docs/conf.py new file mode 100644 index 00000000..98b9c5f6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/conf.py @@ -0,0 +1,142 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +import re +import stat +from pathlib import Path +from antsibull.cli.antsibull_docs import run + +sys.path.insert(0, os.path.abspath("../")) + + +# -- Project information ----------------------------------------------------- + +project = "ansible_modules" +copyright = "2020, Mikhail Yohman" +author = "Mikhail Yohman <@FragmentedPacket>" + +# The full version, including alpha/beta/rc tags +release = "1.1.0" + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx.ext.autosectionlabel", +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "sphinx_rtd_theme" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] +html_css_files = ["ansible.css", "pygments.css"] +# html_theme_path = ["_themes"] + +# Settings for extensions +autodoc_default_options = { + "members": True, + "private-members": True, + "special-members": "__init__", + "undoc-members": True, + "exclude-members": "__weakref__", +} +autodoc_mock_imports = ["ansible_collections"] + + +def create_antsibull_docs(files, plugin_type=None): + """Creates the necessary docs for all files in a directory + + Args: + files ([Path.Glob]): Glob of files from a specific directory. + plugin_type ([str], optional): Create the proper documentation for the plugin type. Defaults to None. + """ + for f in files: + file_name = re.search(r"(?:.+\/)(\S+)\.py", str(f)).group(1) + if file_name == "netbox_interface": + continue + + if plugin_type is not None: + args_string = f"junk plugin --dest-dir plugins/{plugin_type}/{file_name}/ --plugin-type {plugin_type} netbox.netbox.{file_name}" + else: + args_string = f"junk plugin --dest-dir plugins/modules/{file_name}/ --plugin-type module netbox.netbox.{file_name}" + args = args_string.split(" ") + try: + run(args) + except: + print(args) + sys.exit(1) + + +def remove_write_permissions(path): + """Remove write permissions from group and others for the sake of antsibull-docs working. + + Args: + path (Path): Path object. + """ + for d in path.iterdir(): + d.chmod(stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH) + + +def build_ansible_docs(app): + """ + This will perform all necessary actions to use antsibull-docs to generate collection docs + """ + if os.environ.get("READTHEDOCS") != "True": + inventory_path = Path("../plugins/inventory/") + lookup_path = Path("../plugins/lookup/") + modules_path = Path("../plugins/modules/") + + # Set permissions on folders within docs/plugins to remove w from g+o + doc_modules = Path("plugins/modules/") + doc_lookup = Path("plugins/lookup/") + doc_inventory = Path("plugins/inventory/") + remove_write_permissions(doc_modules) + remove_write_permissions(doc_lookup) + remove_write_permissions(doc_inventory) + + inventory = inventory_path.glob("[!_]*.py") + lookup = lookup_path.glob("[!_]*.py") + modules = modules_path.glob("[!_]*.py") + + create_antsibull_docs(inventory, "inventory") + create_antsibull_docs(lookup, "lookup") + create_antsibull_docs(modules) + + +def setup(app): + app.connect("builder-inited", build_ansible_docs) + + +build_ansible_docs(None) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use.rst new file mode 100644 index 00000000..39cfa885 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use.rst @@ -0,0 +1,10 @@ +========================================= +Using Ansible Collections +========================================= + +.. toctree:: + :maxdepth: 4 + + Modules <how-to-use/modules> + Inventory <how-to-use/inventory> + Advanced Usage - Modules <how-to-use/advanced>
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/advanced.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/advanced.rst new file mode 100644 index 00000000..e8e131c5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/advanced.rst @@ -0,0 +1,301 @@ +============================== +Advanced Usage - Modules +============================== + +Now that we've gotten the basics out of the way. We can dive into a few more of the advanced uses within this collection. + +Passing in Dictionaries +------------------------------- + +There will be times that you need to specify more information to resolve the ID of an object tied to the main object due to the information not being unique enough to find a single object within NetBox. +A good example of this is specifying ``nat_inside`` when using the :ref:`netbox.netbox.netbox_ip_address<ansible_collections.netbox.netbox.netbox_ip_address_module>` module. + +If your NetBox instance is using the default settings then ``ENFORCE_GLOBAL_UNIQUE`` will be set to ``False`` which means that the chances of having a duplicate IP is high and most likely intended. + +Let's take a look at specifying just the IP address in CIDR notation and see what results we get. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Add ip address to netbox" + netbox.netbox.netbox_ip_address: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + address: "192.168.10.60/24" + vrf: "Test VRF" + nat_inside: "192.168.100.1/24" + state: present + +.. code-block:: bash + + ❯ ansible-playbook netbox-ip.yml -v + No config file found; using defaults + [WARNING]: No inventory was parsed, only implicit localhost is available + [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' + + PLAY [localhost] ********************************************************************************************************************** + + TASK [Add ip address to netbox] ******************************************************************************************************* + fatal: [localhost]: FAILED! => {"changed": false, "msg": "More than one result returned for nat_inside"} + +We can see from the error we get that we have more than a single result when attempting to resolve ``192.168.100.1/24``. +Let's check NetBox to see what additional information we can provide to grab the correct IP address. + +.. image:: ./media/advanced_dict.png + :scale: 50 % + +We can see one of the IPs is assigned to the VRF that matches the VRF our new IP should be part of as well. Let's go ahead and build out the dictionary for ``nat_inside``. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Add ip address to netbox" + netbox.netbox.netbox_ip_address: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + address: "192.168.10.60/24" + vrf: "Test VRF" + nat_inside: + address: "192.168.100.1/24" + vrf: "Test VRF" + state: present + +Since ``nat_inside`` is an IP address, we will specify the same arguments that we would use to search for the IP address in the API. Let's run the playbook now. + +.. code-block:: bash + + ❯ ansible-playbook netbox-ip.yml -v + No config file found; using defaults + [WARNING]: No inventory was parsed, only implicit localhost is available + [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' + + PLAY [localhost] ********************************************************************************************************************** + + TASK [Add ip address to netbox] ******************************************************************************************************* + changed: [localhost] => {"changed": true, "ip_address": {"address": "192.168.10.60/24", "assigned_object": null, "assigned_object_id": null, "assigned_object_type": null, "created": "2021-01-01", "custom_fields": {}, "description": "", "dns_name": "", "family": 4, "id": 11, "last_updated": "2021-01-01T17:19:18.999051Z", "nat_inside": 10, "nat_outside": null, "role": null, "status": "active", "tags": [], "tenant": null, "url": "http://192.168.50.10:8000/api/ipam/ip-addresses/11/", "vrf": 1}, "msg": "ip_address 192.168.10.60/24 created"} + + PLAY RECAP **************************************************************************************************************************** + localhost : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 + +We can see that the task was successful and ``nat_inside`` resolved to ID ``10``. + +Hopefully this helps you understand how you can provide more specific information for objects that need to be resolved before any ``POST/PUT/PATCH`` calls are made to NetBox. + +Passing in IDs Manually +------------------------------- + +Passing in an ID requires you to know the ID of the object. This probably isn't the most sensible way, but it's definitely possible and may suit certain situations. + +Let's take the same example and delete the IP address that was just created and then substitute the dictionary for ``nat_inside`` with ``10``. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Add ip address to netbox" + netbox.netbox.netbox_ip_address: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + address: "192.168.10.60/24" + vrf: "Test VRF" + nat_inside: 10 + state: present + +Here are the results and they're identical to the when we specified a dictionary. + +.. code-block:: bash + + ❯ ansible-playbook netbox-ip.yml -v + No config file found; using defaults + [WARNING]: No inventory was parsed, only implicit localhost is available + [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' + + PLAY [localhost] ********************************************************************************************************************** + + TASK [Add ip address to netbox] ******************************************************************************************************* + changed: [localhost] => {"changed": true, "ip_address": {"address": "192.168.10.60/24", "assigned_object": null, "assigned_object_id": null, "assigned_object_type": null, "created": "2021-01-01", "custom_fields": {}, "description": "", "dns_name": "", "family": 4, "id": 12, "last_updated": "2021-01-01T17:28:29.770142Z", "nat_inside": 10, "nat_outside": null, "role": null, "status": "active", "tags": [], "tenant": null, "url": "http://192.168.50.10:8000/api/ipam/ip-addresses/12/", "vrf": 1}, "msg": "ip_address 192.168.10.60/24 created"} + + PLAY RECAP **************************************************************************************************************************** + localhost : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 + +Using nb_lookup Plugin to Provide ID or Object +----------------------------------------------------- + +There are two options to use the lookup plugin. + +1. Pass in the object obtained by :ref:`nb_lookup<ansible_collections.netbox.netbox.netbox_lookup_lookup>`. +2. Pass in a dictionary with the key being ``id`` and the value of the lookup plugin after filtering to get the ID attribute. + +.. note:: The reason for the second option is due to the fact that the lookup plugin uses Jinja and will only cast as a string and not an integer. + +Option 1: Lookup Plugin Object +++++++++++++++++++++++++++++++++++ + +Let's go ahead and look at the first way by just passing in the complete object that it finds. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Add ip address to netbox" + netbox.netbox.netbox_ip_address: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + address: "192.168.10.60/24" + vrf: "Test VRF" + nat_inside: "{{ lookup('netbox.netbox.nb_lookup', 'ip-addresses', api_filter='address=192.168.100.1/24 vrf=1:1', api_endpoint='http://netbox.local', token='thisIsMyToken', validate_certs=False, raw_data=True) }}" + state: present + +.. code-block:: bash + + ❯ ansible-playbook netbox-ip.yml -v + No config file found; using defaults + [WARNING]: No inventory was parsed, only implicit localhost is available + [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' + + PLAY [localhost] ********************************************************************************************************************** + + TASK [Add ip address to netbox] ******************************************************************************************************* + changed: [localhost] => {"changed": true, "ip_address": {"address": "192.168.10.60/24", "assigned_object": null, "assigned_object_id": null, "assigned_object_type": null, "created": "2021-01-01", "custom_fields": {}, "description": "", "dns_name": "", "family": 4, "id": 12, "last_updated": "2021-01-01T17:28:29.770142Z", "nat_inside": 10, "nat_outside": null, "role": null, "status": "active", "tags": [], "tenant": null, "url": "http://192.168.50.10:8000/api/ipam/ip-addresses/12/", "vrf": 1}, "msg": "ip_address 192.168.10.60/24 created"} + + PLAY RECAP **************************************************************************************************************************** + localhost : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 + +The lookup plugin grabs the object from NetBox, serializes it into a dictionary, and then passes it into the module. This is similar to the :ref:`Passing in Dictionaries`, but allows you to find the information yourself without relying on the internal +resolution methods used in the modules. + +Option 2: Lookup Plugin ID +++++++++++++++++++++++++++++++ + +Let's take a look at option two. We'll delete the IP address from NetBox and then use the following task. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Add ip address to netbox" + netbox.netbox.netbox_ip_address: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + address: "192.168.10.60/24" + vrf: "Test VRF" + nat_inside: + id: "{{ query('netbox.netbox.nb_lookup', 'ip-addresses', api_filter='address=192.168.100.1/24 vrf=1:1', api_endpoint='http://netbox.local', token='thisIsMyToken', validate_certs=False, raw_data=True) | map(attribute='id') | first }}" + state: present + +There are a few differences between the two options since we use ``query`` rather than ``lookup`` since it returns a list that we can then use the ``map()`` Jinja filter to extract the ID field from the result +and then we capture the first element (there should only be one). + +The collection will actually convert the string it receives for the ``id`` and then convert it to an integer. + +.. code-block:: bash + + ❯ ansible-playbook netbox-ip.yml -v + No config file found; using defaults + [WARNING]: No inventory was parsed, only implicit localhost is available + [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' + + PLAY [localhost] ********************************************************************************************************************** + + TASK [Add ip address to netbox] ******************************************************************************************************* + changed: [localhost] => {"changed": true, "ip_address": {"address": "192.168.10.60/24", "assigned_object": null, "assigned_object_id": null, "assigned_object_type": null, "created": "2021-01-01", "custom_fields": {}, "description": "", "dns_name": "", "family": 4, "id": 12, "last_updated": "2021-01-01T17:28:29.770142Z", "nat_inside": 10, "nat_outside": null, "role": null, "status": "active", "tags": [], "tenant": null, "url": "http://192.168.50.10:8000/api/ipam/ip-addresses/12/", "vrf": 1}, "msg": "ip_address 192.168.10.60/24 created"} + + PLAY RECAP **************************************************************************************************************************** + localhost : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 + +Using query_params Module Argument +-------------------------------------------- + +There will be times when you want to override the builtin **ALLOWED_QUERY_PARAMS** to provide a unique search of an object. + +To make this possible, every module accepts the ``query_params`` argument. This argument allows you to specify a list of strings for the module arguments +you want to use to search for the object. + +Let's start with another example. We will continue to use :ref:`netbox.netbox.netbox_ip_address<ansible_collections.netbox.netbox.netbox_ip_address_module>`. We created **192.168.100.1/24** as a duplicate IP address within +the global IP address space within NetBox. This task should fail saying there was more than result returned. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Update non-unique IP address" + netbox.netbox.netbox_ip_address: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + address: "192.168.100.1/24" + + +.. code-block:: bash + + ❯ ansible-playbook netbox-ip.yml -v + No config file found; using defaults + [WARNING]: No inventory was parsed, only implicit localhost is available + [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' + + PLAY [localhost] **************************************************************************************************************************************************************************************************************** + + TASK [Update non-unique IP address] ********************************************************************************************************************************************************************************************* + [WARNING]: Skipping plugin (/Users/myohman/Documents/local-dev/ansible/filter_plugins/my_filter_plugin.py) as it seems to be invalid: expected an indented block (my_filter_plugin.py, line 19) + fatal: [localhost]: FAILED! => {"changed": false, "msg": "More than one result returned for 192.168.100.1/24"} + + PLAY RECAP ********************************************************************************************************************************************************************************************************************** + localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 + + +We get our desired result. Let's take a look at our IP addresses and see what field we can use to make a unique search for the duplicate IP addresses. + +.. image:: ./media/advanced_dns_name.png + :scale: 50 % + +We can see that ``dns_name`` will make a unique search. Now let's go ahead and specify our custom ``query_params`` to search for both the ``address`` and ``dns_name`` and then update the +IP address to be within **Test VRF 2**. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Update non-unique IP address" + netbox.netbox.netbox_ip_address: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + address: "192.168.100.1/24" + dns_name: "docs.netbox-modules.com" + vrf: "Test VRF 2" + query_params: + - address + - dns_name + +.. code-block:: bash + + ❯ ansible-playbook netbox-ip.yml -v + No config file found; using defaults + [WARNING]: No inventory was parsed, only implicit localhost is available + [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' + + PLAY [localhost] ********************************************************************************************************************** + + TASK [Update non-unique IP address] *************************************************************************************************** + changed: [localhost] => {"changed": true, "ip_address": {"address": "192.168.100.1/24", "assigned_object": null, "assigned_object_id": null, "assigned_object_type": null, "created": "2021-01-01", "custom_fields": {}, "description": "", "dns_name": "docs.netbox-modules.com", "family": 4, "id": 15, "last_updated": "2021-01-01T19:16:49.756265Z", "nat_inside": null, "nat_outside": null, "role": null, "status": "active", "tags": [], "tenant": null, "url": "http://192.168.50.10:8000/api/ipam/ip-addresses/15/", "vrf": 2}, "msg": "ip_address 192.168.100.1/24 updated"} + + PLAY RECAP **************************************************************************************************************************** + localhost : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 + +We can now see that the IP address is now within VRF with ID 2. + +Hopefully this shines some light on this useful feature to allow you, as the user, to define your specific needs for finding a unique object within your NetBox instance.
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/inventory.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/inventory.rst new file mode 100644 index 00000000..8b6466ff --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/inventory.rst @@ -0,0 +1,49 @@ +============ +Inventory +============ + +This page will just have quick examples that people may have had questions about, but the normal plugin documentation should be referenced for normal usage. + +The inventory plugin documentation can be found :ref:`here<ansible_collections.netbox.netbox.nb_inventory_inventory>`. + +Using Compose to Set ansible_network_os to Platform Slug +------------------------------------------------------------------ + +.. code-block:: yaml + + --- + plugin: netbox.netbox.nb_inventory + compose: + ansible_network_os: platform.slug + + +Using Keyed Groups to set ansible_network_os to Platform Slug +---------------------------------------------------------------- + +.. code-block:: yaml + + --- + plugin: netbox.netbox.nb_inventory + keyed_groups: + - key: platform + prefix: "network_os" + separator: "_" + +.. _post: http://blog.networktocode.com/post/ansible-constructed-inventory/ +.. note:: The above examples are excerpts from the following blog post_. + + +Using Inventory Plugin Within AWX/Tower +---------------------------------------- + +This will cover the basic usage of the NetBox inventory plugin within this collection. + +1. Define ``collections/requirements.yml`` within a Git project. +2. AWX/Tower will download the collection on each run. This can be handled differently or excluded if storing Ansible Collections on the AWX/Tower box. +3. Define ``inventory.yml`` in Git project that adheres to inventory plugin structure. +4. Add Git project to AWX/Tower as a project. +5. Create inventory and select ``source from project``. +6. Select the AWX/Tower project from Step 2 +7. Select the ``inventory.yml`` file in the project from Step 3 +8. Make sure your Tower installation uses Python 3 or select the proper ``ANSIBLE ENVIRONMENT`` +9. Click ``Save`` and sync source. diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/media/advanced_dict.png b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/media/advanced_dict.png Binary files differnew file mode 100644 index 00000000..68a3af35 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/media/advanced_dict.png diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/media/advanced_dns_name.png b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/media/advanced_dns_name.png Binary files differnew file mode 100644 index 00000000..9b184eb1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/media/advanced_dns_name.png diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/media/api_device_post.png b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/media/api_device_post.png Binary files differnew file mode 100644 index 00000000..a2283e14 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/media/api_device_post.png diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/modules.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/modules.rst new file mode 100644 index 00000000..8f0c399c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/how-to-use/modules.rst @@ -0,0 +1,223 @@ +Modules +=============== + +Specifying Modules in a Playbook +---------------------------------- + +There are two methods when using a collection in a playbook (in preferred order): + +1. Using the Fully Qualified Collection Name (FQCN) of the module, e.g. ``netbox.netbox.netbox_device`` at the task level. +2. Using the ``collections`` directive at the play level. + + +.. code-block:: yaml + + --- + - hosts: "localhost" + + tasks: + - name: "Configure a device in NetBox" + netbox.netbox.netbox_device: + <.. omitted> + + +.. code-block:: yaml + + --- + - hosts: "localhost" + collections: + - netbox.netbox + + tasks: + - name: "Configure a device in NetBox" + netbox_device: + <.. omitted> + + +To validate that the playbook is using the collection modules and not the Ansible builtin modules, add ``-vvv`` and look for the following line within the output for each task executed. + +.. code-block:: bash + + Using module file /Users/netbox/.ansible/collections/ansible_collections/netbox/netbox/plugins/modules/netbox_device.py + + +You can find more information at the official Ansible docs_. + +.. _docs: https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#installing-collections + +.. note:: If you are on MacOS and are running into ``ERROR! A worker was found in a dead state errors``, try running the playbook with ``env no_proxy='*'`` tag in front of the playbook. This is a known issue with MacOS as per this reference: https://github.com/ansible/ansible/issues/32554#issuecomment-642896861 + +Module Arguments & States +---------------------------- + +This section will provide details on why some module arguments are required for certain states or even change if an object already exists. + +Before we go any further, let's provide some preliminary knowledge of how Ansible works when accepting arguments into a module. + +Ansible provides several builtin methods when initializing the ``AnsibleModule`` to help build flexible module argument requirements. We aren't going to explore all the options in depth, but there are three that we currently use within this collection. + +- **argument_spec**: Defines a schema for acceptable arguments for a module along with their type, and specifying whether an argument is required or not. +- **required_if**: Allows logic to define that an argument is required if another argument and it's value meets the specified condition. +- **required_one_of**: Specifies logic that at least one of the arguments specified is required. + +Most modules will require the minimal amount of arguments to find a unique object in NetBox via the **argument_spec** that gets passed into ``AnsibleModule``. + +.. _Module Development: https://docs.ansible.com/ansible/latest/dev_guide/developing_program_flow_modules.html#ansiblemodule +.. note:: For more information, please view Ansible's documentation for Module Development_. + +This does mean that the modules may make the call to NetBox to create an object and the API will reply back advising the user that required fields were missing for the specific operation and causes the module to fail. + +.. code-block:: bash + + failed: [localhost] (item={'unit': 2, 'type': 'nexus-child'}) => {"ansible_loop_var": "item", "changed": false, "item": {"type": "nexus-child", "unit": 2}, "msg": "{\"device_role\":[\"This field is required.\"]}"} + + +To expand further, our ``present`` state can either **create** or **update** an object. If the object does not exist within NetBox it will send a ``POST`` and create the object. +If the object already exists, the fetched object from NetBox is captured with ``pynetbox`` and will already have the required fields, which means the user only needs to provide the updated fields. +The next step is to then compare the object obtained from NetBox to the data passed in by the user into the module and only update the fields that are different. This is all handled behind the scenes within the modules. + +Hopefully this helps paint a picture as to why certain design decisions were made and how you can better consume this collection. Let's move onto some examples. + +State: Present - Create ++++++++++++++++++ + +When creating an object, you will need to provide the same arguments as you would if you were creating an object via the API. + +Let's take a look at creating a device via the API. + +.. image:: ./media/api_device_post.png + :scale: 35 % + +The required fields are marked by ``*`` and we can see the following are fields are required: + + - **device_type** + - **device_role** + - **site** + +These same fields are required when creating a device via the :ref:`netbox_device <ansible_collections.netbox.netbox.netbox_device_module>` module, but with the important addition of **name**. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Example for state: present" + netbox.netbox.netbox_device: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + name: "Test Device" + device_type: "C9410R" + device_role: "Core Switch" + site: "Main" + state: present + +The reasoning behind requiring **name** within the Ansible modules is to provide the module with the ability to distinguish between devices or objects within NetBox. The name helps make the device unique rather than attempting to only +search on ``device_type``, ``device_role``, and ``site`` as these do not make a device unique and makes it difficult to assume which device the user cares about. +These modules are abstracting away the API interaction and some of the logic which means we require the users to provide a bit more information as to what they're intending to do. We're trying to keep the abstractions to a minimum, +but that isn't always possible. + +Along with forcing a user to provide some uniqueness to their objects in NetBox, we also try and mirror the module interaction with the GUI interaction where we can to prevent burdening the user. +For instance, the ``slug`` field is required when interacting with the API for the majority of models in NetBox, but constructing the ``slug`` is handled for the user within the GUI. To stay aligned with the GUI, +we abstract that away from the user by constructing the ``slug`` from the ``name`` using the same rules as the NetBox GUI. + +For reference, here is the code that **slugifies** the ``name`` argument when a user does not provide a ``slug``. + +.. code-block:: python + + def _to_slug(self, value): + """ + :returns slug (str): Slugified value + :params value (str): Value that needs to be changed to slug format + """ + if value is None: + return value + elif isinstance(value, int): + return value + else: + removed_chars = re.sub(r"[^\-\.\w\s]", "", value) + convert_chars = re.sub(r"[\-\.\s]+", "-", removed_chars) + return convert_chars.strip().lower() + + +Now that we have a better understanding of why certain arguments are required or not, let's look into updating an existing object. + +State: Present - Update ++++++++++++++++++ + +Now that we have created our device (**Test Device**), let's update it by adding a serial number. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Example state: present - Update" + netbox.netbox.netbox_device: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + name: "Test Device" + serial_number: "FXS110011" + state: "present" + +We're only providing the **name** which makes the device unique and then the argument we want updated. As stated above, it will see that the device exist, and then update the ``serial_number`` field and then send a +``PATCH`` to the NetBox API. + +.. note:: + You can add the ``query_params`` argument to specify specific fields that make the object unique in your environment. + + Defining ``query_params`` overrides the default fields the modules use when attempting to resolve the object. + + More information can be found in the :ref:`Advanced Usage` section. + + +State: Absent - Delete ++++++++++++++++++ + +The uniqueness of the device (**name** or user specified **query_params**) and the ``state`` set to ``absent`` are the only requirements for deleting an object. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Example state: absent" + netbox.netbox.netbox_device: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + name: "Test Device" + state: "absent" + +Tags ++++++++++++++++ + +Not all models support tags, but several of them do so I wanted to talk a little bit more about them outside of a module context since they're +applied the same irregardless of which module you're using. + +.. note:: + Tags changed significantly starting NetBox 2.10. + + We will not be covering pre-2.10 tags within these docs. + +Tags are now a model within NetBox and require being resolved like any other model such as ``device_type`` shown above. This requires the user to provide a list of dictionaries +that specify fields that are unique to each tag. Name can be used, but we always suggest that you use ``slug`` when available. + +.. code-block:: yaml + + --- + ... + tasks: + - name: "Example using tags" + netbox.netbox.netbox_device: + netbox_url: "http://netbox.local" + netbox_token: "thisIsMyToken" + data: + name: "Test Device" + tags: + - slug: "my-new-tag1" + - slug: "my-new-tag2" + state: "present" + +.. warning:: Everything discussed above can be applied to each module, but may need to swap out any arguments for module specific arguments. diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/index.rst new file mode 100644 index 00000000..e0cca23e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/index.rst @@ -0,0 +1,9 @@ +==================== +Getting Started +==================== + +.. toctree:: + :maxdepth: 4 + + Installation <installation> + How to Use <how-to-use>
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/installation.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/installation.rst new file mode 100644 index 00000000..de80fb48 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/getting_started/installation.rst @@ -0,0 +1,41 @@ +============= +Installation +============= + +Ansible Galaxy +--------------- + +Run the following command to install the netbox.netbox collection: +``ansible-galaxy collection install netbox.netbox`` + +.. _docs: https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#installing-collections + +.. note:: + Installing Ansible Collections using Git within a ``requirements.yml`` is not supported until Ansible 2.10. + + Follow the official docs_ to learn more about other installation methods. + +Build From Source +------------------ + +Follow these steps to install from source: + +1. ``git clone git@github.com:netbox-community/ansible_modules.git`` +2. ``cd ansible_modules`` +3. ``ansible-galaxy collection build .`` +4. ``ansible-galaxy collection install netbox-netbox*.tar.gz`` + +Build From Source (Pull Request) +----------------------------------- + +This is useful to test code within PRs. + +1. ``git clone git@github.com:netbox-community/ansible_modules.git`` +2. ``cd ansible_modules`` +3. ``git fetch origin pull/<pr #>/head:<whatever-name-you-want>`` +4. ``git checkout <whatever-name-you-want>`` +5. ``ansible-galaxy collection build .`` +6. ``ansible-galaxy collection install netbox-netbox*.tar.gz`` + +.. _GitHub: https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/checking-out-pull-requests-locally +.. note:: The following link provides detailed information on checking out pull requests locally: GitHub_
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/index.rst new file mode 100644 index 00000000..f26fee07 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/index.rst @@ -0,0 +1,20 @@ +netbox.netbox Ansible Collection's documentation! +================================================================ + + +Overview +======== + +This is the documentation home of the **netbox.netbox** Ansible Collection. We will provide some examples of using all the different plugins included with this collection. + +Contents +======== + +.. toctree:: + :maxdepth: 4 + + Home <self> + Getting Started <getting_started/index> + Advanced Usage <advanced/index> + Plugins <plugins/index> + Changelog <changelog/index> diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/js/ansible/application.js b/collections-debian-merged/ansible_collections/netbox/netbox/docs/js/ansible/application.js new file mode 100644 index 00000000..5e9f81ba --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/js/ansible/application.js @@ -0,0 +1,106 @@ +angular.module('ansibleApp', []).filter('moduleVersion', function() { + return function(modules, version) { + + var parseVersionString = function (str) { + if (typeof(str) != 'string') { return false; } + var x = str.split('.'); + // parse from string or default to 0 if can't parse + var maj = parseInt(x[0]) || 0; + var min = parseInt(x[1]) || 0; + var pat = parseInt(x[2]) || 0; + return { + major: maj, + minor: min, + patch: pat + } + } + + var vMinMet = function(vmin, vcurrent) { + minimum = parseVersionString(vmin); + running = parseVersionString(vcurrent); + if (running.major != minimum.major) + return (running.major > minimum.major); + else { + if (running.minor != minimum.minor) + return (running.minor > minimum.minor); + else { + if (running.patch != minimum.patch) + return (running.patch > minimum.patch); + else + return true; + } + } + }; + + var result = []; + if (!version) { + return modules; + } + for (var i = 0; i < modules.length; i++) { + if (vMinMet(modules[i].version_added, version)) { + result[result.length] = modules[i]; + } + } + + return result; + }; +}).filter('uniqueVersion', function() { + return function(modules) { + var result = []; + var inArray = function (needle, haystack) { + var length = haystack.length; + for(var i = 0; i < length; i++) { + if(haystack[i] == needle) return true; + } + return false; + } + + var parseVersionString = function (str) { + if (typeof(str) != 'string') { return false; } + var x = str.split('.'); + // parse from string or default to 0 if can't parse + var maj = parseInt(x[0]) || 0; + var min = parseInt(x[1]) || 0; + var pat = parseInt(x[2]) || 0; + return { + major: maj, + minor: min, + patch: pat + } + } + + for (var i = 0; i < modules.length; i++) { + if (!inArray(modules[i].version_added, result)) { + // Some module do not define version + if (modules[i].version_added) { + result[result.length] = "" + modules[i].version_added; + } + } + } + + result.sort( + function (a, b) { + ao = parseVersionString(a); + bo = parseVersionString(b); + if (ao.major == bo.major) { + if (ao.minor == bo.minor) { + if (ao.patch == bo.patch) { + return 0; + } + else { + return (ao.patch > bo.patch) ? 1 : -1; + } + } + else { + return (ao.minor > bo.minor) ? 1 : -1; + } + } + else { + return (ao.major > bo.major) ? 1 : -1; + } + }); + + return result; + }; +}); + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/media/postresults.PNG b/collections-debian-merged/ansible_collections/netbox/netbox/docs/media/postresults.PNG Binary files differnew file mode 100755 index 00000000..92885ee4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/media/postresults.PNG diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/index.rst new file mode 100644 index 00000000..4168a886 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/index.rst @@ -0,0 +1,10 @@ +plugins +======= + +.. toctree:: + :maxdepth: 4 + + inventory/index + lookup/index + module_utils/index + modules/index diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/inventory/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/inventory/index.rst new file mode 100755 index 00000000..bdd831bc --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/inventory/index.rst @@ -0,0 +1,8 @@ +Inventory +========== + +.. toctree:: + :maxdepth: 4 + :glob: + + */netbox*
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/inventory/nb_inventory/netbox.netbox.nb_inventory_inventory.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/inventory/nb_inventory/netbox.netbox.nb_inventory_inventory.rst new file mode 100644 index 00000000..d0c970c0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/inventory/nb_inventory/netbox.netbox.nb_inventory_inventory.rst @@ -0,0 +1,853 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.nb_inventory_inventory: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.nb_inventory -- NetBox inventory source ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.nb_inventory`. + +.. version_added + + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Get inventory hosts from NetBox + +.. Aliases + + +.. Requirements + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th>Configuration</th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-api_endpoint"></div> + <b>api_endpoint</b> + <a class="ansibleOptionLink" href="#parameter-api_endpoint" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div> + env:NETBOX_API + </div> + </td> + <td> + <div>Endpoint of the NetBox API</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-cache"></div> + <b>cache</b> + <a class="ansibleOptionLink" href="#parameter-cache" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div> ini entries: + <p> + [inventory]<br>cache = no + </p> + </div> + <div> + env:ANSIBLE_INVENTORY_CACHE + </div> + </td> + <td> + <div>Toggle to enable/disable the caching of the inventory's source data, requires a cache plugin setup to work.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-cache_connection"></div> + <b>cache_connection</b> + <a class="ansibleOptionLink" href="#parameter-cache_connection" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div> ini entries: + <p> + [defaults]<br>fact_caching_connection = None + </p> + <p> + [inventory]<br>cache_connection = None + </p> + </div> + <div> + env:ANSIBLE_CACHE_PLUGIN_CONNECTION + </div> + <div> + env:ANSIBLE_INVENTORY_CACHE_CONNECTION + </div> + </td> + <td> + <div>Cache connection data or path, read cache plugin documentation for specifics.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-cache_plugin"></div> + <b>cache_plugin</b> + <a class="ansibleOptionLink" href="#parameter-cache_plugin" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"memory"</div> + </td> + <td> + <div> ini entries: + <p> + [defaults]<br>fact_caching = memory + </p> + <p> + [inventory]<br>cache_plugin = memory + </p> + </div> + <div> + env:ANSIBLE_CACHE_PLUGIN + </div> + <div> + env:ANSIBLE_INVENTORY_CACHE_PLUGIN + </div> + </td> + <td> + <div>Cache plugin to use for the inventory's source data.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-cache_prefix"></div> + <b>cache_prefix</b> + <a class="ansibleOptionLink" href="#parameter-cache_prefix" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"ansible_inventory_"</div> + </td> + <td> + <div> ini entries: + <p> + [default]<br>fact_caching_prefix = ansible_inventory_ + </p> + <p> + [inventory]<br>cache_prefix = ansible_inventory_ + </p> + </div> + <div> + env:ANSIBLE_CACHE_PLUGIN_PREFIX + </div> + <div> + env:ANSIBLE_INVENTORY_CACHE_PLUGIN_PREFIX + </div> + </td> + <td> + <div>Prefix to use for cache plugin files/tables</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-cache_timeout"></div> + <b>cache_timeout</b> + <a class="ansibleOptionLink" href="#parameter-cache_timeout" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">3600</div> + </td> + <td> + <div> ini entries: + <p> + [defaults]<br>fact_caching_timeout = 3600 + </p> + <p> + [inventory]<br>cache_timeout = 3600 + </p> + </div> + <div> + env:ANSIBLE_CACHE_PLUGIN_TIMEOUT + </div> + <div> + env:ANSIBLE_INVENTORY_CACHE_TIMEOUT + </div> + </td> + <td> + <div>Cache duration in seconds</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-compose"></div> + <b>compose</b> + <a class="ansibleOptionLink" href="#parameter-compose" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">{}</div> + </td> + <td> + </td> + <td> + <div>List of custom ansible host vars to create from the device object fetched from NetBox</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-config_context"></div> + <b>config_context</b> + <a class="ansibleOptionLink" href="#parameter-config_context" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + </td> + <td> + <div>If True, it adds config_context in host vars.</div> + <div>Config-context enables the association of arbitrary data to devices and virtual machines grouped by region, site, role, platform, and/or tenant. Please check official netbox docs for more info.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-device_query_filters"></div> + <b>device_query_filters</b> + <a class="ansibleOptionLink" href="#parameter-device_query_filters" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">[]</div> + </td> + <td> + </td> + <td> + <div>List of parameters passed to the query string for devices (Multiple values may be separated by commas)</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-fetch_all"></div> + <b>fetch_all</b> + <a class="ansibleOptionLink" href="#parameter-fetch_all" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + <div style="font-style: italic; font-size: small; color: darkgreen"> + added in 0.2.1 of + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li><div style="color: blue"><b>yes</b> ←</div></li> + </ul> + </td> + <td> + </td> + <td> + <div>By default, fetching interfaces and services will get all of the contents of NetBox regardless of query_filters applied to devices and VMs.</div> + <div>When set to False, separate requests will be made fetching interfaces, services, and IP addresses for each device_id and virtual_machine_id.</div> + <div>If you are using the various query_filters options to reduce the number of devices, you may find querying Netbox faster with fetch_all set to False.</div> + <div>For efficiency, when False, these requests will be batched, for example /api/dcim/interfaces?limit=0&device_id=1&device_id=2&device_id=3</div> + <div>These GET request URIs can become quite large for a large number of devices. If you run into HTTP 414 errors, you can adjust the max_uri_length option to suit your web server.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-flatten_config_context"></div> + <b>flatten_config_context</b> + <a class="ansibleOptionLink" href="#parameter-flatten_config_context" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + <div style="font-style: italic; font-size: small; color: darkgreen"> + added in 0.2.1 of + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + </td> + <td> + <div>If <em>config_context</em> is enabled, by default it's added as a host var named config_context.</div> + <div>If flatten_config_context is set to True, the config context variables will be added directly to the host instead.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-flatten_custom_fields"></div> + <b>flatten_custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-flatten_custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + <div style="font-style: italic; font-size: small; color: darkgreen"> + added in 0.2.1 of + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + </td> + <td> + <div>By default, host custom fields are added as a dictionary host var named custom_fields.</div> + <div>If flatten_custom_fields is set to True, the fields will be added directly to the host instead.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-flatten_local_context_data"></div> + <b>flatten_local_context_data</b> + <a class="ansibleOptionLink" href="#parameter-flatten_local_context_data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + <div style="font-style: italic; font-size: small; color: darkgreen"> + added in 0.3.0 of + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + </td> + <td> + <div>If <em>local_context_data</em> is enabled, by default it's added as a host var named local_context_data.</div> + <div>If flatten_local_context_data is set to True, the config context variables will be added directly to the host instead.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-follow_redirects"></div> + <b>follow_redirects</b> + <a class="ansibleOptionLink" href="#parameter-follow_redirects" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>urllib2</b> ←</div></li> + <li>all</li> + <li>yes</li> + <li>safe</li> + <li>none</li> + </ul> + </td> + <td> + </td> + <td> + <div>Determine how redirects are followed.</div> + <div>By default, <em>follow_redirects</em> is set to uses urllib2 default behavior.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-group_by"></div> + <b>group_by</b> + <a class="ansibleOptionLink" href="#parameter-group_by" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>sites</li> + <li>site</li> + <li>tenants</li> + <li>tenant</li> + <li>racks</li> + <li>rack</li> + <li>rack_group</li> + <li>rack_role</li> + <li>tags</li> + <li>tag</li> + <li>device_roles</li> + <li>role</li> + <li>device_types</li> + <li>device_type</li> + <li>manufacturers</li> + <li>manufacturer</li> + <li>platforms</li> + <li>platform</li> + <li>region</li> + <li>cluster</li> + <li>cluster_type</li> + <li>cluster_group</li> + <li>is_virtual</li> + <li>services</li> + </ul> + <b>Default:</b><br/><div style="color: blue">[]</div> + </td> + <td> + </td> + <td> + <div>Keys used to create groups. The <em>plurals</em> option controls which of these are valid.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-group_names_raw"></div> + <b>group_names_raw</b> + <a class="ansibleOptionLink" href="#parameter-group_names_raw" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + <div style="font-style: italic; font-size: small; color: darkgreen"> + added in 0.2.0 of + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + </td> + <td> + <div>Will not add the group_by choice name to the group names</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-groups"></div> + <b>groups</b> + <a class="ansibleOptionLink" href="#parameter-groups" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">{}</div> + </td> + <td> + </td> + <td> + <div>Add hosts to group based on Jinja2 conditionals.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-interfaces"></div> + <b>interfaces</b> + <a class="ansibleOptionLink" href="#parameter-interfaces" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + <div style="font-style: italic; font-size: small; color: darkgreen"> + added in 0.1.7 of + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + </td> + <td> + <div>If True, it adds the device or virtual machine interface information in host vars.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-keyed_groups"></div> + <b>keyed_groups</b> + <a class="ansibleOptionLink" href="#parameter-keyed_groups" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">[]</div> + </td> + <td> + </td> + <td> + <div>Add hosts to group based on the values of a variable.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-max_uri_length"></div> + <b>max_uri_length</b> + <a class="ansibleOptionLink" href="#parameter-max_uri_length" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + <div style="font-style: italic; font-size: small; color: darkgreen"> + added in 0.2.1 of + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">4000</div> + </td> + <td> + </td> + <td> + <div>When fetch_all is False, GET requests to NetBox may become quite long and return a HTTP 414 (URI Too Long).</div> + <div>You can adjust this option to be smaller to avoid 414 errors, or larger for a reduced number of requests.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-plugin"></div> + <b>plugin</b> + <a class="ansibleOptionLink" href="#parameter-plugin" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>netbox.netbox.nb_inventory</li> + </ul> + </td> + <td> + </td> + <td> + <div>token that ensures this is a source file for the 'netbox' plugin.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-plurals"></div> + <b>plurals</b> + <a class="ansibleOptionLink" href="#parameter-plurals" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + <div style="font-style: italic; font-size: small; color: darkgreen"> + added in 0.2.1 of + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li><div style="color: blue"><b>yes</b> ←</div></li> + </ul> + </td> + <td> + </td> + <td> + <div>If True, all host vars are contained inside single-element arrays for legacy compatibility with old versions of this plugin.</div> + <div>Group names will be plural (ie. "sites_mysite" instead of "site_mysite")</div> + <div>The choices of <em>group_by</em> will be changed by this option.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-query_filters"></div> + <b>query_filters</b> + <a class="ansibleOptionLink" href="#parameter-query_filters" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">[]</div> + </td> + <td> + </td> + <td> + <div>List of parameters passed to the query string for both devices and VMs (Multiple values may be separated by commas)</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-services"></div> + <b>services</b> + <a class="ansibleOptionLink" href="#parameter-services" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + <div style="font-style: italic; font-size: small; color: darkgreen"> + added in 0.2.0 of + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li><div style="color: blue"><b>yes</b> ←</div></li> + </ul> + </td> + <td> + </td> + <td> + <div>If True, it adds the device or virtual machine services information in host vars.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-strict"></div> + <b>strict</b> + <a class="ansibleOptionLink" href="#parameter-strict" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + </td> + <td> + <div>If <code>yes</code> make invalid entries a fatal error, otherwise skip and continue.</div> + <div>Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-timeout"></div> + <b>timeout</b> + <a class="ansibleOptionLink" href="#parameter-timeout" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">60</div> + </td> + <td> + </td> + <td> + <div>Timeout for Netbox requests in seconds</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-token"></div> + <b>token</b> + <a class="ansibleOptionLink" href="#parameter-token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div> + env:NETBOX_TOKEN + </div> + <div> + env:NETBOX_API_KEY + </div> + </td> + <td> + <div>NetBox API token to be able to read against NetBox.</div> + <div>This may not be required depending on the NetBox setup.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li><div style="color: blue"><b>yes</b> ←</div></li> + </ul> + </td> + <td> + </td> + <td> + <div>Allows connection when SSL certificates are not valid. Set to <code>false</code> when certificates are not trusted.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-vm_query_filters"></div> + <b>vm_query_filters</b> + <a class="ansibleOptionLink" href="#parameter-vm_query_filters" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">[]</div> + </td> + <td> + </td> + <td> + <div>List of parameters passed to the query string for VMs (Multiple values may be separated by commas)</div> + </td> + </tr> + </table> + <br/> + +.. Notes + + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + # netbox_inventory.yml file in YAML format + # Example command line: ansible-inventory -v --list -i netbox_inventory.yml + + plugin: netbox.netbox.nb_inventory + api_endpoint: http://localhost:8000 + validate_certs: True + config_context: False + group_by: + - device_roles + query_filters: + - role: network-edge-router + device_query_filters: + - has_primary_ip: 'true' + + # has_primary_ip is a useful way to filter out patch panels and other passive devices + + # Query filters are passed directly as an argument to the fetching queries. + # You can repeat tags in the query string. + + query_filters: + - role: server + - tag: web + - tag: production + + # See the NetBox documentation at https://netbox.readthedocs.io/en/latest/api/overview/ + # the query_filters work as a logical **OR** + # + # Prefix any custom fields with cf_ and pass the field value with the regular NetBox query string + + query_filters: + - cf_foo: bar + + # NetBox inventory plugin also supports Constructable semantics + # You can fill your hosts vars using the compose option: + + plugin: netbox.netbox.nb_inventory + compose: + foo: last_updated + bar: display_name + nested_variable: rack.display_name + + + + +.. Facts + + +.. Return values + + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Remy Leone (@sieben) +- Anthony Ruhier (@Anthony25) +- Nikhil Singh Baliyan (@nikkytub) +- Sander Steffann (@steffann) +- Douglas Heriot (@DouglasHeriot) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/lookup/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/lookup/index.rst new file mode 100755 index 00000000..4e0a9bc9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/lookup/index.rst @@ -0,0 +1,8 @@ +lookup +======= + +.. toctree:: + :maxdepth: 4 + :glob: + + */netbox*
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/lookup/nb_lookup/netbox.netbox.nb_lookup_lookup.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/lookup/nb_lookup/netbox.netbox.nb_lookup_lookup.rst new file mode 100644 index 00000000..e360625b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/lookup/nb_lookup/netbox.netbox.nb_lookup_lookup.rst @@ -0,0 +1,294 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.nb_lookup_lookup: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.nb_lookup -- Queries and returns elements from Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.nb_lookup`. + +.. version_added + +.. versionadded:: 2.9 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Queries Netbox via its API to return virtually any information capable of being held in Netbox. +- If wanting to obtain the plaintext attribute of a secret, key_file must be provided. + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the local controller node that executes this lookup. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th>Configuration</th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-_terms"></div> + <b>_terms</b> + <a class="ansibleOptionLink" href="#parameter-_terms" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + </td> + <td> + <div>The Netbox object type to query</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-api_endpoint"></div> + <b>api_endpoint</b> + <a class="ansibleOptionLink" href="#parameter-api_endpoint" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + </td> + <td> + <div>The URL to the Netbox instance to query</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-api_filter"></div> + <b>api_filter</b> + <a class="ansibleOptionLink" href="#parameter-api_filter" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + </td> + <td> + <div>The api_filter to use.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-key_file"></div> + <b>key_file</b> + <a class="ansibleOptionLink" href="#parameter-key_file" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + </td> + <td> + <div>The location of the private key tied to user account.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-raw_data"></div> + <b>raw_data</b> + <a class="ansibleOptionLink" href="#parameter-raw_data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + </td> + <td> + <div>Whether to return raw API data with the lookup/query or whether to return a key/value dict</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-token"></div> + <b>token</b> + <a class="ansibleOptionLink" href="#parameter-token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + </td> + <td> + <div>The API token created through Netbox</div> + <div>This may not be required depending on the Netbox setup.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + </td> + <td> + <div>Whether or not to validate SSL of the NetBox instance</div> + </td> + </tr> + </table> + <br/> + +.. Notes + + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + tasks: + # query a list of devices + - name: Obtain list of devices from Netbox + debug: + msg: > + "Device {{ item.value.display_name }} (ID: {{ item.key }}) was + manufactured by {{ item.value.device_type.manufacturer.name }}" + loop: "{{ query('nb_lookup', 'devices', + api_endpoint='http://localhost/', + token='<redacted>') }}" + + # This example uses an API Filter + + tasks: + # query a list of devices + - name: Obtain list of devices from Netbox + debug: + msg: > + "Device {{ item.value.display_name }} (ID: {{ item.key }}) was + manufactured by {{ item.value.device_type.manufacturer.name }}" + loop: "{{ query('nb_lookup', 'devices', + api_endpoint='http://localhost/', + api_filter='role=management tag=Dell'), + token='<redacted>') }}" + + # Obtain a secret for R1-device + tasks: + - name: "Obtain secrets for R1-Device" + debug: + msg: "{{ query('nb_lookup', 'secrets', api_filter='device=R1-Device', api_endpoint='http://localhost/', token='<redacted>', key_file='~/.ssh/id_rsa') }}" + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this lookup: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-_list"></div> + <b>_list</b> + <a class="ansibleOptionLink" href="#return-_list" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td>success</td> + <td> + <div>list of composed dictionaries with key and value</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Chris Mills (@cpmills1975) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/index.rst new file mode 100644 index 00000000..e907feef --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/index.rst @@ -0,0 +1,8 @@ +module_utils +==================== + +.. toctree:: + :maxdepth: 4 + :glob: + + */index
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_circuits/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_circuits/index.rst new file mode 100644 index 00000000..1ae679d4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_circuits/index.rst @@ -0,0 +1,13 @@ +netbox_circuits +==================================== + +Constants +--------- +.. autodata:: plugins.module_utils.netbox_circuits.NB_PROVIDERS +.. autodata:: plugins.module_utils.netbox_circuits.NB_CIRCUIT_TYPES +.. autodata:: plugins.module_utils.netbox_circuits.NB_CIRCUIT_TERMINATIONS +.. autodata:: plugins.module_utils.netbox_circuits.NB_CIRCUITS + +Classes +------- +.. autoclass:: plugins.module_utils.netbox_circuits.NetboxCircuitsModule diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_dcim/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_dcim/index.rst new file mode 100644 index 00000000..d4d93fed --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_dcim/index.rst @@ -0,0 +1,40 @@ +netbox_dcim +==================================== + +Constants +--------- +.. autodata:: plugins.module_utils.netbox_dcim.NB_CABLES +.. autodata:: plugins.module_utils.netbox_dcim.NB_CONSOLE_PORTS +.. autodata:: plugins.module_utils.netbox_dcim.NB_CONSOLE_PORT_TEMPLATES +.. autodata:: plugins.module_utils.netbox_dcim.NB_CONSOLE_SERVER_PORTS +.. autodata:: plugins.module_utils.netbox_dcim.NB_CONSOLE_SERVER_PORT_TEMPLATES +.. autodata:: plugins.module_utils.netbox_dcim.NB_DEVICE_BAYS +.. autodata:: plugins.module_utils.netbox_dcim.NB_DEVICE_BAY_TEMPLATES +.. autodata:: plugins.module_utils.netbox_dcim.NB_DEVICES +.. autodata:: plugins.module_utils.netbox_dcim.NB_DEVICE_ROLES +.. autodata:: plugins.module_utils.netbox_dcim.NB_DEVICE_TYPES +.. autodata:: plugins.module_utils.netbox_dcim.NB_FRONT_PORTS +.. autodata:: plugins.module_utils.netbox_dcim.NB_FRONT_PORT_TEMPLATES +.. autodata:: plugins.module_utils.netbox_dcim.NB_INTERFACES +.. autodata:: plugins.module_utils.netbox_dcim.NB_INTERFACE_TEMPLATES +.. autodata:: plugins.module_utils.netbox_dcim.NB_INVENTORY_ITEMS +.. autodata:: plugins.module_utils.netbox_dcim.NB_MANUFACTURERS +.. autodata:: plugins.module_utils.netbox_dcim.NB_PLATFORMS +.. autodata:: plugins.module_utils.netbox_dcim.NB_POWER_FEEDS +.. autodata:: plugins.module_utils.netbox_dcim.NB_POWER_OUTLETS +.. autodata:: plugins.module_utils.netbox_dcim.NB_POWER_OUTLET_TEMPLATES +.. autodata:: plugins.module_utils.netbox_dcim.NB_POWER_PANELS +.. autodata:: plugins.module_utils.netbox_dcim.NB_POWER_PORTS +.. autodata:: plugins.module_utils.netbox_dcim.NB_POWER_PORT_TEMPLATES +.. autodata:: plugins.module_utils.netbox_dcim.NB_RACKS +.. autodata:: plugins.module_utils.netbox_dcim.NB_RACK_ROLES +.. autodata:: plugins.module_utils.netbox_dcim.NB_RACK_GROUPS +.. autodata:: plugins.module_utils.netbox_dcim.NB_REAR_PORTS +.. autodata:: plugins.module_utils.netbox_dcim.NB_REAR_PORT_TEMPLATES +.. autodata:: plugins.module_utils.netbox_dcim.NB_REGIONS +.. autodata:: plugins.module_utils.netbox_dcim.NB_SITES +.. autodata:: plugins.module_utils.netbox_dcim.NB_VIRTUAL_CHASSIS + +Classes +------- +.. autoclass:: plugins.module_utils.netbox_dcim.NetboxDcimModule diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_extras/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_extras/index.rst new file mode 100644 index 00000000..c8aadb12 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_extras/index.rst @@ -0,0 +1,10 @@ +netbox_extras +==================================== + +Constants +--------- +None exist at the moment. + +Classes +------- +.. autoclass:: plugins.module_utils.netbox_extras.NetboxExtrasModule diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_ipam/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_ipam/index.rst new file mode 100644 index 00000000..5bd409ac --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_ipam/index.rst @@ -0,0 +1,18 @@ +netbox_ipam +==================================== + +Constants +--------- +.. autodata:: plugins.module_utils.netbox_ipam.NB_AGGREGATES +.. autodata:: plugins.module_utils.netbox_ipam.NB_IP_ADDRESSES +.. autodata:: plugins.module_utils.netbox_ipam.NB_PREFIXES +.. autodata:: plugins.module_utils.netbox_ipam.NB_IPAM_ROLES +.. autodata:: plugins.module_utils.netbox_ipam.NB_RIRS +.. autodata:: plugins.module_utils.netbox_ipam.NB_VLANS +.. autodata:: plugins.module_utils.netbox_ipam.NB_VLAN_GROUPS +.. autodata:: plugins.module_utils.netbox_ipam.NB_VRFS +.. autodata:: plugins.module_utils.netbox_ipam.NB_SERVICES + +Classes +------- +.. autoclass:: plugins.module_utils.netbox_ipam.NetboxIpamModule diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_secrets/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_secrets/index.rst new file mode 100644 index 00000000..b664048c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_secrets/index.rst @@ -0,0 +1,10 @@ +netbox_secrets +==================================== + +Constants +--------- +None exist at the moment. + +Classes +------- +.. autoclass:: plugins.module_utils.netbox_secrets.NetboxSecretsModule diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_tenancy/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_tenancy/index.rst new file mode 100644 index 00000000..b53e2486 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_tenancy/index.rst @@ -0,0 +1,11 @@ +netbox_tenancy +==================================== + +Constants +--------- +.. autodata:: plugins.module_utils.netbox_tenancy.NB_TENANTS +.. autodata:: plugins.module_utils.netbox_tenancy.NB_TENANT_GROUPS + +Classes +------- +.. autoclass:: plugins.module_utils.netbox_tenancy.NetboxTenancyModule diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_utils/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_utils/index.rst new file mode 100644 index 00000000..0f573271 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_utils/index.rst @@ -0,0 +1,20 @@ +netbox_utils +================================= + +Constants +--------- + +.. autodata:: plugins.module_utils.netbox_utils.API_APPS_ENDPOINTS +.. autodata:: plugins.module_utils.netbox_utils.QUERY_TYPES +.. autodata:: plugins.module_utils.netbox_utils.CONVERT_TO_ID +.. autodata:: plugins.module_utils.netbox_utils.ENDPOINT_NAME_MAPPING +.. autodata:: plugins.module_utils.netbox_utils.ALLOWED_QUERY_PARAMS +.. autodata:: plugins.module_utils.netbox_utils.QUERY_PARAMS_IDS +.. autodata:: plugins.module_utils.netbox_utils.REQUIRED_ID_FIND +.. autodata:: plugins.module_utils.netbox_utils.CONVERT_KEYS +.. autodata:: plugins.module_utils.netbox_utils.SLUG_REQUIRED +.. autodata:: plugins.module_utils.netbox_utils.NETBOX_ARG_SPEC + +Classes +------- +.. automodule:: plugins.module_utils.netbox_utils
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_virtualization/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_virtualization/index.rst new file mode 100644 index 00000000..45260658 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/module_utils/netbox_virtualization/index.rst @@ -0,0 +1,14 @@ +netbox_virtualization +==================================== + +Constants +--------- +.. autodata:: plugins.module_utils.netbox_virtualization.NB_VIRTUAL_MACHINES +.. autodata:: plugins.module_utils.netbox_virtualization.NB_CLUSTERS +.. autodata:: plugins.module_utils.netbox_virtualization.NB_CLUSTER_GROUP +.. autodata:: plugins.module_utils.netbox_virtualization.NB_CLUSTER_TYPE +.. autodata:: plugins.module_utils.netbox_virtualization.NB_VM_INTERFACES + +Classes +------- +.. autoclass:: plugins.module_utils.netbox_virtualization.NetboxVirtualizationModule diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/index.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/index.rst new file mode 100755 index 00000000..a994d8b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/index.rst @@ -0,0 +1,8 @@ +modules +========== + +.. toctree:: + :maxdepth: 4 + :glob: + + */netbox*
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_aggregate/netbox.netbox.netbox_aggregate_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_aggregate/netbox.netbox.netbox_aggregate_module.rst new file mode 100644 index 00000000..0a22958d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_aggregate/netbox.netbox.netbox_aggregate_module.rst @@ -0,0 +1,391 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_aggregate_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_aggregate -- Creates or removes aggregates from Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_aggregate`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes aggregates from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the aggregate configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/date_added"></div> + <b>date_added</b> + <a class="ansibleOptionLink" href="#parameter-data/date_added" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Date added, format: YYYY-MM-DD</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the aggregate</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/prefix"></div> + <b>prefix</b> + <a class="ansibleOptionLink" href="#parameter-data/prefix" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The aggregate prefix</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rir"></div> + <b>rir</b> + <a class="ansibleOptionLink" href="#parameter-data/rir" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The RIR the aggregate will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the aggregate may need to be associated with</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>present</b> ←</div></li> + <li>absent</li> + </ul> + </td> + <td> + <div>The state of the aggregate</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox aggregate module" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create aggregate within Netbox with only required information + netbox_aggregate: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.0.0/16 + rir: Test RIR + state: present + + - name: Create aggregate with several specified options + netbox_aggregate: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.0.0/16 + rir: Test RIR + date_added: 1989-01-18 + description: Test description + tags: + - Schnozzberry + state: present + + - name: Delete aggregate within netbox + netbox_aggregate: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.0.0/16 + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-aggregate"></div> + <b>aggregate</b> + <a class="ansibleOptionLink" href="#return-aggregate" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cable/netbox.netbox.netbox_cable_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cable/netbox.netbox.netbox_cable_module.rst new file mode 100644 index 00000000..e8963bc4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cable/netbox.netbox.netbox_cable_module.rst @@ -0,0 +1,531 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_cable_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_cable -- Create, update or delete cables within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_cable`. + +.. version_added + +.. versionadded:: 0.3.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes cables from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the cable configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/color"></div> + <b>color</b> + <a class="ansibleOptionLink" href="#parameter-data/color" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The color of the cable</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/label"></div> + <b>label</b> + <a class="ansibleOptionLink" href="#parameter-data/label" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The label of the cable</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/length"></div> + <b>length</b> + <a class="ansibleOptionLink" href="#parameter-data/length" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The length of the cable</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/length_unit"></div> + <b>length_unit</b> + <a class="ansibleOptionLink" href="#parameter-data/length_unit" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>m</li> + <li>cm</li> + <li>ft</li> + <li>in</li> + </ul> + </td> + <td> + <div>The unit in which the length of the cable is measured</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/status"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-data/status" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>connected</li> + <li>planned</li> + <li>decommissioning</li> + </ul> + </td> + <td> + <div>The status of the cable</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/termination_a"></div> + <b>termination_a</b> + <a class="ansibleOptionLink" href="#parameter-data/termination_a" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The termination a</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/termination_a_type"></div> + <b>termination_a_type</b> + <a class="ansibleOptionLink" href="#parameter-data/termination_a_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>circuits.circuittermination</li> + <li>dcim.consoleport</li> + <li>dcim.consoleserverport</li> + <li>dcim.frontport</li> + <li>dcim.interface</li> + <li>dcim.powerfeed</li> + <li>dcim.poweroutlet</li> + <li>dcim.powerport</li> + <li>dcim.rearport</li> + </ul> + </td> + <td> + <div>The type of the termination a</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/termination_b"></div> + <b>termination_b</b> + <a class="ansibleOptionLink" href="#parameter-data/termination_b" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The termination b</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/termination_b_type"></div> + <b>termination_b_type</b> + <a class="ansibleOptionLink" href="#parameter-data/termination_b_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>circuits.circuittermination</li> + <li>dcim.consoleport</li> + <li>dcim.consoleserverport</li> + <li>dcim.frontport</li> + <li>dcim.interface</li> + <li>dcim.powerfeed</li> + <li>dcim.poweroutlet</li> + <li>dcim.powerport</li> + <li>dcim.rearport</li> + </ul> + </td> + <td> + <div>The type of the termination b</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>cat3</li> + <li>cat5</li> + <li>cat5e</li> + <li>cat6</li> + <li>cat6a</li> + <li>cat7</li> + <li>dac-active</li> + <li>dac-passive</li> + <li>mrj21-trunk</li> + <li>coaxial</li> + <li>mmf</li> + <li>mmf-om1</li> + <li>mmf-om2</li> + <li>mmf-om3</li> + <li>mmf-om4</li> + <li>smf</li> + <li>smf-os1</li> + <li>smf-os2</li> + <li>aoc</li> + <li>power</li> + </ul> + </td> + <td> + <div>The type of the cable</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create cable within Netbox with only required information + netbox_cable: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + state: present + + - name: Update cable with other fields + netbox_cable: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + type: mmf-om4 + status: planned + label: label123 + color: abcdef + length: 30 + length_unit: m + state: present + + - name: Delete cable within netbox + netbox_cable: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-cable"></div> + <b>cable</b> + <a class="ansibleOptionLink" href="#return-cable" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_circuit/netbox.netbox.netbox_circuit_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_circuit/netbox.netbox.netbox_circuit_module.rst new file mode 100644 index 00000000..afd5a080 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_circuit/netbox.netbox.netbox_circuit_module.rst @@ -0,0 +1,475 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_circuit_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_circuit -- Create, update or delete circuits within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_circuit`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes circuits from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the circuit configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/cid"></div> + <b>cid</b> + <a class="ansibleOptionLink" href="#parameter-data/cid" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The circuit id of the circuit</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/circuit_type"></div> + <b>circuit_type</b> + <a class="ansibleOptionLink" href="#parameter-data/circuit_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The circuit type of the circuit</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/comments"></div> + <b>comments</b> + <a class="ansibleOptionLink" href="#parameter-data/comments" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Comments related to circuit</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/commit_rate"></div> + <b>commit_rate</b> + <a class="ansibleOptionLink" href="#parameter-data/commit_rate" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Commit rate of the circuit (Kbps)</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Description of the circuit</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/install_date"></div> + <b>install_date</b> + <a class="ansibleOptionLink" href="#parameter-data/install_date" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The date the circuit was installed. e.g. YYYY-MM-DD</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/provider"></div> + <b>provider</b> + <a class="ansibleOptionLink" href="#parameter-data/provider" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The provider of the circuit</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/status"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-data/status" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The status of the circuit</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the device may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The tenant assigned to the circuit</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create circuit within Netbox with only required information + netbox_circuit: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + cid: Test Circuit + provider: Test Provider + circuit_type: Test Circuit Type + state: present + + - name: Update circuit with other fields + netbox_circuit: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + cid: Test-Circuit-1000 + provider: Test Provider + circuit_type: Test Circuit Type + status: Active + tenant: Test Tenant + install_date: "2018-12-25" + commit_rate: 10000 + description: Test circuit + comments: "FAST CIRCUIT" + state: present + + - name: Delete circuit within netbox + netbox_circuit: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + cid: Test-Circuit-1000 + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-circuit"></div> + <b>circuit</b> + <a class="ansibleOptionLink" href="#return-circuit" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_circuit_termination/netbox.netbox.netbox_circuit_termination_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_circuit_termination/netbox.netbox.netbox_circuit_termination_module.rst new file mode 100644 index 00000000..8c6324ef --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_circuit_termination/netbox.netbox.netbox_circuit_termination_module.rst @@ -0,0 +1,430 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_circuit_termination_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_circuit_termination -- Create, update or delete circuit terminations within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_circuit_termination`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes circuit terminations from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the circuit termination configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/circuit"></div> + <b>circuit</b> + <a class="ansibleOptionLink" href="#parameter-data/circuit" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The circuit to assign to circuit termination</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Description of the circuit termination</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/port_speed"></div> + <b>port_speed</b> + <a class="ansibleOptionLink" href="#parameter-data/port_speed" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The speed of the port (Kbps)</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/pp_info"></div> + <b>pp_info</b> + <a class="ansibleOptionLink" href="#parameter-data/pp_info" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Patch panel information</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#parameter-data/site" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The site the circuit termination will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/term_side"></div> + <b>term_side</b> + <a class="ansibleOptionLink" href="#parameter-data/term_side" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>A</li> + <li>Z</li> + </ul> + </td> + <td> + <div>The side of the circuit termination</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/upstream_speed"></div> + <b>upstream_speed</b> + <a class="ansibleOptionLink" href="#parameter-data/upstream_speed" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The upstream speed of the circuit termination</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/xconnect_id"></div> + <b>xconnect_id</b> + <a class="ansibleOptionLink" href="#parameter-data/xconnect_id" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The cross connect ID of the circuit termination</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create circuit termination within Netbox with only required information + netbox_circuit_termination: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + circuit: Test Circuit + term_side: A + site: Test Site + port_speed: 10000 + state: present + + - name: Update circuit termination with other fields + netbox_circuit_termination: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + circuit: Test Circuit + term_side: A + upstream_speed: 1000 + xconnect_id: 10X100 + pp_info: PP10-24 + description: "Test description" + state: present + + - name: Delete circuit termination within netbox + netbox_circuit_termination: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + circuit: Test Circuit + term_side: A + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-circuit_termination"></div> + <b>circuit_termination</b> + <a class="ansibleOptionLink" href="#return-circuit_termination" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_circuit_type/netbox.netbox.netbox_circuit_type_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_circuit_type/netbox.netbox.netbox_circuit_type_module.rst new file mode 100644 index 00000000..aa5d1aae --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_circuit_type/netbox.netbox.netbox_circuit_type_module.rst @@ -0,0 +1,314 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_circuit_type_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_circuit_type -- Create, update or delete circuit types within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_circuit_type`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes circuit types from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the circuit type configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the circuit type</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create type within Netbox with only required information + netbox_circuit_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Circuit Type + state: present + + - name: Delete circuit type within netbox + netbox_circuit_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Circuit Type + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-circuit_type"></div> + <b>circuit_type</b> + <a class="ansibleOptionLink" href="#return-circuit_type" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cluster/netbox.netbox.netbox_cluster_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cluster/netbox.netbox.netbox_cluster_module.rst new file mode 100644 index 00000000..1729499d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cluster/netbox.netbox.netbox_cluster_module.rst @@ -0,0 +1,432 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_cluster_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_cluster -- Create, update or delete clusters within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_cluster`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes clusters from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the cluster configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/cluster_group"></div> + <b>cluster_group</b> + <a class="ansibleOptionLink" href="#parameter-data/cluster_group" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>group of the cluster</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/cluster_type"></div> + <b>cluster_type</b> + <a class="ansibleOptionLink" href="#parameter-data/cluster_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>type of the cluster</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/comments"></div> + <b>comments</b> + <a class="ansibleOptionLink" href="#parameter-data/comments" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Comments that may include additional information in regards to the cluster</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the cluster</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#parameter-data/site" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Required if <em>state=present</em> and the cluster does not exist yet</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the cluster may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Tenant the cluster will be assigned to.</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create cluster within Netbox with only required information + netbox_cluster: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster + cluster_type: libvirt + state: present + + - name: Delete cluster within netbox + netbox_cluster: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster + state: absent + + - name: Create cluster with tags + netbox_cluster: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Another Test Cluster + cluster_type: libvirt + tags: + - Schnozzberry + state: present + + - name: Update the group and site of an existing cluster + netbox_cluster: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster + cluster_type: qemu + cluster_group: GROUP + site: SITE + state: present + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-cluster"></div> + <b>cluster</b> + <a class="ansibleOptionLink" href="#return-cluster" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Gaelle MANGIN (@gmangin) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cluster_group/netbox.netbox.netbox_cluster_group_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cluster_group/netbox.netbox.netbox_cluster_group_module.rst new file mode 100644 index 00000000..6c4b667e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cluster_group/netbox.netbox.netbox_cluster_group_module.rst @@ -0,0 +1,314 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_cluster_group_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_cluster_group -- Create, update or delete cluster groups within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_cluster_group`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes cluster groups from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the cluster group configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the cluster group</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create cluster group within Netbox with only required information + netbox_cluster_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster Group + state: present + + - name: Delete cluster within netbox + netbox_cluster_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster Group + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-cluster_group"></div> + <b>cluster_group</b> + <a class="ansibleOptionLink" href="#return-cluster_group" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cluster_type/netbox.netbox.netbox_cluster_type_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cluster_type/netbox.netbox.netbox_cluster_type_module.rst new file mode 100644 index 00000000..9608ef83 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_cluster_type/netbox.netbox.netbox_cluster_type_module.rst @@ -0,0 +1,314 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_cluster_type_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_cluster_type -- Create, update or delete cluster types within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_cluster_type`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes cluster types from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the cluster type configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the cluster type</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create cluster type within Netbox with only required information + netbox_cluster_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster Type + state: present + + - name: Delete cluster within netbox + netbox_cluster_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster Type + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-cluster_type"></div> + <b>cluster_type</b> + <a class="ansibleOptionLink" href="#return-cluster_type" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_port/netbox.netbox.netbox_console_port_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_port/netbox.netbox.netbox_console_port_module.rst new file mode 100644 index 00000000..87db81ae --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_port/netbox.netbox.netbox_console_port_module.rst @@ -0,0 +1,389 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_console_port_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_console_port -- Create, update or delete console ports within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_console_port`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes console ports from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the console port configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Description of the console port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device the console port is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the console port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the console port may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>de-9</li> + <li>db-25</li> + <li>rj-11</li> + <li>rj-12</li> + <li>rj-45</li> + <li>usb-a</li> + <li>usb-b</li> + <li>usb-c</li> + <li>usb-mini-a</li> + <li>usb-mini-b</li> + <li>usb-micro-a</li> + <li>usb-micro-b</li> + <li>other</li> + </ul> + </td> + <td> + <div>The type of the console port</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create console port within Netbox with only required information + netbox_console_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port + device: Test Device + state: present + + - name: Update console port with other fields + netbox_console_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port + device: Test Device + type: usb-a + description: console port description + state: present + + - name: Delete console port within netbox + netbox_console_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port + device: Test Device + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-console_port"></div> + <b>console_port</b> + <a class="ansibleOptionLink" href="#return-console_port" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_port_template/netbox.netbox.netbox_console_port_template_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_port_template/netbox.netbox.netbox_console_port_template_module.rst new file mode 100644 index 00000000..f726effe --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_port_template/netbox.netbox.netbox_console_port_template_module.rst @@ -0,0 +1,356 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_console_port_template_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_console_port_template -- Create, update or delete console port templates within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_console_port_template`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes console port templates from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the console port template configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device_type"></div> + <b>device_type</b> + <a class="ansibleOptionLink" href="#parameter-data/device_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device type the console port template is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the console port template</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>de-9</li> + <li>db-25</li> + <li>rj-11</li> + <li>rj-12</li> + <li>rj-45</li> + <li>usb-a</li> + <li>usb-b</li> + <li>usb-c</li> + <li>usb-mini-a</li> + <li>usb-mini-b</li> + <li>usb-micro-a</li> + <li>usb-micro-b</li> + <li>other</li> + </ul> + </td> + <td> + <div>The type of the console port template</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create console port template within Netbox with only required information + netbox_console_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port Template + device_type: Test Device Type + state: present + + - name: Update console port template with other fields + netbox_console_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port Template + device_type: Test Device Type + type: iec-60320-c6 + state: present + + - name: Delete console port template within netbox + netbox_console_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port Template + device_type: Test Device Type + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-console_port_template"></div> + <b>console_port_template</b> + <a class="ansibleOptionLink" href="#return-console_port_template" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_server_port/netbox.netbox.netbox_console_server_port_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_server_port/netbox.netbox.netbox_console_server_port_module.rst new file mode 100644 index 00000000..4a8910e7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_server_port/netbox.netbox.netbox_console_server_port_module.rst @@ -0,0 +1,389 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_console_server_port_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_console_server_port -- Create, update or delete console server ports within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_console_server_port`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes console server ports from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the console server port configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Description of the console server port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device the console server port is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the console server port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the console server port may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>de-9</li> + <li>db-25</li> + <li>rj-11</li> + <li>rj-12</li> + <li>rj-45</li> + <li>usb-a</li> + <li>usb-b</li> + <li>usb-c</li> + <li>usb-mini-a</li> + <li>usb-mini-b</li> + <li>usb-micro-a</li> + <li>usb-micro-b</li> + <li>other</li> + </ul> + </td> + <td> + <div>The type of the console server port</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create console server port within Netbox with only required information + netbox_console_server_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port + device: Test Device + state: present + + - name: Update console server port with other fields + netbox_console_server_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port + device: Test Device + type: usb-a + description: console server port description + state: present + + - name: Delete console server port within netbox + netbox_console_server_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port + device: Test Device + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-console_server_port"></div> + <b>console_server_port</b> + <a class="ansibleOptionLink" href="#return-console_server_port" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_server_port_template/netbox.netbox.netbox_console_server_port_template_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_server_port_template/netbox.netbox.netbox_console_server_port_template_module.rst new file mode 100644 index 00000000..cd0d3f4a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_console_server_port_template/netbox.netbox.netbox_console_server_port_template_module.rst @@ -0,0 +1,356 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_console_server_port_template_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_console_server_port_template -- Create, update or delete console server port templates within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_console_server_port_template`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes console server port templates from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the console server port template configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device_type"></div> + <b>device_type</b> + <a class="ansibleOptionLink" href="#parameter-data/device_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device type the console server port template is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the console server port template</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>de-9</li> + <li>db-25</li> + <li>rj-11</li> + <li>rj-12</li> + <li>rj-45</li> + <li>usb-a</li> + <li>usb-b</li> + <li>usb-c</li> + <li>usb-mini-a</li> + <li>usb-mini-b</li> + <li>usb-micro-a</li> + <li>usb-micro-b</li> + <li>other</li> + </ul> + </td> + <td> + <div>The type of the console server port template</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create console server port template within Netbox with only required information + netbox_console_server_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port Template + device_type: Test Device Type + state: present + + - name: Update console server port template with other fields + netbox_console_server_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port Template + device_type: Test Device Type + type: iec-60320-c6 + state: present + + - name: Delete console server port template within netbox + netbox_console_server_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port Template + device_type: Test Device Type + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-console_server_port_template"></div> + <b>console_server_port_template</b> + <a class="ansibleOptionLink" href="#return-console_server_port_template" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device/netbox.netbox.netbox_device_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device/netbox.netbox.netbox_device_module.rst new file mode 100644 index 00000000..3c104b49 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device/netbox.netbox.netbox_device_module.rst @@ -0,0 +1,680 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_device_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_device -- Create, update or delete devices within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_device`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes devices from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the device configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/asset_tag"></div> + <b>asset_tag</b> + <a class="ansibleOptionLink" href="#parameter-data/asset_tag" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Asset tag that is associated to the device</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/cluster"></div> + <b>cluster</b> + <a class="ansibleOptionLink" href="#parameter-data/cluster" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Cluster that the device will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/comments"></div> + <b>comments</b> + <a class="ansibleOptionLink" href="#parameter-data/comments" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Comments that may include additional information in regards to the device</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device_role"></div> + <b>device_role</b> + <a class="ansibleOptionLink" href="#parameter-data/device_role" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Required if <em>state=present</em> and the device does not exist yet</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device_type"></div> + <b>device_type</b> + <a class="ansibleOptionLink" href="#parameter-data/device_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Required if <em>state=present</em> and the device does not exist yet</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/face"></div> + <b>face</b> + <a class="ansibleOptionLink" href="#parameter-data/face" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>Front</li> + <li>front</li> + <li>Rear</li> + <li>rear</li> + </ul> + </td> + <td> + <div>Required if <em>rack</em> is defined</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/local_context_data"></div> + <b>local_context_data</b> + <a class="ansibleOptionLink" href="#parameter-data/local_context_data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Arbitrary JSON data to define the devices configuration variables.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the device</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/platform"></div> + <b>platform</b> + <a class="ansibleOptionLink" href="#parameter-data/platform" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The platform of the device</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/position"></div> + <b>position</b> + <a class="ansibleOptionLink" href="#parameter-data/position" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The position of the device in the rack defined above</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/primary_ip4"></div> + <b>primary_ip4</b> + <a class="ansibleOptionLink" href="#parameter-data/primary_ip4" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Primary IPv4 address assigned to the device</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/primary_ip6"></div> + <b>primary_ip6</b> + <a class="ansibleOptionLink" href="#parameter-data/primary_ip6" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Primary IPv6 address assigned to the device</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rack"></div> + <b>rack</b> + <a class="ansibleOptionLink" href="#parameter-data/rack" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The name of the rack to assign the device to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/serial"></div> + <b>serial</b> + <a class="ansibleOptionLink" href="#parameter-data/serial" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Serial number of the device</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#parameter-data/site" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Required if <em>state=present</em> and the device does not exist yet</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/status"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-data/status" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The status of the device</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the device may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The tenant that the device will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/vc_position"></div> + <b>vc_position</b> + <a class="ansibleOptionLink" href="#parameter-data/vc_position" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Position in the assigned virtual chassis</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/vc_priority"></div> + <b>vc_priority</b> + <a class="ansibleOptionLink" href="#parameter-data/vc_priority" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Priority in the assigned virtual chassis</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/virtual_chassis"></div> + <b>virtual_chassis</b> + <a class="ansibleOptionLink" href="#parameter-data/virtual_chassis" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Virtual chassis the device will be assigned to</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create device within Netbox with only required information + netbox_device: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Device + device_type: C9410R + device_role: Core Switch + site: Main + state: present + + - name: Create device within Netbox with empty string name to generate UUID + netbox_device: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: "" + device_type: C9410R + device_role: Core Switch + site: Main + state: present + + - name: Delete device within netbox + netbox_device: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Device + state: absent + + - name: Create device with tags + netbox_device: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Another Test Device + device_type: C9410R + device_role: Core Switch + site: Main + local_context_data: + bgp: "65000" + tags: + - Schnozzberry + state: present + + - name: Update the rack and position of an existing device + netbox_device: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Device + rack: Test Rack + position: 10 + face: Front + state: present + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#return-device" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) +- David Gomez (@amb1s1) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_bay/netbox.netbox.netbox_device_bay_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_bay/netbox.netbox.netbox_device_bay_module.rst new file mode 100644 index 00000000..95929206 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_bay/netbox.netbox.netbox_device_bay_module.rst @@ -0,0 +1,374 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_device_bay_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_device_bay -- Create, update or delete device bays within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_device_bay`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes device bays from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the device bay configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the device bay. This is supported on v2.6+ of Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The device the device bay will be associated to. The device type must be "parent".</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/installed_device"></div> + <b>installed_device</b> + <a class="ansibleOptionLink" href="#parameter-data/installed_device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The ddevice that will be installed into the bay. The device type must be "child".</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the device bay</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the device bay may need to be associated with</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create device bay within Netbox with only required information + netbox_device_bay: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: Test Nexus One + name: "Device Bay One" + state: present + + - name: Add device into device bay + netbox_device_bay: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: Test Nexus One + name: "Device Bay One" + description: "First child" + installed_device: Test Nexus Child One + state: absent + + - name: Delete device bay within netbox + netbox_device_bay: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Device Bay One + state: absent + + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-device_bay"></div> + <b>device_bay</b> + <a class="ansibleOptionLink" href="#return-device_bay" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_bay_template/netbox.netbox.netbox_device_bay_template_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_bay_template/netbox.netbox.netbox_device_bay_template_module.rst new file mode 100644 index 00000000..98a5fc9e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_bay_template/netbox.netbox.netbox_device_bay_template_module.rst @@ -0,0 +1,316 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_device_bay_template_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_device_bay_template -- Create, update or delete device bay templates within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_device_bay_template`. + +.. version_added + +.. versionadded:: 0.3.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes device bay templates from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the device bay template configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device_type"></div> + <b>device_type</b> + <a class="ansibleOptionLink" href="#parameter-data/device_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device type the device bay template will be associated to. The device type must be "parent".</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the device bay template</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create device bay template within Netbox with only required information + netbox_device_bay_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: device bay template One + device_type: Device Type One + state: present + + - name: Delete device bay template within netbox + netbox_device_bay_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: device bay template One + device_type: Device Type One + state: absent + + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-device_bay_template"></div> + <b>device_bay_template</b> + <a class="ansibleOptionLink" href="#return-device_bay_template" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_interface/netbox.netbox.netbox_device_interface_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_interface/netbox.netbox.netbox_device_interface_module.rst new file mode 100644 index 00000000..b674e4ae --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_interface/netbox.netbox.netbox_device_interface_module.rst @@ -0,0 +1,595 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_device_interface_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_device_interface -- Creates or removes interfaces on devices from Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_device_interface`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes interfaces from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the prefix configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the prefix</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Name of the device the interface will be associated with (case-sensitive)</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/enabled"></div> + <b>enabled</b> + <a class="ansibleOptionLink" href="#parameter-data/enabled" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Sets whether interface shows enabled or disabled</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/form_factor"></div> + <b>form_factor</b> + <a class="ansibleOptionLink" href="#parameter-data/form_factor" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Form factor of the interface: + ex. 1000Base-T (1GE), Virtual, 10GBASE-T (10GE) + This has to be specified exactly as what is found within UI</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/lag"></div> + <b>lag</b> + <a class="ansibleOptionLink" href="#parameter-data/lag" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Parent LAG interface will be a member of</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mac_address"></div> + <b>mac_address</b> + <a class="ansibleOptionLink" href="#parameter-data/mac_address" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The MAC address of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mgmt_only"></div> + <b>mgmt_only</b> + <a class="ansibleOptionLink" href="#parameter-data/mgmt_only" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>This interface is used only for out-of-band management</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mode"></div> + <b>mode</b> + <a class="ansibleOptionLink" href="#parameter-data/mode" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The mode of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mtu"></div> + <b>mtu</b> + <a class="ansibleOptionLink" href="#parameter-data/mtu" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The MTU of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the interface to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tagged_vlans"></div> + <b>tagged_vlans</b> + <a class="ansibleOptionLink" href="#parameter-data/tagged_vlans" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>A list of tagged VLANS to be assigned to interface. Mode must be set to either <code>Tagged</code> or <code>Tagged All</code></div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the prefix may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Form factor of the interface: + ex. 1000Base-T (1GE), Virtual, 10GBASE-T (10GE) + This has to be specified exactly as what is found within UI</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/untagged_vlan"></div> + <b>untagged_vlan</b> + <a class="ansibleOptionLink" href="#parameter-data/untagged_vlan" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The untagged VLAN to be assigned to interface</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-update_vc_child"></div> + <b>update_vc_child</b> + <a class="ansibleOptionLink" href="#parameter-update_vc_child" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>Use when master device is specified for <code>device</code> and the specified interface exists on a child device + and needs updated</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox interface module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create interface within Netbox with only required information + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + state: present + - name: Delete interface within netbox + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + state: absent + - name: Create LAG with several specified options + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: port-channel1 + type: Link Aggregation Group (LAG) + mtu: 1600 + mgmt_only: false + mode: Access + state: present + - name: Create interface and assign it to parent LAG + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + enabled: false + type: 1000Base-t (1GE) + lag: + name: port-channel1 + mtu: 1600 + mgmt_only: false + mode: Access + state: present + - name: Create interface as a trunk port + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet25 + enabled: false + type: 1000Base-t (1GE) + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + mtu: 1600 + mgmt_only: true + mode: Tagged + state: present + - name: Update interface on child device on virtual chassis + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet2/0/1 + enabled: false + update_vc_child: True + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-interface"></div> + <b>interface</b> + <a class="ansibleOptionLink" href="#return-interface" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_interface_template/netbox.netbox.netbox_device_interface_template_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_interface_template/netbox.netbox.netbox_device_interface_template_module.rst new file mode 100644 index 00000000..a6c0a6da --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_interface_template/netbox.netbox.netbox_device_interface_template_module.rst @@ -0,0 +1,354 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_device_interface_template_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_device_interface_template -- Creates or removes interfaces on devices from Netbox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_device_interface_template`. + +.. version_added + +.. versionadded:: 0.3.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes interfaces from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the prefix configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device_type"></div> + <b>device_type</b> + <a class="ansibleOptionLink" href="#parameter-data/device_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the device the interface template will be associated with (case-sensitive)</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mgmt_only"></div> + <b>mgmt_only</b> + <a class="ansibleOptionLink" href="#parameter-data/mgmt_only" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>This interface template is used only for out-of-band management</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the interface template to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Form factor of the interface: + ex. 1000Base-T (1GE), Virtual, 10GBASE-T (10GE) + This has to be specified exactly as what is found within UI</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox interface template module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create interface template within Netbox with only required information + netbox_device_interface_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + state: present + - name: Delete interface template within netbox + netbox_device_interface_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-interface_template"></div> + <b>interface_template</b> + <a class="ansibleOptionLink" href="#return-interface_template" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_role/netbox.netbox.netbox_device_role_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_role/netbox.netbox.netbox_device_role_module.rst new file mode 100644 index 00000000..a76ca2fa --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_role/netbox.netbox.netbox_device_role_module.rst @@ -0,0 +1,351 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_device_role_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_device_role -- Create, update or delete devices roles within Netbox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_device_role`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes devices roles from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the device role configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/color"></div> + <b>color</b> + <a class="ansibleOptionLink" href="#parameter-data/color" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Hexidecimal code for a color, ex. FFFFFF</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the device role</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/vm_role"></div> + <b>vm_role</b> + <a class="ansibleOptionLink" href="#parameter-data/vm_role" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Whether the role is a VM role</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create device role within Netbox with only required information + netbox_device_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test device role + color: FFFFFF + state: present + + - name: Delete device role within netbox + netbox_device_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rack role + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-device_role"></div> + <b>device_role</b> + <a class="ansibleOptionLink" href="#return-device_role" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_type/netbox.netbox.netbox_device_type_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_type/netbox.netbox.netbox_device_type_module.rst new file mode 100644 index 00000000..79493c29 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_device_type/netbox.netbox.netbox_device_type_module.rst @@ -0,0 +1,469 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_device_type_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_device_type -- Create, update or delete device types within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_device_type`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes device types from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the device type configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/comments"></div> + <b>comments</b> + <a class="ansibleOptionLink" href="#parameter-data/comments" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Comments that may include additional information in regards to the device_type</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/is_full_depth"></div> + <b>is_full_depth</b> + <a class="ansibleOptionLink" href="#parameter-data/is_full_depth" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Whether or not the device consumes both front and rear rack faces</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/manufacturer"></div> + <b>manufacturer</b> + <a class="ansibleOptionLink" href="#parameter-data/manufacturer" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The manufacturer of the device type</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/model"></div> + <b>model</b> + <a class="ansibleOptionLink" href="#parameter-data/model" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The model of the device type</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/part_number"></div> + <b>part_number</b> + <a class="ansibleOptionLink" href="#parameter-data/part_number" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The part number of the device type</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slug of the device type. Must follow slug formatting (URL friendly)</div> + <div>If not specified, it will slugify the model</div> + <div>ex. test-device-type</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/subdevice_role"></div> + <b>subdevice_role</b> + <a class="ansibleOptionLink" href="#parameter-data/subdevice_role" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>Parent</li> + <li>parent</li> + <li>Child</li> + <li>child</li> + </ul> + </td> + <td> + <div>Whether the device type is parent, child, or neither</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the device type may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/u_height"></div> + <b>u_height</b> + <a class="ansibleOptionLink" href="#parameter-data/u_height" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The height of the device type in rack units</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create device type within Netbox with only required information + netbox_device_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + slug: test-device-type + model: ws-test-3750 + manufacturer: Test Manufacturer + state: present + + - name: Create device type within Netbox with only required information + netbox_device_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + slug: test-device-type + model: ws-test-3750 + manufacturer: Test Manufacturer + part_number: ws-3750g-v2 + u_height: 1 + is_full_depth: False + subdevice_role: parent + state: present + + - name: Delete device type within netbox + netbox_device_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + slug: test-device-type + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-device_type"></div> + <b>device_type</b> + <a class="ansibleOptionLink" href="#return-device_type" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_front_port/netbox.netbox.netbox_front_port_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_front_port/netbox.netbox.netbox_front_port_module.rst new file mode 100644 index 00000000..7e14464a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_front_port/netbox.netbox.netbox_front_port_module.rst @@ -0,0 +1,428 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_front_port_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_front_port -- Create, update or delete front ports within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_front_port`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes front ports from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the front port configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Description of the front port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device the front port is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the front port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rear_port"></div> + <b>rear_port</b> + <a class="ansibleOptionLink" href="#parameter-data/rear_port" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The rear_port the front port is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rear_port_position"></div> + <b>rear_port_position</b> + <a class="ansibleOptionLink" href="#parameter-data/rear_port_position" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The position of the rear port this front port is connected to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the front port may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>8p8c</li> + <li>110-punch</li> + <li>bnc</li> + <li>mrj21</li> + <li>fc</li> + <li>lc</li> + <li>lc-apc</li> + <li>lsh</li> + <li>lsh-apc</li> + <li>mpo</li> + <li>mtrj</li> + <li>sc</li> + <li>sc-apc</li> + <li>st</li> + </ul> + </td> + <td> + <div>The type of the front port</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create front port within Netbox with only required information + netbox_front_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port + device: Test Device + type: bnc + rear_port: Test Rear Port + state: present + + - name: Update front port with other fields + netbox_front_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port + device: Test Device + type: bnc + rear_port: Test Rear Port + rear_port_position: 5 + description: front port description + state: present + + - name: Delete front port within netbox + netbox_front_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port + device: Test Device + type: bnc + rear_port: Test Rear Port + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-front_port"></div> + <b>front_port</b> + <a class="ansibleOptionLink" href="#return-front_port" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_front_port_template/netbox.netbox.netbox_front_port_template_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_front_port_template/netbox.netbox.netbox_front_port_template_module.rst new file mode 100644 index 00000000..e0669449 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_front_port_template/netbox.netbox.netbox_front_port_template_module.rst @@ -0,0 +1,395 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_front_port_template_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_front_port_template -- Create, update or delete front port templates within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_front_port_template`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes front port templates from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the front port template configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device_type"></div> + <b>device_type</b> + <a class="ansibleOptionLink" href="#parameter-data/device_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device type the front port template is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the front port template</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rear_port_template"></div> + <b>rear_port_template</b> + <a class="ansibleOptionLink" href="#parameter-data/rear_port_template" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The rear_port_template the front port template is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rear_port_template_position"></div> + <b>rear_port_template_position</b> + <a class="ansibleOptionLink" href="#parameter-data/rear_port_template_position" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The position of the rear port template this front port template is connected to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>8p8c</li> + <li>110-punch</li> + <li>bnc</li> + <li>mrj21</li> + <li>fc</li> + <li>lc</li> + <li>lc-apc</li> + <li>lsh</li> + <li>lsh-apc</li> + <li>mpo</li> + <li>mtrj</li> + <li>sc</li> + <li>sc-apc</li> + <li>st</li> + </ul> + </td> + <td> + <div>The type of the front port template</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create front port template within Netbox with only required information + netbox_front_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port Template + device_type: Test Device Type + type: bnc + rear_port_template: Test Rear Port Template + state: present + + - name: Update front port template with other fields + netbox_front_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port Template + device_type: Test Device Type + type: bnc + rear_port_template: Test Rear Port Template + rear_port_template_position: 5 + state: present + + - name: Delete front port template within netbox + netbox_front_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port Template + device_type: Test Device Type + type: bnc + rear_port_template: Test Rear Port Template + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-front_port_template"></div> + <b>front_port_template</b> + <a class="ansibleOptionLink" href="#return-front_port_template" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_interface/netbox.netbox.netbox_interface_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_interface/netbox.netbox.netbox_interface_module.rst new file mode 100644 index 00000000..48762f61 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_interface/netbox.netbox.netbox_interface_module.rst @@ -0,0 +1,539 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_interface_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_interface -- Creates or removes interfaces from Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_interface`. + +.. version_added + +.. versionadded:: 2.8 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes interfaces from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the prefix configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the prefix</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the device the interface will be associated with (case-sensitive)</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/enabled"></div> + <b>enabled</b> + <a class="ansibleOptionLink" href="#parameter-data/enabled" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Sets whether interface shows enabled or disabled</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/form_factor"></div> + <b>form_factor</b> + <a class="ansibleOptionLink" href="#parameter-data/form_factor" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Form factor of the interface: + ex. 1000Base-T (1GE), Virtual, 10GBASE-T (10GE) + This has to be specified exactly as what is found within UI</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/lag"></div> + <b>lag</b> + <a class="ansibleOptionLink" href="#parameter-data/lag" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Parent LAG interface will be a member of</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mac_address"></div> + <b>mac_address</b> + <a class="ansibleOptionLink" href="#parameter-data/mac_address" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The MAC address of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mgmt_only"></div> + <b>mgmt_only</b> + <a class="ansibleOptionLink" href="#parameter-data/mgmt_only" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>This interface is used only for out-of-band management</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mode"></div> + <b>mode</b> + <a class="ansibleOptionLink" href="#parameter-data/mode" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>Access</li> + <li>Tagged</li> + <li>Tagged All</li> + </ul> + </td> + <td> + <div>The mode of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mtu"></div> + <b>mtu</b> + <a class="ansibleOptionLink" href="#parameter-data/mtu" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The MTU of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the interface to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tagged_vlans"></div> + <b>tagged_vlans</b> + <a class="ansibleOptionLink" href="#parameter-data/tagged_vlans" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>A list of tagged VLANS to be assigned to interface. Mode must be set to either <code>Tagged</code> or <code>Tagged All</code></div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the prefix may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/untagged_vlan"></div> + <b>untagged_vlan</b> + <a class="ansibleOptionLink" href="#parameter-data/untagged_vlan" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>The untagged VLAN to be assigned to interface</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li><div style="color: blue"><b>yes</b> ←</div></li> + </ul> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox interface module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create interface within Netbox with only required information + netbox_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + state: present + - name: Delete interface within netbox + netbox_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + state: absent + - name: Create LAG with several specified options + netbox_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: port-channel1 + form_factor: Link Aggregation Group (LAG) + mtu: 1600 + mgmt_only: false + mode: Access + state: present + - name: Create interface and assign it to parent LAG + netbox_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + enabled: false + form_factor: 1000Base-t (1GE) + lag: + name: port-channel1 + mtu: 1600 + mgmt_only: false + mode: Access + state: present + - name: Create interface as a trunk port + netbox_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet25 + enabled: false + form_factor: 1000Base-t (1GE) + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + mtu: 1600 + mgmt_only: true + mode: Tagged + state: present + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-interface"></div> + <b>interface</b> + <a class="ansibleOptionLink" href="#return-interface" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_inventory_item/netbox.netbox.netbox_inventory_item_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_inventory_item/netbox.netbox.netbox_inventory_item_module.rst new file mode 100644 index 00000000..ff6885e5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_inventory_item/netbox.netbox.netbox_inventory_item_module.rst @@ -0,0 +1,445 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_inventory_item_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_inventory_item -- Creates or removes inventory items from Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_inventory_item`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes inventory items from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the inventory item configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/asset_tag"></div> + <b>asset_tag</b> + <a class="ansibleOptionLink" href="#parameter-data/asset_tag" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The asset tag of the inventory item</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the inventory item</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Name of the device the inventory item belongs to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/discovered"></div> + <b>discovered</b> + <a class="ansibleOptionLink" href="#parameter-data/discovered" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Set the discovery flag for the inventory item</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/manufacturer"></div> + <b>manufacturer</b> + <a class="ansibleOptionLink" href="#parameter-data/manufacturer" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The manufacturer of the inventory item</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the inventory item to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/part_id"></div> + <b>part_id</b> + <a class="ansibleOptionLink" href="#parameter-data/part_id" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The part ID of the inventory item</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/serial"></div> + <b>serial</b> + <a class="ansibleOptionLink" href="#parameter-data/serial" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The serial number of the inventory item</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the device may need to be associated with</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox inventory_item module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create inventory item within Netbox with only required information + netbox_inventory_item: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: "10G-SFP+" + state: present + + - name: Update inventory item + netbox_inventory_item: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: "10G-SFP+" + manufacturer: "Cisco" + part_id: "10G-SFP+" + serial: "1234" + asset_tag: "1234" + description: "New SFP" + state: present + + - name: Delete inventory item within netbox + netbox_inventory_item: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: "10G-SFP+" + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-inventory_item"></div> + <b>inventory_item</b> + <a class="ansibleOptionLink" href="#return-inventory_item" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_ip_address/netbox.netbox.netbox_ip_address_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_ip_address/netbox.netbox.netbox_ip_address_module.rst new file mode 100644 index 00000000..56059068 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_ip_address/netbox.netbox.netbox_ip_address_module.rst @@ -0,0 +1,660 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_ip_address_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_ip_address -- Creates or removes IP addresses from Netbox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_ip_address`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes IP addresses from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="3">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the IP address configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/address"></div> + <b>address</b> + <a class="ansibleOptionLink" href="#parameter-data/address" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Required if state is <code>present</code></div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/assigned_object"></div> + <b>assigned_object</b> + <a class="ansibleOptionLink" href="#parameter-data/assigned_object" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Definition of the assigned object.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/assigned_object/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/assigned_object/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The device the interface is attached to.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/assigned_object/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/assigned_object/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The name of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/assigned_object/virtual_machine"></div> + <b>virtual_machine</b> + <a class="ansibleOptionLink" href="#parameter-data/assigned_object/virtual_machine" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The virtual machine the interface is attached to.</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/dns_name"></div> + <b>dns_name</b> + <a class="ansibleOptionLink" href="#parameter-data/dns_name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Hostname or FQDN</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/family"></div> + <b>family</b> + <a class="ansibleOptionLink" href="#parameter-data/family" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>4</li> + <li>6</li> + </ul> + </td> + <td> + <div>Specifies with address family the IP address belongs to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/interface"></div> + <b>interface</b> + <a class="ansibleOptionLink" href="#parameter-data/interface" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The name and device of the interface that the IP address should be assigned to + Required if state is <code>present</code> and a prefix specified.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/nat_inside"></div> + <b>nat_inside</b> + <a class="ansibleOptionLink" href="#parameter-data/nat_inside" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The inside IP address this IP is assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/prefix"></div> + <b>prefix</b> + <a class="ansibleOptionLink" href="#parameter-data/prefix" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>With state <code>present</code>, if an interface is given, it will ensure + that an IP inside this prefix (and vrf, if given) is attached + to this interface. Otherwise, it will get the next available IP + of this prefix and attach it. + With state <code>new</code>, it will force to get the next available IP in + this prefix. If an interface is given, it will also force to attach + it. + Required if state is <code>present</code> or <code>new</code> when no address is given. + Unused if an address is specified.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/role"></div> + <b>role</b> + <a class="ansibleOptionLink" href="#parameter-data/role" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>Loopback</li> + <li>Secondary</li> + <li>Anycast</li> + <li>VIP</li> + <li>VRRP</li> + <li>HSRP</li> + <li>GLBP</li> + <li>CARP</li> + </ul> + </td> + <td> + <div>The role of the IP address</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/status"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-data/status" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The status of the IP address</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the IP address may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The tenant that the device will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data/vrf"></div> + <b>vrf</b> + <a class="ansibleOptionLink" href="#parameter-data/vrf" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>VRF that IP address is associated with</div> + </td> + </tr> + + <tr> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li>new</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code>, <code>new</code> or <code>absent</code> for adding, force adding or removing. + <code>present</code> will check if the IP is already created, and return it if + true. <code>new</code> will force to create it anyway (useful for anycasts, for + example).</div> + </td> + </tr> + <tr> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox IP address module" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create IP address within Netbox with only required information + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + address: 192.168.1.10 + state: present + - name: Force to create (even if it already exists) the IP + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + address: 192.168.1.10 + state: new + - name: Get a new available IP inside 192.168.1.0/24 + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.1.0/24 + state: new + - name: Delete IP address within netbox + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + address: 192.168.1.10 + state: absent + - name: Create IP address with several specified options + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + family: 4 + address: 192.168.1.20 + vrf: Test + tenant: Test Tenant + status: Reserved + role: Loopback + description: Test description + tags: + - Schnozzberry + state: present + - name: Create IP address and assign a nat_inside IP + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + family: 4 + address: 192.168.1.30 + vrf: Test + nat_inside: + address: 192.168.1.20 + vrf: Test + interface: + name: GigabitEthernet1 + device: test100 + - name: Ensure that an IP inside 192.168.1.0/24 is attached to GigabitEthernet1 + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.1.0/24 + vrf: Test + interface: + name: GigabitEthernet1 + device: test100 + state: present + - name: Attach a new available IP of 192.168.1.0/24 to GigabitEthernet1 + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.1.0/24 + vrf: Test + interface: + name: GigabitEthernet1 + device: test100 + state: new + - name: Attach a new available IP of 192.168.1.0/24 to GigabitEthernet1 (NetBox 2.9+) + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.1.0/24 + vrf: Test + assigned_object: + name: GigabitEthernet1 + device: test100 + state: new + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-ip_address"></div> + <b>ip_address</b> + <a class="ansibleOptionLink" href="#return-ip_address" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) +- Anthony Ruhier (@Anthony25) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_ipam_role/netbox.netbox.netbox_ipam_role_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_ipam_role/netbox.netbox.netbox_ipam_role_module.rst new file mode 100644 index 00000000..840dae60 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_ipam_role/netbox.netbox.netbox_ipam_role_module.rst @@ -0,0 +1,330 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_ipam_role_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_ipam_role -- Creates or removes ipam roles from Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_ipam_role`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes ipam roles from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the ipam role configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the ipam role to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/weight"></div> + <b>weight</b> + <a class="ansibleOptionLink" href="#parameter-data/weight" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The weight of the ipam role to be created</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create ipam role within Netbox with only required information + netbox_ipam_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test IPAM Role + state: present + + - name: Delete ipam role within netbox + netbox_ipam_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test IPAM Role + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-role"></div> + <b>role</b> + <a class="ansibleOptionLink" href="#return-role" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_manufacturer/netbox.netbox.netbox_manufacturer_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_manufacturer/netbox.netbox.netbox_manufacturer_module.rst new file mode 100644 index 00000000..e82e8a59 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_manufacturer/netbox.netbox.netbox_manufacturer_module.rst @@ -0,0 +1,314 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_manufacturer_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_manufacturer -- Create or delete manufacturers within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_manufacturer`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes manufacturers from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the manufacturer configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the manufacturer</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create manufacturer within Netbox with only required information + netbox_manufacturer: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Manufacturer + state: present + + - name: Delete manufacturer within netbox + netbox_manufacturer: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Manufacturer + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-manufacturer"></div> + <b>manufacturer</b> + <a class="ansibleOptionLink" href="#return-manufacturer" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_platform/netbox.netbox.netbox_platform_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_platform/netbox.netbox.netbox_platform_module.rst new file mode 100644 index 00000000..4a311ccd --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_platform/netbox.netbox.netbox_platform_module.rst @@ -0,0 +1,374 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_platform_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_platform -- Create or delete platforms within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_platform`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes platforms from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the platform configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/manufacturer"></div> + <b>manufacturer</b> + <a class="ansibleOptionLink" href="#parameter-data/manufacturer" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The manufacturer the platform will be tied to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the platform</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/napalm_args"></div> + <b>napalm_args</b> + <a class="ansibleOptionLink" href="#parameter-data/napalm_args" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>The optional arguments used for NAPALM connections</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/napalm_driver"></div> + <b>napalm_driver</b> + <a class="ansibleOptionLink" href="#parameter-data/napalm_driver" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The name of the NAPALM driver to be used when using the NAPALM plugin</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create platform within Netbox with only required information + netbox_platform: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Platform + state: present + + - name: Create platform within Netbox with only required information + netbox_platform: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Platform All + manufacturer: Test Manufacturer + napalm_driver: ios + napalm_args: + global_delay_factor: 2 + state: present + + - name: Delete platform within netbox + netbox_platform: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Platform + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-platform"></div> + <b>platform</b> + <a class="ansibleOptionLink" href="#return-platform" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_feed/netbox.netbox.netbox_power_feed_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_feed/netbox.netbox.netbox_power_feed_module.rst new file mode 100644 index 00000000..5258af81 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_feed/netbox.netbox.netbox_power_feed_module.rst @@ -0,0 +1,526 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_power_feed_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_power_feed -- Create, update or delete power feeds within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_power_feed`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes power feeds from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the power feed configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/amperage"></div> + <b>amperage</b> + <a class="ansibleOptionLink" href="#parameter-data/amperage" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The amperage of the power feed</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/comments"></div> + <b>comments</b> + <a class="ansibleOptionLink" href="#parameter-data/comments" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Comments related to the power feed</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/max_utilization"></div> + <b>max_utilization</b> + <a class="ansibleOptionLink" href="#parameter-data/max_utilization" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The maximum permissible draw of the power feed in percent</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the power feed</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/phase"></div> + <b>phase</b> + <a class="ansibleOptionLink" href="#parameter-data/phase" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>single-phase</li> + <li>three-phase</li> + </ul> + </td> + <td> + <div>The phase type of the power feed</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/power_panel"></div> + <b>power_panel</b> + <a class="ansibleOptionLink" href="#parameter-data/power_panel" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The power panel the power feed is terminated on</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rack"></div> + <b>rack</b> + <a class="ansibleOptionLink" href="#parameter-data/rack" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The rack the power feed is assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/status"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-data/status" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>offline</li> + <li>active</li> + <li>planned</li> + <li>failed</li> + </ul> + </td> + <td> + <div>The status of the power feed</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/supply"></div> + <b>supply</b> + <a class="ansibleOptionLink" href="#parameter-data/supply" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>ac</li> + <li>dc</li> + </ul> + </td> + <td> + <div>The supply type of the power feed</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the power feed may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>primary</li> + <li>redundant</li> + </ul> + </td> + <td> + <div>The type of the power feed</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/voltage"></div> + <b>voltage</b> + <a class="ansibleOptionLink" href="#parameter-data/voltage" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The voltage of the power feed</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power feed within Netbox with only required information + netbox_power_feed: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Feed + power_panel: Test Power Panel + state: present + + - name: Update power feed with other fields + netbox_power_feed: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Feed + power_panel: Test Power Panel + status: offline + type: primary + supply: ac + phase: single-phase + voltage: 230 + amperage: 16 + max_utilization: 80 + comments: normal power feed + state: present + + - name: Delete power feed within netbox + netbox_power_feed: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Feed + power_panel: Test Power Panel + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-power_feed"></div> + <b>power_feed</b> + <a class="ansibleOptionLink" href="#return-power_feed" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_outlet/netbox.netbox.netbox_power_outlet_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_outlet/netbox.netbox.netbox_power_outlet_module.rst new file mode 100644 index 00000000..5ef01072 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_outlet/netbox.netbox.netbox_power_outlet_module.rst @@ -0,0 +1,469 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_power_outlet_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_power_outlet -- Create, update or delete power outlets within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_power_outlet`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes power outlets from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the power outlet configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Description of the power outlet</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device the power outlet is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/feed_leg"></div> + <b>feed_leg</b> + <a class="ansibleOptionLink" href="#parameter-data/feed_leg" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>A</li> + <li>B</li> + <li>C</li> + </ul> + </td> + <td> + <div>The phase, in case of three-phase feed</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the power outlet</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/power_port"></div> + <b>power_port</b> + <a class="ansibleOptionLink" href="#parameter-data/power_port" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The attached power port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the power outlet may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>iec-60320-c5</li> + <li>iec-60320-c7</li> + <li>iec-60320-c13</li> + <li>iec-60320-c15</li> + <li>iec-60320-c19</li> + <li>iec-60309-p-n-e-4h</li> + <li>iec-60309-p-n-e-6h</li> + <li>iec-60309-p-n-e-9h</li> + <li>iec-60309-2p-e-4h</li> + <li>iec-60309-2p-e-6h</li> + <li>iec-60309-2p-e-9h</li> + <li>iec-60309-3p-e-4h</li> + <li>iec-60309-3p-e-6h</li> + <li>iec-60309-3p-e-9h</li> + <li>iec-60309-3p-n-e-4h</li> + <li>iec-60309-3p-n-e-6h</li> + <li>iec-60309-3p-n-e-9h</li> + <li>nema-5-15r</li> + <li>nema-5-20r</li> + <li>nema-5-30r</li> + <li>nema-5-50r</li> + <li>nema-6-15r</li> + <li>nema-6-20r</li> + <li>nema-6-30r</li> + <li>nema-6-50r</li> + <li>nema-l5-15r</li> + <li>nema-l5-20r</li> + <li>nema-l5-30r</li> + <li>nema-l5-50r</li> + <li>nema-l6-20r</li> + <li>nema-l6-30r</li> + <li>nema-l6-50r</li> + <li>nema-l14-20r</li> + <li>nema-l14-30r</li> + <li>nema-l21-20r</li> + <li>nema-l21-30r</li> + <li>CS6360C</li> + <li>CS6364C</li> + <li>CS8164C</li> + <li>CS8264C</li> + <li>CS8364C</li> + <li>CS8464C</li> + <li>ita-e</li> + <li>ita-f</li> + <li>ita-g</li> + <li>ita-h</li> + <li>ita-i</li> + <li>ita-j</li> + <li>ita-k</li> + <li>ita-l</li> + <li>ita-m</li> + <li>ita-n</li> + <li>ita-o</li> + <li>hdot-cx</li> + </ul> + </td> + <td> + <div>The type of the power outlet</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power port within Netbox with only required information + netbox_power_outlet: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device: Test Device + state: present + + - name: Update power port with other fields + netbox_power_outlet: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device: Test Device + type: iec-60320-c6 + power_port: Test Power Port + feed_leg: A + description: power port description + state: present + + - name: Delete power port within netbox + netbox_power_outlet: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device: Test Device + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-power_outlet"></div> + <b>power_outlet</b> + <a class="ansibleOptionLink" href="#return-power_outlet" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_outlet_template/netbox.netbox.netbox_power_outlet_template_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_outlet_template/netbox.netbox.netbox_power_outlet_template_module.rst new file mode 100644 index 00000000..7120f756 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_outlet_template/netbox.netbox.netbox_power_outlet_template_module.rst @@ -0,0 +1,436 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_power_outlet_template_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_power_outlet_template -- Create, update or delete power outlet templates within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_power_outlet_template`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes power outlet templates from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the power outlet configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device_type"></div> + <b>device_type</b> + <a class="ansibleOptionLink" href="#parameter-data/device_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device type the power outlet is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/feed_leg"></div> + <b>feed_leg</b> + <a class="ansibleOptionLink" href="#parameter-data/feed_leg" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>A</li> + <li>B</li> + <li>C</li> + </ul> + </td> + <td> + <div>The phase, in case of three-phase feed</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the power outlet</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/power_port"></div> + <b>power_port</b> + <a class="ansibleOptionLink" href="#parameter-data/power_port" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The attached power port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>iec-60320-c5</li> + <li>iec-60320-c7</li> + <li>iec-60320-c13</li> + <li>iec-60320-c15</li> + <li>iec-60320-c19</li> + <li>iec-60309-p-n-e-4h</li> + <li>iec-60309-p-n-e-6h</li> + <li>iec-60309-p-n-e-9h</li> + <li>iec-60309-2p-e-4h</li> + <li>iec-60309-2p-e-6h</li> + <li>iec-60309-2p-e-9h</li> + <li>iec-60309-3p-e-4h</li> + <li>iec-60309-3p-e-6h</li> + <li>iec-60309-3p-e-9h</li> + <li>iec-60309-3p-n-e-4h</li> + <li>iec-60309-3p-n-e-6h</li> + <li>iec-60309-3p-n-e-9h</li> + <li>nema-5-15r</li> + <li>nema-5-20r</li> + <li>nema-5-30r</li> + <li>nema-5-50r</li> + <li>nema-6-15r</li> + <li>nema-6-20r</li> + <li>nema-6-30r</li> + <li>nema-6-50r</li> + <li>nema-l5-15r</li> + <li>nema-l5-20r</li> + <li>nema-l5-30r</li> + <li>nema-l5-50r</li> + <li>nema-l6-20r</li> + <li>nema-l6-30r</li> + <li>nema-l6-50r</li> + <li>nema-l14-20r</li> + <li>nema-l14-30r</li> + <li>nema-l21-20r</li> + <li>nema-l21-30r</li> + <li>CS6360C</li> + <li>CS6364C</li> + <li>CS8164C</li> + <li>CS8264C</li> + <li>CS8364C</li> + <li>CS8464C</li> + <li>ita-e</li> + <li>ita-f</li> + <li>ita-g</li> + <li>ita-h</li> + <li>ita-i</li> + <li>ita-j</li> + <li>ita-k</li> + <li>ita-l</li> + <li>ita-m</li> + <li>ita-n</li> + <li>ita-o</li> + <li>hdot-cx</li> + </ul> + </td> + <td> + <div>The type of the power outlet</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power port within Netbox with only required information + netbox_power_outlet_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device_type: Test Device Type + state: present + + - name: Update power port with other fields + netbox_power_outlet_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device_type: Test Device Type + type: iec-60320-c6 + power_port: Test Power Port + feed_leg: A + state: present + + - name: Delete power port within netbox + netbox_power_outlet_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device_type: Test Device Type + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-power_outlet_template"></div> + <b>power_outlet_template</b> + <a class="ansibleOptionLink" href="#return-power_outlet_template" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_panel/netbox.netbox.netbox_power_panel_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_panel/netbox.netbox.netbox_power_panel_module.rst new file mode 100644 index 00000000..80c1373e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_panel/netbox.netbox.netbox_power_panel_module.rst @@ -0,0 +1,341 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_power_panel_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_power_panel -- Create, update or delete power panels within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_power_panel`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes power panels from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the power panel configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the power panel</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rack_group"></div> + <b>rack_group</b> + <a class="ansibleOptionLink" href="#parameter-data/rack_group" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The rack group the power panel is assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#parameter-data/site" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The site the power panel is located in</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power panel within Netbox with only required information + netbox_power_panel: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Panel + site: Test Site + state: present + + - name: Update power panel with other fields + netbox_power_panel: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Panel + site: Test Site + rack_group: Test Rack Group + state: present + + - name: Delete power panel within netbox + netbox_power_panel: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Panel + site: Test Site + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-power_panel"></div> + <b>power_panel</b> + <a class="ansibleOptionLink" href="#return-power_panel" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_port/netbox.netbox.netbox_power_port_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_port/netbox.netbox.netbox_power_port_module.rst new file mode 100644 index 00000000..05f61bc3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_port/netbox.netbox.netbox_power_port_module.rst @@ -0,0 +1,464 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_power_port_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_power_port -- Create, update or delete power ports within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_power_port`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes power ports from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the power port configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/allocated_draw"></div> + <b>allocated_draw</b> + <a class="ansibleOptionLink" href="#parameter-data/allocated_draw" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The allocated draw of the power port in watt</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Description of the power port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device the power port is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/maximum_draw"></div> + <b>maximum_draw</b> + <a class="ansibleOptionLink" href="#parameter-data/maximum_draw" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The maximum permissible draw of the power port in watt</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the power port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the power port may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>iec-60320-c6</li> + <li>iec-60320-c8</li> + <li>iec-60320-c14</li> + <li>iec-60320-c16</li> + <li>iec-60320-c20</li> + <li>iec-60309-p-n-e-4h</li> + <li>iec-60309-p-n-e-6h</li> + <li>iec-60309-p-n-e-9h</li> + <li>iec-60309-2p-e-4h</li> + <li>iec-60309-2p-e-6h</li> + <li>iec-60309-2p-e-9h</li> + <li>iec-60309-3p-e-4h</li> + <li>iec-60309-3p-e-6h</li> + <li>iec-60309-3p-e-9h</li> + <li>iec-60309-3p-n-e-4h</li> + <li>iec-60309-3p-n-e-6h</li> + <li>iec-60309-3p-n-e-9h</li> + <li>nema-5-15p</li> + <li>nema-5-20p</li> + <li>nema-5-30p</li> + <li>nema-5-50p</li> + <li>nema-6-15p</li> + <li>nema-6-20p</li> + <li>nema-6-30p</li> + <li>nema-6-50p</li> + <li>nema-l5-15p</li> + <li>nema-l5-20p</li> + <li>nema-l5-30p</li> + <li>nema-l5-50p</li> + <li>nema-l6-20p</li> + <li>nema-l6-30p</li> + <li>nema-l6-50p</li> + <li>nema-l14-20p</li> + <li>nema-l14-30p</li> + <li>nema-l21-20p</li> + <li>nema-l21-30p</li> + <li>cs6361c</li> + <li>cs6365c</li> + <li>cs8165c</li> + <li>cs8265c</li> + <li>cs8365c</li> + <li>cs8465c</li> + <li>ita-e</li> + <li>ita-f</li> + <li>ita-ef</li> + <li>ita-g</li> + <li>ita-h</li> + <li>ita-i</li> + <li>ita-j</li> + <li>ita-k</li> + <li>ita-l</li> + <li>ita-m</li> + <li>ita-n</li> + <li>ita-o</li> + </ul> + </td> + <td> + <div>The type of the power port</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power port within Netbox with only required information + netbox_power_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port + device: Test Device + state: present + + - name: Update power port with other fields + netbox_power_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port + device: Test Device + type: iec-60320-c6 + allocated_draw: 16 + maximum_draw: 80 + description: power port description + state: present + + - name: Delete power port within netbox + netbox_power_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port + device: Test Device + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-power_port"></div> + <b>power_port</b> + <a class="ansibleOptionLink" href="#return-power_port" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_port_template/netbox.netbox.netbox_power_port_template_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_port_template/netbox.netbox.netbox_power_port_template_module.rst new file mode 100644 index 00000000..b37572df --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_power_port_template/netbox.netbox.netbox_power_port_template_module.rst @@ -0,0 +1,431 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_power_port_template_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_power_port_template -- Create, update or delete power port templates within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_power_port_template`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes power port templates from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the power port configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/allocated_draw"></div> + <b>allocated_draw</b> + <a class="ansibleOptionLink" href="#parameter-data/allocated_draw" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The allocated draw of the power port in watt</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device_type"></div> + <b>device_type</b> + <a class="ansibleOptionLink" href="#parameter-data/device_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device type the power port is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/maximum_draw"></div> + <b>maximum_draw</b> + <a class="ansibleOptionLink" href="#parameter-data/maximum_draw" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The maximum permissible draw of the power port in watt</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the power port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>iec-60320-c6</li> + <li>iec-60320-c8</li> + <li>iec-60320-c14</li> + <li>iec-60320-c16</li> + <li>iec-60320-c20</li> + <li>iec-60309-p-n-e-4h</li> + <li>iec-60309-p-n-e-6h</li> + <li>iec-60309-p-n-e-9h</li> + <li>iec-60309-2p-e-4h</li> + <li>iec-60309-2p-e-6h</li> + <li>iec-60309-2p-e-9h</li> + <li>iec-60309-3p-e-4h</li> + <li>iec-60309-3p-e-6h</li> + <li>iec-60309-3p-e-9h</li> + <li>iec-60309-3p-n-e-4h</li> + <li>iec-60309-3p-n-e-6h</li> + <li>iec-60309-3p-n-e-9h</li> + <li>nema-5-15p</li> + <li>nema-5-20p</li> + <li>nema-5-30p</li> + <li>nema-5-50p</li> + <li>nema-6-15p</li> + <li>nema-6-20p</li> + <li>nema-6-30p</li> + <li>nema-6-50p</li> + <li>nema-l5-15p</li> + <li>nema-l5-20p</li> + <li>nema-l5-30p</li> + <li>nema-l5-50p</li> + <li>nema-l6-20p</li> + <li>nema-l6-30p</li> + <li>nema-l6-50p</li> + <li>nema-l14-20p</li> + <li>nema-l14-30p</li> + <li>nema-l21-20p</li> + <li>nema-l21-30p</li> + <li>cs6361c</li> + <li>cs6365c</li> + <li>cs8165c</li> + <li>cs8265c</li> + <li>cs8365c</li> + <li>cs8465c</li> + <li>ita-e</li> + <li>ita-f</li> + <li>ita-ef</li> + <li>ita-g</li> + <li>ita-h</li> + <li>ita-i</li> + <li>ita-j</li> + <li>ita-k</li> + <li>ita-l</li> + <li>ita-m</li> + <li>ita-n</li> + <li>ita-o</li> + </ul> + </td> + <td> + <div>The type of the power port</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power port within Netbox with only required information + netbox_power_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port Template + device_type: Test Device Type + state: present + + - name: Update power port with other fields + netbox_power_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port Template + device_type: Test Device Type + type: iec-60320-c6 + allocated_draw: 16 + maximum_draw: 80 + state: present + + - name: Delete power port within netbox + netbox_power_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port Template + device_type: Test Device Type + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-power_port_template"></div> + <b>power_port_template</b> + <a class="ansibleOptionLink" href="#return-power_port_template" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_prefix/netbox.netbox.netbox_prefix_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_prefix/netbox.netbox.netbox_prefix_module.rst new file mode 100644 index 00000000..ed148c86 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_prefix/netbox.netbox.netbox_prefix_module.rst @@ -0,0 +1,593 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_prefix_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_prefix -- Creates or removes prefixes from Netbox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_prefix`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes prefixes from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the prefix configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Must exist in Netbox and in key/value format</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the prefix</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/family"></div> + <b>family</b> + <a class="ansibleOptionLink" href="#parameter-data/family" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies which address family the prefix prefix belongs to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/is_pool"></div> + <b>is_pool</b> + <a class="ansibleOptionLink" href="#parameter-data/is_pool" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>All IP Addresses within this prefix are considered usable</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/parent"></div> + <b>parent</b> + <a class="ansibleOptionLink" href="#parameter-data/parent" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Required if state is <code>present</code> and first_available is <code>yes</code>. Will get a new available prefix in this parent prefix.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/prefix"></div> + <b>prefix</b> + <a class="ansibleOptionLink" href="#parameter-data/prefix" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Required if state is <code>present</code> and first_available is False. Will allocate or free this prefix.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/prefix_length"></div> + <b>prefix_length</b> + <a class="ansibleOptionLink" href="#parameter-data/prefix_length" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Required ONLY if state is <code>present</code> and first_available is <code>yes</code>. + Will get a new available prefix of the given prefix_length in this parent prefix.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/prefix_role"></div> + <b>prefix_role</b> + <a class="ansibleOptionLink" href="#parameter-data/prefix_role" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The role of the prefix</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#parameter-data/site" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Site that prefix is associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/status"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-data/status" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The status of the prefix</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the prefix may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The tenant that the prefix will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/vlan"></div> + <b>vlan</b> + <a class="ansibleOptionLink" href="#parameter-data/vlan" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The VLAN the prefix will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/vrf"></div> + <b>vrf</b> + <a class="ansibleOptionLink" href="#parameter-data/vrf" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>VRF that prefix is associated with</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-first_available"></div> + <b>first_available</b> + <a class="ansibleOptionLink" href="#parameter-first_available" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>If <code>yes</code> and state <code>present</code>, if an parent is given, it will get the first available prefix of the given prefix_length inside the given parent (and vrf, if given). Unused with state <code>absent</code>.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox prefix module" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create prefix within Netbox with only required information + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 10.156.0.0/19 + state: present + + - name: Delete prefix within netbox + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 10.156.0.0/19 + state: absent + + - name: Create prefix with several specified options + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + family: 4 + prefix: 10.156.32.0/19 + site: Test Site + vrf: Test VRF + tenant: Test Tenant + vlan: + name: Test VLAN + site: Test Site + tenant: Test Tenant + vlan_group: Test Vlan Group + status: Reserved + prefix_role: Network of care + description: Test description + is_pool: true + tags: + - Schnozzberry + state: present + + - name: Get a new /24 inside 10.156.0.0/19 within Netbox - Parent doesn't exist + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + parent: 10.156.0.0/19 + prefix_length: 24 + state: present + first_available: yes + + - name: Create prefix within Netbox with only required information + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 10.156.0.0/19 + state: present + + - name: Get a new /24 inside 10.156.0.0/19 within Netbox + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + parent: 10.156.0.0/19 + prefix_length: 24 + state: present + first_available: yes + + - name: Get a new /24 inside 10.157.0.0/19 within Netbox with additional values + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + parent: 10.157.0.0/19 + prefix_length: 24 + vrf: Test VRF + site: Test Site + state: present + first_available: yes + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-prefix"></div> + <b>prefix</b> + <a class="ansibleOptionLink" href="#return-prefix" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) +- Anthony Ruhier (@Anthony25) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_provider/netbox.netbox.netbox_provider_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_provider/netbox.netbox.netbox_provider_module.rst new file mode 100644 index 00000000..1678da33 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_provider/netbox.netbox.netbox_provider_module.rst @@ -0,0 +1,439 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_provider_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_provider -- Create, update or delete providers within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_provider`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes providers from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the provider configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/account"></div> + <b>account</b> + <a class="ansibleOptionLink" href="#parameter-data/account" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The account number of the provider</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/admin_contact"></div> + <b>admin_contact</b> + <a class="ansibleOptionLink" href="#parameter-data/admin_contact" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The admin contact of the provider</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/asn"></div> + <b>asn</b> + <a class="ansibleOptionLink" href="#parameter-data/asn" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The provider ASN</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/comments"></div> + <b>comments</b> + <a class="ansibleOptionLink" href="#parameter-data/comments" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Comments related to the provider</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The name of the provider</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/noc_contact"></div> + <b>noc_contact</b> + <a class="ansibleOptionLink" href="#parameter-data/noc_contact" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The NOC contact of the provider</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/portal_url"></div> + <b>portal_url</b> + <a class="ansibleOptionLink" href="#parameter-data/portal_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The URL of the provider</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the device may need to be associated with</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create provider within Netbox with only required information + netbox_provider: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Provider + state: present + + - name: Update provider with other fields + netbox_provider: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Provider + asn: 65001 + account: 200129104 + portal_url: http://provider.net + noc_contact: noc@provider.net + admin_contact: admin@provider.net + comments: "BAD PROVIDER" + state: present + + - name: Delete provider within netbox + netbox_provider: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Provider + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-provider"></div> + <b>provider</b> + <a class="ansibleOptionLink" href="#return-provider" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rack/netbox.netbox.netbox_rack_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rack/netbox.netbox.netbox_rack_module.rst new file mode 100644 index 00000000..41422998 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rack/netbox.netbox.netbox_rack_module.rst @@ -0,0 +1,607 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_rack_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_rack -- Create, update or delete racks within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_rack`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes racks from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the rack configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/asset_tag"></div> + <b>asset_tag</b> + <a class="ansibleOptionLink" href="#parameter-data/asset_tag" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Asset tag that is associated to the rack</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/comments"></div> + <b>comments</b> + <a class="ansibleOptionLink" href="#parameter-data/comments" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Comments that may include additional information in regards to the rack</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/desc_units"></div> + <b>desc_units</b> + <a class="ansibleOptionLink" href="#parameter-data/desc_units" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Rack units will be numbered top-to-bottom</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/facility_id"></div> + <b>facility_id</b> + <a class="ansibleOptionLink" href="#parameter-data/facility_id" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The unique rack ID assigned by the facility</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the rack</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/outer_depth"></div> + <b>outer_depth</b> + <a class="ansibleOptionLink" href="#parameter-data/outer_depth" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The outer depth of the rack</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/outer_unit"></div> + <b>outer_unit</b> + <a class="ansibleOptionLink" href="#parameter-data/outer_unit" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>Millimeters</li> + <li>Inches</li> + </ul> + </td> + <td> + <div>Whether the rack unit is in Millimeters or Inches and is <em>required</em> if outer_width/outer_depth is specified</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/outer_width"></div> + <b>outer_width</b> + <a class="ansibleOptionLink" href="#parameter-data/outer_width" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The outer width of the rack</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rack_group"></div> + <b>rack_group</b> + <a class="ansibleOptionLink" href="#parameter-data/rack_group" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The rack group the rack will be associated to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rack_role"></div> + <b>rack_role</b> + <a class="ansibleOptionLink" href="#parameter-data/rack_role" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The rack role the rack will be associated to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/serial"></div> + <b>serial</b> + <a class="ansibleOptionLink" href="#parameter-data/serial" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Serial number of the rack</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#parameter-data/site" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Required if <em>state=present</em> and the rack does not exist yet</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/status"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-data/status" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The status of the rack</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the rack may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The tenant that the device will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>2-post frame</li> + <li>4-post frame</li> + <li>4-post cabinet</li> + <li>Wall-mounted frame</li> + <li>Wall-mounted cabinet</li> + </ul> + </td> + <td> + <div>The type of rack</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/u_height"></div> + <b>u_height</b> + <a class="ansibleOptionLink" href="#parameter-data/u_height" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The height of the rack in rack units</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/width"></div> + <b>width</b> + <a class="ansibleOptionLink" href="#parameter-data/width" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>10</li> + <li>19</li> + <li>21</li> + <li>23</li> + </ul> + </td> + <td> + <div>The rail-to-rail width</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create rack within Netbox with only required information + netbox_rack: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test rack + site: Test Site + state: present + + - name: Delete rack within netbox + netbox_rack: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rack + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-rack"></div> + <b>rack</b> + <a class="ansibleOptionLink" href="#return-rack" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rack_group/netbox.netbox.netbox_rack_group_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rack_group/netbox.netbox.netbox_rack_group_module.rst new file mode 100644 index 00000000..0c834183 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rack_group/netbox.netbox.netbox_rack_group_module.rst @@ -0,0 +1,332 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_rack_group_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_rack_group -- Create, update or delete racks groups within Netbox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_rack_group`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes racks groups from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the rack group configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the rack group</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#parameter-data/site" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Required if <em>state=present</em> and the rack does not exist yet</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create rack group within Netbox with only required information + netbox_rack_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test rack group + site: Test Site + state: present + + - name: Delete rack group within netbox + netbox_rack_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rack group + site: Test Site + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-rack_group"></div> + <b>rack_group</b> + <a class="ansibleOptionLink" href="#return-rack_group" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rack_role/netbox.netbox.netbox_rack_role_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rack_role/netbox.netbox.netbox_rack_role_module.rst new file mode 100644 index 00000000..4c5a03a6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rack_role/netbox.netbox.netbox_rack_role_module.rst @@ -0,0 +1,331 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_rack_role_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_rack_role -- Create, update or delete racks roles within Netbox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_rack_role`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes racks roles from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the rack role configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/color"></div> + <b>color</b> + <a class="ansibleOptionLink" href="#parameter-data/color" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Hexidecimal code for a color, ex. FFFFFF</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the rack role</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create rack role within Netbox with only required information + netbox_rack_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test rack role + color: FFFFFF + state: present + + - name: Delete rack role within netbox + netbox_rack_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rack role + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-rack_role"></div> + <b>rack_role</b> + <a class="ansibleOptionLink" href="#return-rack_role" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rear_port/netbox.netbox.netbox_rear_port_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rear_port/netbox.netbox.netbox_rear_port_module.rst new file mode 100644 index 00000000..0a08e741 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rear_port/netbox.netbox.netbox_rear_port_module.rst @@ -0,0 +1,409 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_rear_port_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_rear_port -- Create, update or delete rear ports within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_rear_port`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes rear ports from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the rear port configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Description of the rear port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device the rear port is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the rear port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/positions"></div> + <b>positions</b> + <a class="ansibleOptionLink" href="#parameter-data/positions" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The number of front ports which may be mapped to each rear port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the rear port may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>8p8c</li> + <li>110-punch</li> + <li>bnc</li> + <li>mrj21</li> + <li>fc</li> + <li>lc</li> + <li>lc-apc</li> + <li>lsh</li> + <li>lsh-apc</li> + <li>mpo</li> + <li>mtrj</li> + <li>sc</li> + <li>sc-apc</li> + <li>st</li> + </ul> + </td> + <td> + <div>The type of the rear port</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create rear port within Netbox with only required information + netbox_rear_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port + device: Test Device + type: bnc + state: present + + - name: Update rear port with other fields + netbox_rear_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port + device: Test Device + type: bnc + positions: 5 + description: rear port description + state: present + + - name: Delete rear port within netbox + netbox_rear_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port + device: Test Device + type: bnc + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-rear_port"></div> + <b>rear_port</b> + <a class="ansibleOptionLink" href="#return-rear_port" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rear_port_template/netbox.netbox.netbox_rear_port_template_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rear_port_template/netbox.netbox.netbox_rear_port_template_module.rst new file mode 100644 index 00000000..4ef6cc1c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rear_port_template/netbox.netbox.netbox_rear_port_template_module.rst @@ -0,0 +1,376 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_rear_port_template_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_rear_port_template -- Create, update or delete rear port templates within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_rear_port_template`. + +.. version_added + +.. versionadded:: 0.2.3 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes rear port templates from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the rear port template configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device_type"></div> + <b>device_type</b> + <a class="ansibleOptionLink" href="#parameter-data/device_type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The device type the rear port template is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the rear port template</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/positions"></div> + <b>positions</b> + <a class="ansibleOptionLink" href="#parameter-data/positions" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The number of front ports which may be mapped to each rear port</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/type"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-data/type" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>8p8c</li> + <li>110-punch</li> + <li>bnc</li> + <li>mrj21</li> + <li>fc</li> + <li>lc</li> + <li>lc-apc</li> + <li>lsh</li> + <li>lsh-apc</li> + <li>mpo</li> + <li>mtrj</li> + <li>sc</li> + <li>sc-apc</li> + <li>st</li> + </ul> + </td> + <td> + <div>The type of the rear port</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create rear port template within Netbox with only required information + netbox_rear_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port Template + device_type: Test Device Type + type: bnc + state: present + + - name: Update rear port template with other fields + netbox_rear_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port Template + device_type: Test Device Type + type: bnc + positions: 5 + state: present + + - name: Delete rear port template within netbox + netbox_rear_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port Template + device_type: Test Device Type + type: bnc + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-rear_port_template"></div> + <b>rear_port_template</b> + <a class="ansibleOptionLink" href="#return-rear_port_template" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_region/netbox.netbox.netbox_region_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_region/netbox.netbox.netbox_region_module.rst new file mode 100644 index 00000000..07064b9f --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_region/netbox.netbox.netbox_region_module.rst @@ -0,0 +1,330 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_region_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_region -- Creates or removes regions from Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_region`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes regions from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the region configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the region to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/parent_region"></div> + <b>parent_region</b> + <a class="ansibleOptionLink" href="#parameter-data/parent_region" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The parent region this region should be tied to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox region module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create tenant within Netbox with only required information + netbox_region: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: "Test Region One" + state: present + + - name: Delete tenant within netbox + netbox_region: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant Group ABC + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-region"></div> + <b>region</b> + <a class="ansibleOptionLink" href="#return-region" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rir/netbox.netbox.netbox_rir_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rir/netbox.netbox.netbox_rir_module.rst new file mode 100644 index 00000000..d9786a21 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_rir/netbox.netbox.netbox_rir_module.rst @@ -0,0 +1,343 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_rir_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_rir -- Create, update or delete RIRs within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_rir`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes RIRs from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the RIR configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/is_private"></div> + <b>is_private</b> + <a class="ansibleOptionLink" href="#parameter-data/is_private" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>IP space managed by this RIR is considered private</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the RIR</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create RIR within Netbox with only required information + netbox_rir: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test RIR One + state: present + + - name: Update Test RIR One + netbox_rir: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test RIR One + is_private: True + state: present + + - name: Delete RIR within netbox + netbox_rir: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test RIR One + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-rir"></div> + <b>rir</b> + <a class="ansibleOptionLink" href="#return-rir" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_service/netbox.netbox.netbox_service_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_service/netbox.netbox.netbox_service_module.rst new file mode 100644 index 00000000..ab9a0dbe --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_service/netbox.netbox.netbox_service_module.rst @@ -0,0 +1,396 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_service_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_service -- Creates or removes service from Netbox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_service`. + +.. version_added + +.. versionadded:: 0.1.5 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes service from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the service configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Must exist in Netbox and in key/value format</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Service description</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/device"></div> + <b>device</b> + <a class="ansibleOptionLink" href="#parameter-data/device" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies on which device the service is running</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/ipaddresses"></div> + <b>ipaddresses</b> + <a class="ansibleOptionLink" href="#parameter-data/ipaddresses" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies which IPaddresses to associate with service.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the region to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/port"></div> + <b>port</b> + <a class="ansibleOptionLink" href="#parameter-data/port" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Specifies which port used by service</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/protocol"></div> + <b>protocol</b> + <a class="ansibleOptionLink" href="#parameter-data/protocol" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Specifies which protocol used by service</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>What tags to add/update</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/virtual_machine"></div> + <b>virtual_machine</b> + <a class="ansibleOptionLink" href="#parameter-data/virtual_machine" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies on which virtual machine the service is running</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Create netbox service" + connection: local + hosts: all + gather_facts: False + + tasks: + - name: Create service + netbox_service: + netbox_url: netbox_url + netbox_token: netbox_token + data: + device: Test666 + name: node-exporter + port: 9100 + protocol: TCP + ipaddresses: + - address: 127.0.0.1 + tags: + - prometheus + state: present + + - name: "Delete netbox service" + connection: local + hosts: all + gather_facts: False + + tasks: + - name: Delete service + netbox_service: + netbox_url: netbox_url + netbox_token: netbox_token + data: + device: Test666 + name: node-exporter + port: 9100 + protocol: TCP + state: absent + + + + +.. Facts + + +.. Return values + + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Kulakov Ilya (@TawR1024) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_site/netbox.netbox.netbox_site_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_site/netbox.netbox.netbox_site_module.rst new file mode 100644 index 00000000..7ae56032 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_site/netbox.netbox.netbox_site_module.rst @@ -0,0 +1,609 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_site_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_site -- Creates or removes sites from Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_site`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes sites from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the site configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/asn"></div> + <b>asn</b> + <a class="ansibleOptionLink" href="#parameter-data/asn" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The ASN associated with the site</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/comments"></div> + <b>comments</b> + <a class="ansibleOptionLink" href="#parameter-data/comments" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Comments for the site. This can be markdown syntax</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/contact_email"></div> + <b>contact_email</b> + <a class="ansibleOptionLink" href="#parameter-data/contact_email" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Contact email for site</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/contact_name"></div> + <b>contact_name</b> + <a class="ansibleOptionLink" href="#parameter-data/contact_name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Name of contact for site</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/contact_phone"></div> + <b>contact_phone</b> + <a class="ansibleOptionLink" href="#parameter-data/contact_phone" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Contact phone number for site</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the prefix</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/facility"></div> + <b>facility</b> + <a class="ansibleOptionLink" href="#parameter-data/facility" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Data center provider or facility, ex. Equinix NY7</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/latitude"></div> + <b>latitude</b> + <a class="ansibleOptionLink" href="#parameter-data/latitude" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">float</span> + </div> + </td> + <td> + </td> + <td> + <div>Latitude in decimal format</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/longitude"></div> + <b>longitude</b> + <a class="ansibleOptionLink" href="#parameter-data/longitude" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">float</span> + </div> + </td> + <td> + </td> + <td> + <div>Longitude in decimal format</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the site to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/physical_address"></div> + <b>physical_address</b> + <a class="ansibleOptionLink" href="#parameter-data/physical_address" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Physical address of site</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/region"></div> + <b>region</b> + <a class="ansibleOptionLink" href="#parameter-data/region" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The region that the site should be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/shipping_address"></div> + <b>shipping_address</b> + <a class="ansibleOptionLink" href="#parameter-data/shipping_address" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Shipping address of site</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>URL-friendly unique shorthand</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/status"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-data/status" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Status of the site</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the prefix may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The tenant the site will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/time_zone"></div> + <b>time_zone</b> + <a class="ansibleOptionLink" href="#parameter-data/time_zone" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Timezone associated with the site, ex. America/Denver</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox site module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create site within Netbox with only required information + netbox_site: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test - Colorado + state: present + + - name: Delete site within netbox + netbox_site: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test - Colorado + state: absent + + - name: Create site with all parameters + netbox_site: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test - California + status: Planned + region: Test Region + tenant: Test Tenant + facility: EquinoxCA7 + asn: 65001 + time_zone: America/Los Angeles + description: This is a test description + 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@changednumber.com + slug: test-california + comments: ### Placeholder + state: present + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#return-site" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_tenant/netbox.netbox.netbox_tenant_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_tenant/netbox.netbox.netbox_tenant_module.rst new file mode 100644 index 00000000..1c5dcbfe --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_tenant/netbox.netbox.netbox_tenant_module.rst @@ -0,0 +1,409 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_tenant_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_tenant -- Creates or removes tenants from Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_tenant`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes tenants from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the tenant configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/comments"></div> + <b>comments</b> + <a class="ansibleOptionLink" href="#parameter-data/comments" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Comments for the tenant. This can be markdown syntax</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the tenant</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the tenant to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>URL-friendly unique shorthand</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the tenant may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant_group"></div> + <b>tenant_group</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant_group" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Tenant group this tenant should be in</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create tenant within Netbox with only required information + netbox_tenant: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant ABC + state: present + + - name: Delete tenant within netbox + netbox_tenant: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant ABC + state: absent + + - name: Create tenant with all parameters + netbox_tenant: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant ABC + group: Very Special Tenants + description: ABC Incorporated + comments: '### This tenant is super cool' + slug: tenant_abc + tags: + - tagA + - tagB + - tagC + state: present + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#return-tenant" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Amy Liebowitz (@amylieb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_tenant_group/netbox.netbox.netbox_tenant_group_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_tenant_group/netbox.netbox.netbox_tenant_group_module.rst new file mode 100644 index 00000000..f8194304 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_tenant_group/netbox.netbox.netbox_tenant_group_module.rst @@ -0,0 +1,315 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_tenant_group_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_tenant_group -- Creates or removes tenant groups from Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_tenant_group`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes tenant groups from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the tenant group configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the tenant group to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>URL-friendly unique shorthand</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox tenant group module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create tenant within Netbox with only required information + netbox_tenant_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant Group ABC + slug: "tenant_group_abc" + state: present + + - name: Delete tenant within netbox + netbox_tenant_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant ABC + state: absent + + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-tenant_group"></div> + <b>tenant_group</b> + <a class="ansibleOptionLink" href="#return-tenant_group" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_virtual_chassis/netbox.netbox.netbox_virtual_chassis_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_virtual_chassis/netbox.netbox.netbox_virtual_chassis_module.rst new file mode 100644 index 00000000..6c013e3d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_virtual_chassis/netbox.netbox.netbox_virtual_chassis_module.rst @@ -0,0 +1,355 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_virtual_chassis_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_virtual_chassis -- Create, update or delete virtual chassis within Netbox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_virtual_chassis`. + +.. version_added + +.. versionadded:: 0.3.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes virtual chassis from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the virtual chassis configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/domain"></div> + <b>domain</b> + <a class="ansibleOptionLink" href="#parameter-data/domain" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>domain of the virtual chassis</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/master"></div> + <b>master</b> + <a class="ansibleOptionLink" href="#parameter-data/master" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The master device the virtual chassis is attached to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Name</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the virtual chassis may need to be associated with</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create virtual chassis within Netbox with only required information + netbox_virtual_chassis: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: "Virtual Chassis 1" + master: Test Device + state: present + + - name: Update virtual chassis with other fields + netbox_virtual_chassis: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + master: Test Device + domain: Domain Text + state: present + + - name: Delete virtual chassis within netbox + netbox_virtual_chassis: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + master: Test Device + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-virtual_chassis"></div> + <b>virtual_chassis</b> + <a class="ansibleOptionLink" href="#return-virtual_chassis" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Tobias Groß (@toerb) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_virtual_machine/netbox.netbox.netbox_virtual_machine_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_virtual_machine/netbox.netbox.netbox_virtual_machine_module.rst new file mode 100644 index 00000000..bb1353d6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_virtual_machine/netbox.netbox.netbox_virtual_machine_module.rst @@ -0,0 +1,529 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_virtual_machine_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_virtual_machine -- Create, update or delete virtual_machines within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_virtual_machine`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes virtual_machines from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the virtual machine configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/cluster"></div> + <b>cluster</b> + <a class="ansibleOptionLink" href="#parameter-data/cluster" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The name of the cluster attach to the virtual machine</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/disk"></div> + <b>disk</b> + <a class="ansibleOptionLink" href="#parameter-data/disk" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Disk of the virtual machine (GB)</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/memory"></div> + <b>memory</b> + <a class="ansibleOptionLink" href="#parameter-data/memory" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Memory of the virtual machine (MB)</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the virtual machine</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/platform"></div> + <b>platform</b> + <a class="ansibleOptionLink" href="#parameter-data/platform" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The platform of the virtual machine</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/primary_ip4"></div> + <b>primary_ip4</b> + <a class="ansibleOptionLink" href="#parameter-data/primary_ip4" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Primary IPv4 address assigned to the virtual machine</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/primary_ip6"></div> + <b>primary_ip6</b> + <a class="ansibleOptionLink" href="#parameter-data/primary_ip6" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Primary IPv6 address assigned to the virtual machine</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#parameter-data/site" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The name of the site attach to the virtual machine</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/status"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-data/status" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The status of the virtual machine</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the virtual machine may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The tenant that the virtual machine will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/vcpus"></div> + <b>vcpus</b> + <a class="ansibleOptionLink" href="#parameter-data/vcpus" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Number of vcpus of the virtual machine</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/virtual_machine_role"></div> + <b>virtual_machine_role</b> + <a class="ansibleOptionLink" href="#parameter-data/virtual_machine_role" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The role of the virtual machine</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create virtual machine within Netbox with only required information + netbox_virtual_machine: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Virtual Machine + cluster: test cluster + state: present + + - name: Delete virtual machine within netbox + netbox_virtual_machine: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Virtual Machine + state: absent + + - name: Create virtual machine with tags + netbox_virtual_machine: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Another Test Virtual Machine + cluster: test cluster + site: Test Site + tags: + - Schnozzberry + state: present + + - name: Update vcpus, memory and disk of an existing virtual machine + netbox_virtual_machine: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Virtual Machine + cluster: test cluster + vcpus: 8 + memory: 8 + disk: 8 + state: present + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-virtual machine"></div> + <b>virtual machine</b> + <a class="ansibleOptionLink" href="#return-virtual machine" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Gaelle MANGIN (@gmangin) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vlan/netbox.netbox.netbox_vlan_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vlan/netbox.netbox.netbox_vlan_module.rst new file mode 100644 index 00000000..d0563208 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vlan/netbox.netbox.netbox_vlan_module.rst @@ -0,0 +1,460 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_vlan_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_vlan -- Create, update or delete vlans within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_vlan`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes vlans from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the vlan configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the vlan</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the vlan</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#parameter-data/site" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The site the VLAN will be associated to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/status"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-data/status" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The status of the vlan</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the vlan may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The tenant that the vlan will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/vid"></div> + <b>vid</b> + <a class="ansibleOptionLink" href="#parameter-data/vid" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The VLAN ID</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/vlan_group"></div> + <b>vlan_group</b> + <a class="ansibleOptionLink" href="#parameter-data/vlan_group" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The VLAN group the VLAN will be associated to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/vlan_role"></div> + <b>vlan_role</b> + <a class="ansibleOptionLink" href="#parameter-data/vlan_role" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Required if <em>state=present</em> and the vlan does not exist yet</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create vlan within Netbox with only required information + netbox_vlan: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VLAN + vid: 400 + state: present + + - name: Delete vlan within netbox + netbox_vlan: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VLAN + vid: 400 + state: absent + + - name: Create vlan with all information + netbox_vlan: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VLAN + vid: 400 + site: Test Site + group: Test VLAN Group + tenant: Test Tenant + status: Deprecated + vlan_role: Test VLAN Role + description: Just a test + tags: + - Schnozzberry + state: present + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-vlan"></div> + <b>vlan</b> + <a class="ansibleOptionLink" href="#return-vlan" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vlan_group/netbox.netbox.netbox_vlan_group_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vlan_group/netbox.netbox.netbox_vlan_group_module.rst new file mode 100644 index 00000000..6ee62fe9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vlan_group/netbox.netbox.netbox_vlan_group_module.rst @@ -0,0 +1,331 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_vlan_group_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_vlan_group -- Create, update or delete vlans groups within Netbox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_vlan_group`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes vlans groups from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the vlan group configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the vlan group</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/site"></div> + <b>site</b> + <a class="ansibleOptionLink" href="#parameter-data/site" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The site the vlan will be assigned to</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/slug"></div> + <b>slug</b> + <a class="ansibleOptionLink" href="#parameter-data/slug" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The slugified version of the name or custom slug.</div> + <div>This is auto-generated following NetBox rules if not provided</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create vlan group within Netbox with only required information + netbox_vlan_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test vlan group + site: Test Site + state: present + + - name: Delete vlan group within netbox + netbox_vlan_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test vlan group + state: absent + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-vlan_group"></div> + <b>vlan_group</b> + <a class="ansibleOptionLink" href="#return-vlan_group" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vm_interface/netbox.netbox.netbox_vm_interface_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vm_interface/netbox.netbox.netbox_vm_interface_module.rst new file mode 100644 index 00000000..2f5291b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vm_interface/netbox.netbox.netbox_vm_interface_module.rst @@ -0,0 +1,467 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_vm_interface_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_vm_interface -- Creates or removes interfaces from virtual machines in Netbox +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_vm_interface`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates or removes interfaces from virtual machines in Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the vm interface configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/enabled"></div> + <b>enabled</b> + <a class="ansibleOptionLink" href="#parameter-data/enabled" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Sets whether interface shows enabled or disabled</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mac_address"></div> + <b>mac_address</b> + <a class="ansibleOptionLink" href="#parameter-data/mac_address" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The MAC address of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mode"></div> + <b>mode</b> + <a class="ansibleOptionLink" href="#parameter-data/mode" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The mode of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/mtu"></div> + <b>mtu</b> + <a class="ansibleOptionLink" href="#parameter-data/mtu" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>The MTU of the interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Name of the interface to be created</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tagged_vlans"></div> + <b>tagged_vlans</b> + <a class="ansibleOptionLink" href="#parameter-data/tagged_vlans" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>A list of tagged VLANS to be assigned to interface. Mode must be set to either <code>Tagged</code> or <code>Tagged All</code></div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the prefix may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/untagged_vlan"></div> + <b>untagged_vlan</b> + <a class="ansibleOptionLink" href="#parameter-data/untagged_vlan" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The untagged VLAN to be assigned to interface</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/virtual_machine"></div> + <b>virtual_machine</b> + <a class="ansibleOptionLink" href="#parameter-data/virtual_machine" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>Name of the virtual machine the interface will be associated with (case-sensitive)</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox interface module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create interface within Netbox with only required information + netbox_vm_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + virtual_machine: test100 + name: GigabitEthernet1 + state: present + + - name: Delete interface within netbox + netbox_vm_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + virtual_machine: test100 + name: GigabitEthernet1 + state: absent + + - name: Create interface as a trunk port + netbox_vm_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + virtual_machine: test100 + name: GigabitEthernet25 + enabled: false + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + mtu: 1600 + mode: Tagged + state: present + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-interface"></div> + <b>interface</b> + <a class="ansibleOptionLink" href="#return-interface" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>on creation</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Benjamin Vergnaud (@bvergnaud) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vrf/netbox.netbox.netbox_vrf_module.rst b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vrf/netbox.netbox.netbox_vrf_module.rst new file mode 100644 index 00000000..8e0d5a42 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/plugins/modules/netbox_vrf/netbox.netbox.netbox_vrf_module.rst @@ -0,0 +1,411 @@ +.. Document meta + +:orphan: + +.. Anchors + +.. _ansible_collections.netbox.netbox.netbox_vrf_module: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +netbox.netbox.netbox_vrf -- Create, update or delete vrfs within Netbox ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This plugin is part of the `netbox.netbox collection <https://galaxy.ansible.com/netbox/netbox>`_. + + To install it use: :code:`ansible-galaxy collection install netbox.netbox`. + + To use it in a playbook, specify: :code:`netbox.netbox.netbox_vrf`. + +.. version_added + +.. versionadded:: 0.1.0 of + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- Creates, updates or removes vrfs from Netbox + +.. Aliases + + +.. Requirements + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- pynetbox + + +.. Options + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-data"></div> + <b>data</b> + <a class="ansibleOptionLink" href="#parameter-data" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>Defines the vrf configuration</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/custom_fields"></div> + <b>custom_fields</b> + <a class="ansibleOptionLink" href="#parameter-data/custom_fields" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>must exist in Netbox</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/description"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-data/description" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description of the vrf</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/enforce_unique"></div> + <b>enforce_unique</b> + <a class="ansibleOptionLink" href="#parameter-data/enforce_unique" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Prevent duplicate prefixes/IP addresses within this VRF</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/name"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-data/name" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The name of the vrf</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/rd"></div> + <b>rd</b> + <a class="ansibleOptionLink" href="#parameter-data/rd" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The RD of the VRF. Must be quoted to pass as a string.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tags"></div> + <b>tags</b> + <a class="ansibleOptionLink" href="#parameter-data/tags" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>Any tags that the vrf may need to be associated with</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-data/tenant"></div> + <b>tenant</b> + <a class="ansibleOptionLink" href="#parameter-data/tenant" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + </td> + <td> + <div>The tenant that the vrf will be assigned to</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_token"></div> + <b>netbox_token</b> + <a class="ansibleOptionLink" href="#parameter-netbox_token" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>The token created within Netbox to authorize API access</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-netbox_url"></div> + <b>netbox_url</b> + <a class="ansibleOptionLink" href="#parameter-netbox_url" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> + </td> + <td> + </td> + <td> + <div>URL of the Netbox instance resolvable by Ansible control host</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-query_params"></div> + <b>query_params</b> + <a class="ansibleOptionLink" href="#parameter-query_params" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> </div> + </td> + <td> + </td> + <td> + <div>This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined</div> + <div>in plugins/module_utils/netbox_utils.py and provides control to users on what may make</div> + <div>an object unique in their environment.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-state"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>absent</li> + <li><div style="color: blue"><b>present</b> ←</div></li> + </ul> + </td> + <td> + <div>Use <code>present</code> or <code>absent</code> for adding or removing.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div> + <b>validate_certs</b> + <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">raw</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"yes"</div> + </td> + <td> + <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.</div> + </td> + </tr> + </table> + <br/> + +.. Notes + +Notes +----- + +.. note:: + - Tags should be defined as a YAML list + - This should be ran with connection ``local`` and hosts ``localhost`` + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create vrf within Netbox with only required information + netbox_vrf: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VRF + state: present + + - name: Delete vrf within netbox + netbox_vrf: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VRF + state: absent + + - name: Create vrf with all information + netbox_vrf: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VRF + rd: "65000:1" + tenant: Test Tenant + enforce_unique: true + description: VRF description + tags: + - Schnozzberry + state: present + + + + +.. Facts + + +.. Return values + +Return Values +------------- +Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-msg"></div> + <b>msg</b> + <a class="ansibleOptionLink" href="#return-msg" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Message indicating failure or info about what has been achieved</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-vrf"></div> + <b>vrf</b> + <a class="ansibleOptionLink" href="#return-vrf" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>success (when <em>state=present</em>)</td> + <td> + <div>Serialized object as created or already existent within Netbox</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Mikhail Yohman (@FragmentedPacket) + + + +.. Parsing errors + diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/docs/requirements.txt b/collections-debian-merged/ansible_collections/netbox/netbox/docs/requirements.txt new file mode 100644 index 00000000..67c63b06 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/docs/requirements.txt @@ -0,0 +1,3 @@ +ansible +antsibull +sphinx==3.1.2
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/hacking/black.sh b/collections-debian-merged/ansible_collections/netbox/netbox/hacking/black.sh new file mode 100755 index 00000000..e095f911 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/hacking/black.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Usage: ./hacking/black.sh + +# Run black to reformat all python code +black . --exclude "ansible_collections|venv" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/hacking/build.sh b/collections-debian-merged/ansible_collections/netbox/netbox/hacking/build.sh new file mode 100755 index 00000000..c77c7a24 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/hacking/build.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Usage: ./hacking/build.sh + +# galaxy.yml build_ignore is not implemented in Ansible 2.9, so we have to delete files we don't want + +# Remove previous test installs +rm -r ansible_collections + +# Remove old built versions +rm netbox-netbox-*.tar.gz + +# Remove test output +rm -r tests/output +rm -r .pytest_cache + +ansible-galaxy collection build --force --verbose . + +# To verify what files have been included in the build: +# tar --gunzip --list --file netbox-netbox-*.tar.gz diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/hacking/local-test.sh b/collections-debian-merged/ansible_collections/netbox/netbox/hacking/local-test.sh new file mode 100755 index 00000000..325f51d0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/hacking/local-test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Usage: ./hacking/local-test.sh + +# Run build, which will remove previously installed versions +./hacking/build.sh + +# Install new built version +ansible-galaxy collection install netbox-netbox-*.tar.gz -p . + +# You can now cd into the installed version and run tests +(cd ansible_collections/netbox/netbox/ && ansible-test units -v --python 3.6) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/hacking/update_test_inventories.sh b/collections-debian-merged/ansible_collections/netbox/netbox/hacking/update_test_inventories.sh new file mode 100755 index 00000000..f0301ba7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/hacking/update_test_inventories.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Stop on failure - if unit tests fail the inventory will not be updated +set -e + +# Usage overview (see Contributing.md for more detail): +# - Run netbox with the netbox-docker project +# - Fill with test data, run ./tests/integration/netbox-deploy.py +# - Run ./hacking/update_test_inventories.sh +# - Manually verify the diff of new JSON is correct, to prevent introducing a regression. + +# Install locally +export ANSIBLE_COLLECTIONS_PATHS=. +export OUTPUT_INVENTORY_JSON=tests/integration/targets/inventory/files + +# Remove local cache +rm -rf /tmp/inventory_netbox/ + +# Clean and install the built collection +./hacking/local-test.sh + +# Run the same script used by integration tests, but save the results +./tests/integration/targets/inventory/runme.sh diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/meta/runtime.yml b/collections-debian-merged/ansible_collections/netbox/netbox/meta/runtime.yml new file mode 100644 index 00000000..5b48a851 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/meta/runtime.yml @@ -0,0 +1,6 @@ +--- +requires_ansible: ">=2.9.10" +plugin_routing: + modules: + netbox_interface: + redirect: netbox.netbox.plugins.modules.netbox_device_interface diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/inventory/nb_inventory.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/inventory/nb_inventory.py new file mode 100644 index 00000000..c0c08f1b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/inventory/nb_inventory.py @@ -0,0 +1,1512 @@ +# Copyright (c) 2018 Remy Leone +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ + name: nb_inventory + plugin_type: inventory + author: + - Remy Leone (@sieben) + - Anthony Ruhier (@Anthony25) + - Nikhil Singh Baliyan (@nikkytub) + - Sander Steffann (@steffann) + - Douglas Heriot (@DouglasHeriot) + short_description: NetBox inventory source + description: + - Get inventory hosts from NetBox + extends_documentation_fragment: + - constructed + - inventory_cache + options: + plugin: + description: token that ensures this is a source file for the 'netbox' plugin. + required: True + choices: ['netbox.netbox.nb_inventory'] + api_endpoint: + description: Endpoint of the NetBox API + required: True + env: + - name: NETBOX_API + validate_certs: + description: + - Allows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted. + default: True + type: boolean + follow_redirects: + description: + - Determine how redirects are followed. + - By default, I(follow_redirects) is set to uses urllib2 default behavior. + default: urllib2 + choices: ['urllib2', 'all', 'yes', 'safe', 'none'] + config_context: + description: + - If True, it adds config_context in host vars. + - Config-context enables the association of arbitrary data to devices and virtual machines grouped by + region, site, role, platform, and/or tenant. Please check official netbox docs for more info. + default: False + type: boolean + flatten_config_context: + description: + - If I(config_context) is enabled, by default it's added as a host var named config_context. + - If flatten_config_context is set to True, the config context variables will be added directly to the host instead. + default: False + type: boolean + version_added: "0.2.1" + flatten_local_context_data: + description: + - If I(local_context_data) is enabled, by default it's added as a host var named local_context_data. + - If flatten_local_context_data is set to True, the config context variables will be added directly to the host instead. + default: False + type: boolean + version_added: "0.3.0" + flatten_custom_fields: + description: + - By default, host custom fields are added as a dictionary host var named custom_fields. + - If flatten_custom_fields is set to True, the fields will be added directly to the host instead. + default: False + type: boolean + version_added: "0.2.1" + token: + required: False + description: + - NetBox API token to be able to read against NetBox. + - This may not be required depending on the NetBox setup. + env: + # in order of precedence + - name: NETBOX_TOKEN + - name: NETBOX_API_KEY + plurals: + description: + - If True, all host vars are contained inside single-element arrays for legacy compatibility with old versions of this plugin. + - Group names will be plural (ie. "sites_mysite" instead of "site_mysite") + - The choices of I(group_by) will be changed by this option. + default: True + type: boolean + version_added: "0.2.1" + interfaces: + description: + - If True, it adds the device or virtual machine interface information in host vars. + default: False + type: boolean + version_added: "0.1.7" + services: + description: + - If True, it adds the device or virtual machine services information in host vars. + default: True + type: boolean + version_added: "0.2.0" + fetch_all: + description: + - By default, fetching interfaces and services will get all of the contents of NetBox regardless of query_filters applied to devices and VMs. + - When set to False, separate requests will be made fetching interfaces, services, and IP addresses for each device_id and virtual_machine_id. + - If you are using the various query_filters options to reduce the number of devices, you may find querying Netbox faster with fetch_all set to False. + - For efficiency, when False, these requests will be batched, for example /api/dcim/interfaces?limit=0&device_id=1&device_id=2&device_id=3 + - These GET request URIs can become quite large for a large number of devices. If you run into HTTP 414 errors, you can adjust the max_uri_length option to suit your web server. + default: True + type: boolean + version_added: "0.2.1" + group_by: + description: Keys used to create groups. The I(plurals) option controls which of these are valid. + type: list + choices: + - sites + - site + - tenants + - tenant + - racks + - rack + - rack_group + - rack_role + - tags + - tag + - device_roles + - role + - device_types + - device_type + - manufacturers + - manufacturer + - platforms + - platform + - region + - cluster + - cluster_type + - cluster_group + - is_virtual + - services + - status + default: [] + group_names_raw: + description: Will not add the group_by choice name to the group names + default: False + type: boolean + version_added: "0.2.0" + query_filters: + description: List of parameters passed to the query string for both devices and VMs (Multiple values may be separated by commas) + type: list + default: [] + device_query_filters: + description: List of parameters passed to the query string for devices (Multiple values may be separated by commas) + type: list + default: [] + vm_query_filters: + description: List of parameters passed to the query string for VMs (Multiple values may be separated by commas) + type: list + default: [] + timeout: + description: Timeout for Netbox requests in seconds + type: int + default: 60 + max_uri_length: + description: + - When fetch_all is False, GET requests to NetBox may become quite long and return a HTTP 414 (URI Too Long). + - You can adjust this option to be smaller to avoid 414 errors, or larger for a reduced number of requests. + type: int + default: 4000 + version_added: "0.2.1" + virtual_chassis_name: + description: + - When a device is part of a virtual chassis, use the virtual chassis name as the Ansible inventory hostname. + - The host var values will be from the virtual chassis master. + type: boolean + default: False + dns_name: + description: + - Force IP Addresses to be fetched so that the dns_name for the primary_ip of each device or VM is set as a host_var. + - Setting interfaces will also fetch IP addresses and the dns_name host_var will be set. + type: boolean + default: False + compose: + description: List of custom ansible host vars to create from the device object fetched from NetBox + default: {} + type: dict +""" + +EXAMPLES = """ +# netbox_inventory.yml file in YAML format +# Example command line: ansible-inventory -v --list -i netbox_inventory.yml + +plugin: netbox.netbox.nb_inventory +api_endpoint: http://localhost:8000 +validate_certs: True +config_context: False +group_by: + - device_roles +query_filters: + - role: network-edge-router +device_query_filters: + - has_primary_ip: 'true' + +# has_primary_ip is a useful way to filter out patch panels and other passive devices + +# Query filters are passed directly as an argument to the fetching queries. +# You can repeat tags in the query string. + +query_filters: + - role: server + - tag: web + - tag: production + +# See the NetBox documentation at https://netbox.readthedocs.io/en/latest/api/overview/ +# the query_filters work as a logical **OR** +# +# Prefix any custom fields with cf_ and pass the field value with the regular NetBox query string + +query_filters: + - cf_foo: bar + +# NetBox inventory plugin also supports Constructable semantics +# You can fill your hosts vars using the compose option: + +plugin: netbox.netbox.nb_inventory +compose: + foo: last_updated + bar: display_name + nested_variable: rack.display_name + +# You can use keyed_groups to group on properties of devices or VMs. +# NOTE: It's only possible to key off direct items on the device/VM objects. +plugin: netbox.netbox.nb_inventory +keyed_groups: + - prefix: status + key: status.value +""" + +import json +import uuid +import math +from functools import partial +from sys import version as python_version +from threading import Thread +from typing import Iterable +from itertools import chain +from collections import defaultdict + +from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable +from ansible.module_utils.ansible_release import __version__ as ansible_version +from ansible.errors import AnsibleError +from ansible.module_utils._text import to_text, to_native +from ansible.module_utils.urls import open_url +from ansible.module_utils.six.moves.urllib import error as urllib_error +from ansible.module_utils.six.moves.urllib.parse import urlencode +from ansible_collections.ansible.netcommon.plugins.module_utils.compat.ipaddress import ( + ip_interface, +) + + +class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): + NAME = "netbox.netbox.nb_inventory" + + def _fetch_information(self, url): + results = None + cache_key = self.get_cache_key(url) + + # get the user's cache option to see if we should save the cache if it is changing + user_cache_setting = self.get_option("cache") + + # read if the user has caching enabled and the cache isn't being refreshed + attempt_to_read_cache = user_cache_setting and self.use_cache + + # attempt to read the cache if inventory isn't being refreshed and the user has caching enabled + if attempt_to_read_cache: + try: + results = self._cache[cache_key] + need_to_fetch = False + except KeyError: + # occurs if the cache_key is not in the cache or if the cache_key expired + # we need to fetch the URL now + need_to_fetch = True + else: + # not reading from cache so do fetch + need_to_fetch = True + + if need_to_fetch: + self.display.v("Fetching: " + url) + try: + response = open_url( + url, + headers=self.headers, + timeout=self.timeout, + validate_certs=self.validate_certs, + follow_redirects=self.follow_redirects, + ) + except urllib_error.HTTPError as e: + """This will return the response body when we encounter an error. + This is to help determine what might be the issue when encountering an error. + Please check issue #294 for more info. + """ + # Prevent inventory from failing completely if the token does not have the proper permissions for specific URLs + if e.code == 403: + self.display.display( + "Permission denied: {0}. This may impair functionality of the inventory plugin.".format( + url + ), + color="red", + ) + # Need to return mock response data that is empty to prevent any failures downstream + return {"results": [], "next": None} + + raise AnsibleError(to_native(e.fp.read())) + + try: + raw_data = to_text(response.read(), errors="surrogate_or_strict") + except UnicodeError: + raise AnsibleError( + "Incorrect encoding of fetched payload from NetBox API." + ) + + try: + results = json.loads(raw_data) + except ValueError: + raise AnsibleError("Incorrect JSON payload: %s" % raw_data) + + # put result in cache if enabled + if user_cache_setting: + self._cache[cache_key] = results + + return results + + def get_resource_list(self, api_url): + """Retrieves resource list from netbox API. + Returns: + A list of all resource from netbox API. + """ + if not api_url: + raise AnsibleError("Please check API URL in script configuration file.") + + resources = [] + + # Handle pagination + while api_url: + api_output = self._fetch_information(api_url) + resources.extend(api_output["results"]) + api_url = api_output["next"] + + return resources + + def get_resource_list_chunked(self, api_url, query_key, query_values): + # Make an API call for multiple specific IDs, like /api/ipam/ip-addresses?limit=0&device_id=1&device_id=2&device_id=3 + # Drastically cuts down HTTP requests comnpared to 1 request per host, in the case where we don't want to fetch_all + + # Make sure query_values is subscriptable + if not isinstance(query_values, list): + query_values = list(query_values) + + def query_string(value, separator="&"): + return separator + query_key + "=" + str(value) + + # Calculate how many queries we can do per API call to stay within max_url_length + largest_value = str(max(query_values, default=0)) # values are always id ints + length_per_value = len(query_string(largest_value)) + chunk_size = math.floor((self.max_uri_length - len(api_url)) / length_per_value) + + # Sanity check, for case where max_uri_length < (api_url + length_per_value) + if chunk_size < 1: + chunk_size = 1 + + if self.api_version == "2.6": + # Issue netbox-community/netbox#3507 was fixed in v2.7.5 + # If using NetBox v2.7.0-v2.7.4 will have to manually set max_uri_length to 0, + # but it's probably faster to keep fetch_all: True + # (You should really just upgrade your Netbox install) + chunk_size = 1 + + resources = [] + + for i in range(0, len(query_values), chunk_size): + chunk = query_values[i : i + chunk_size] + # process chunk of size <= chunk_size + url = api_url + for value in chunk: + url += query_string(value, "&" if "?" in url else "?") + + resources.extend(self.get_resource_list(url)) + + return resources + + @property + def group_extractors(self): + + # List of group_by options and hostvars to extract + + # Some keys are different depending on plurals option + extractors = { + "disk": self.extract_disk, + "memory": self.extract_memory, + "vcpus": self.extract_vcpus, + "status": self.extract_status, + "config_context": self.extract_config_context, + "local_context_data": self.extract_local_context_data, + "custom_fields": self.extract_custom_fields, + "region": self.extract_regions, + "cluster": self.extract_cluster, + "cluster_group": self.extract_cluster_group, + "cluster_type": self.extract_cluster_type, + "is_virtual": self.extract_is_virtual, + self._pluralize_group_by("site"): self.extract_site, + self._pluralize_group_by("tenant"): self.extract_tenant, + self._pluralize_group_by("rack"): self.extract_rack, + "rack_group": self.extract_rack_group, + "rack_role": self.extract_rack_role, + self._pluralize_group_by("tag"): self.extract_tags, + self._pluralize_group_by("role"): self.extract_device_role, + self._pluralize_group_by("platform"): self.extract_platform, + self._pluralize_group_by("device_type"): self.extract_device_type, + self._pluralize_group_by("manufacturer"): self.extract_manufacturer, + } + + if self.services: + extractors.update( + {"services": self.extract_services,} + ) + + if self.interfaces: + extractors.update( + {"interfaces": self.extract_interfaces,} + ) + + if self.interfaces or self.dns_name: + extractors.update( + {"dns_name": self.extract_dns_name,} + ) + + return extractors + + def _pluralize_group_by(self, group_by): + mapping = { + "site": "sites", + "tenant": "tenants", + "rack": "racks", + "tag": "tags", + "role": "device_roles", + "platform": "platforms", + "device_type": "device_types", + "manufacturer": "manufacturers", + } + + if self.plurals: + mapped = mapping.get(group_by) + return mapped or group_by + else: + return group_by + + def _pluralize(self, extracted_value): + # If plurals is enabled, wrap in a single-element list for backwards compatibility + if self.plurals: + return [extracted_value] + else: + return extracted_value + + def _objects_array_following_parents( + self, initial_object_id, object_lookup, object_parent_lookup + ): + objects = [] + + object_id = initial_object_id + + # Keep looping until the object has no parent + while object_id is not None: + object_slug = object_lookup[object_id] + + if object_slug in objects: + # Won't ever happen - defensively guard against infinite loop + break + + objects.append(object_slug) + + # Get the parent of this object + object_id = object_parent_lookup[object_id] + + return objects + + def extract_disk(self, host): + return host.get("disk") + + def extract_vcpus(self, host): + return host.get("vcpus") + + def extract_status(self, host): + return host["status"] + + def extract_memory(self, host): + return host.get("memory") + + def extract_platform(self, host): + try: + return self._pluralize(self.platforms_lookup[host["platform"]["id"]]) + except Exception: + return + + def extract_services(self, host): + try: + services_lookup = ( + self.vm_services_lookup + if host["is_virtual"] + else self.device_services_lookup + ) + + return list(services_lookup[host["id"]].values()) + + except Exception: + return + + def extract_device_type(self, host): + try: + return self._pluralize(self.device_types_lookup[host["device_type"]["id"]]) + except Exception: + return + + def extract_rack(self, host): + try: + return self._pluralize(self.racks_lookup[host["rack"]["id"]]) + except Exception: + return + + def extract_rack_group(self, host): + # A host may have a rack. A rack may have a rack_group. A rack_group may have a parent rack_group. + # Produce a list of rack_groups: + # - it will be empty if the device has no rack, or the rack has no rack_group + # - it will have 1 element if the rack's group has no parent + # - it will have multiple elements if the rack's group has a parent group + + rack = host.get("rack", None) + if not isinstance(rack, dict): + # Device has no rack + return None + + rack_id = rack.get("id", None) + if rack_id is None: + # Device has no rack + return None + + return self._objects_array_following_parents( + initial_object_id=self.racks_group_lookup[rack_id], + object_lookup=self.rack_groups_lookup, + object_parent_lookup=self.rack_group_parent_lookup, + ) + + def extract_rack_role(self, host): + try: + return self.racks_role_lookup[host["rack"]["id"]] + except Exception: + return + + def extract_site(self, host): + try: + return self._pluralize(self.sites_lookup[host["site"]["id"]]) + except Exception: + return + + def extract_tenant(self, host): + try: + return self._pluralize(self.tenants_lookup[host["tenant"]["id"]]) + except Exception: + return + + def extract_device_role(self, host): + try: + if "device_role" in host: + return self._pluralize( + self.device_roles_lookup[host["device_role"]["id"]] + ) + elif "role" in host: + return self._pluralize(self.device_roles_lookup[host["role"]["id"]]) + except Exception: + return + + def extract_config_context(self, host): + try: + if self.flatten_config_context: + # Don't wrap in an array if we're about to flatten it to separate host vars + return host["config_context"] + else: + return self._pluralize(host["config_context"]) + except Exception: + return + + def extract_local_context_data(self, host): + try: + if self.flatten_local_context_data: + # Don't wrap in an array if we're about to flatten it to separate host vars + return host["local_context_data"] + else: + return self._pluralize(host["local_context_data"]) + except Exception: + return + + def extract_manufacturer(self, host): + try: + return self._pluralize( + self.manufacturers_lookup[host["device_type"]["manufacturer"]["id"]] + ) + except Exception: + return + + def extract_primary_ip(self, host): + try: + address = host["primary_ip"]["address"] + return str(ip_interface(address).ip) + except Exception: + return + + def extract_primary_ip4(self, host): + try: + address = host["primary_ip4"]["address"] + return str(ip_interface(address).ip) + except Exception: + return + + def extract_primary_ip6(self, host): + try: + address = host["primary_ip6"]["address"] + return str(ip_interface(address).ip) + except Exception: + return + + def extract_tags(self, host): + try: + tag_zero = host["tags"][0] + # Check the type of the first element in the "tags" array. + # If a dictionary (Netbox >= 2.9), return an array of tags' slugs. + if isinstance(tag_zero, dict): + return list(sub["slug"] for sub in host["tags"]) + # If a string (Netbox <= 2.8), return the original "tags" array. + elif isinstance(tag_zero, str): + return host["tags"] + # If tag_zero fails definition (no tags), return the empty array. + except Exception: + return host["tags"] + + def extract_interfaces(self, host): + try: + + interfaces_lookup = ( + self.vm_interfaces_lookup + if host["is_virtual"] + else self.device_interfaces_lookup + ) + + interfaces = list(interfaces_lookup[host["id"]].values()) + + before_netbox_v29 = bool(self.ipaddresses_intf_lookup) + # Attach IP Addresses to their interface + for interface in interfaces: + if before_netbox_v29: + interface["ip_addresses"] = list( + self.ipaddresses_intf_lookup[interface["id"]].values() + ) + else: + interface["ip_addresses"] = list( + self.vm_ipaddresses_intf_lookup[interface["id"]].values() + if host["is_virtual"] + else self.device_ipaddresses_intf_lookup[ + interface["id"] + ].values() + ) + + return interfaces + except Exception: + return + + def extract_custom_fields(self, host): + try: + return host["custom_fields"] + except Exception: + return + + def extract_regions(self, host): + # A host may have a site. A site may have a region. A region may have a parent region. + # Produce a list of regions: + # - it will be empty if the device has no site, or the site has no region set + # - it will have 1 element if the site's region has no parent + # - it will have multiple elements if the site's region has a parent region + + site = host.get("site", None) + if not isinstance(site, dict): + # Device has no site + return [] + + site_id = site.get("id", None) + if site_id is None: + # Device has no site + return [] + + return self._objects_array_following_parents( + initial_object_id=self.sites_region_lookup[site_id], + object_lookup=self.regions_lookup, + object_parent_lookup=self.regions_parent_lookup, + ) + + def extract_cluster(self, host): + try: + # cluster does not have a slug + return host["cluster"]["name"] + except Exception: + return + + def extract_cluster_group(self, host): + try: + return self.clusters_group_lookup[host["cluster"]["id"]] + except Exception: + return + + def extract_cluster_type(self, host): + try: + return self.clusters_type_lookup[host["cluster"]["id"]] + except Exception: + return + + def extract_is_virtual(self, host): + return host.get("is_virtual") + + def extract_dns_name(self, host): + # No primary IP assigned + if not host.get("primary_ip"): + return None + + before_netbox_v29 = bool(self.ipaddresses_lookup) + if before_netbox_v29: + ip_address = self.ipaddresses_lookup.get(host["primary_ip"]["id"]) + else: + if host["is_virtual"]: + ip_address = self.vm_ipaddresses_lookup.get(host["primary_ip"]["id"]) + else: + ip_address = self.device_ipaddresses_lookup.get( + host["primary_ip"]["id"] + ) + + # Don"t assign a host_var for empty dns_name + if ip_address.get("dns_name") == "": + return None + + return ip_address.get("dns_name") + + def refresh_platforms_lookup(self): + url = self.api_endpoint + "/api/dcim/platforms/?limit=0" + platforms = self.get_resource_list(api_url=url) + self.platforms_lookup = dict( + (platform["id"], platform["slug"]) for platform in platforms + ) + + def refresh_sites_lookup(self): + url = self.api_endpoint + "/api/dcim/sites/?limit=0" + sites = self.get_resource_list(api_url=url) + self.sites_lookup = dict((site["id"], site["slug"]) for site in sites) + + def get_region_for_site(site): + # Will fail if site does not have a region defined in Netbox + try: + return (site["id"], site["region"]["id"]) + except Exception: + return (site["id"], None) + + # Dictionary of site id to region id + self.sites_region_lookup = dict(map(get_region_for_site, sites)) + + def refresh_regions_lookup(self): + url = self.api_endpoint + "/api/dcim/regions/?limit=0" + regions = self.get_resource_list(api_url=url) + self.regions_lookup = dict((region["id"], region["slug"]) for region in regions) + + def get_region_parent(region): + # Will fail if region does not have a parent region + try: + return (region["id"], region["parent"]["id"]) + except Exception: + return (region["id"], None) + + # Dictionary of region id to parent region id + self.regions_parent_lookup = dict( + filter(lambda x: x is not None, map(get_region_parent, regions)) + ) + + def refresh_tenants_lookup(self): + url = self.api_endpoint + "/api/tenancy/tenants/?limit=0" + tenants = self.get_resource_list(api_url=url) + self.tenants_lookup = dict((tenant["id"], tenant["slug"]) for tenant in tenants) + + def refresh_racks_lookup(self): + url = self.api_endpoint + "/api/dcim/racks/?limit=0" + racks = self.get_resource_list(api_url=url) + self.racks_lookup = dict((rack["id"], rack["name"]) for rack in racks) + + def get_group_for_rack(rack): + try: + return (rack["id"], rack["group"]["id"]) + except Exception: + return (rack["id"], None) + + def get_role_for_rack(rack): + try: + return (rack["id"], rack["role"]["slug"]) + except Exception: + return (rack["id"], None) + + self.racks_group_lookup = dict(map(get_group_for_rack, racks)) + self.racks_role_lookup = dict(map(get_role_for_rack, racks)) + + def refresh_rack_groups_lookup(self): + url = self.api_endpoint + "/api/dcim/rack-groups/?limit=0" + rack_groups = self.get_resource_list(api_url=url) + self.rack_groups_lookup = dict( + (rack_group["id"], rack_group["slug"]) for rack_group in rack_groups + ) + + def get_rack_group_parent(rack_group): + try: + return (rack_group["id"], rack_group["parent"]["id"]) + except Exception: + return (rack_group["id"], None) + + # Dictionary of rack group id to parent rack group id + self.rack_group_parent_lookup = dict(map(get_rack_group_parent, rack_groups)) + + def refresh_device_roles_lookup(self): + url = self.api_endpoint + "/api/dcim/device-roles/?limit=0" + device_roles = self.get_resource_list(api_url=url) + self.device_roles_lookup = dict( + (device_role["id"], device_role["slug"]) for device_role in device_roles + ) + + def refresh_device_types_lookup(self): + url = self.api_endpoint + "/api/dcim/device-types/?limit=0" + device_types = self.get_resource_list(api_url=url) + self.device_types_lookup = dict( + (device_type["id"], device_type["slug"]) for device_type in device_types + ) + + def refresh_manufacturers_lookup(self): + url = self.api_endpoint + "/api/dcim/manufacturers/?limit=0" + manufacturers = self.get_resource_list(api_url=url) + self.manufacturers_lookup = dict( + (manufacturer["id"], manufacturer["slug"]) for manufacturer in manufacturers + ) + + def refresh_clusters_lookup(self): + url = self.api_endpoint + "/api/virtualization/clusters/?limit=0" + clusters = self.get_resource_list(api_url=url) + + def get_cluster_type(cluster): + # Will fail if cluster does not have a type (required property so should always be true) + try: + return (cluster["id"], cluster["type"]["slug"]) + except Exception: + return (cluster["id"], None) + + def get_cluster_group(cluster): + # Will fail if cluster does not have a group (group is optional) + try: + return (cluster["id"], cluster["group"]["slug"]) + except Exception: + return (cluster["id"], None) + + self.clusters_type_lookup = dict(map(get_cluster_type, clusters)) + self.clusters_group_lookup = dict(map(get_cluster_group, clusters)) + + def refresh_services(self): + url = self.api_endpoint + "/api/ipam/services/?limit=0" + services = [] + + if self.fetch_all: + services = self.get_resource_list(url) + else: + device_services = self.get_resource_list_chunked( + api_url=url, + query_key="device_id", + query_values=self.devices_lookup.keys(), + ) + vm_services = self.get_resource_list_chunked( + api_url=url, + query_key="virtual_machine_id", + query_values=self.vms_lookup.keys(), + ) + services = chain(device_services, vm_services) + + # Construct a dictionary of dictionaries, separately for devices and vms. + # Allows looking up services by device id or vm id + self.device_services_lookup = defaultdict(dict) + self.vm_services_lookup = defaultdict(dict) + + for service in services: + service_id = service["id"] + + if service.get("device"): + self.device_services_lookup[service["device"]["id"]][ + service_id + ] = service + + if service.get("virtual_machine"): + self.vm_services_lookup[service["virtual_machine"]["id"]][ + service_id + ] = service + + def refresh_interfaces(self): + + url_device_interfaces = self.api_endpoint + "/api/dcim/interfaces/?limit=0" + url_vm_interfaces = ( + self.api_endpoint + "/api/virtualization/interfaces/?limit=0" + ) + + device_interfaces = [] + vm_interfaces = [] + + if self.fetch_all: + device_interfaces = self.get_resource_list(url_device_interfaces) + vm_interfaces = self.get_resource_list(url_vm_interfaces) + else: + device_interfaces = self.get_resource_list_chunked( + api_url=url_device_interfaces, + query_key="device_id", + query_values=self.devices_lookup.keys(), + ) + vm_interfaces = self.get_resource_list_chunked( + api_url=url_vm_interfaces, + query_key="virtual_machine_id", + query_values=self.vms_lookup.keys(), + ) + + # Construct a dictionary of dictionaries, separately for devices and vms. + # For a given device id or vm id, get a lookup of interface id to interface + # This is because interfaces may be returned multiple times when querying for virtual chassis parent and child in separate queries + self.device_interfaces_lookup = defaultdict(dict) + self.vm_interfaces_lookup = defaultdict(dict) + + # /dcim/interfaces gives count_ipaddresses per interface. /virtualization/interfaces does not + self.devices_with_ips = set() + + for interface in device_interfaces: + interface_id = interface["id"] + device_id = interface["device"]["id"] + + # Check if device_id is actually a device we've fetched, and was not filtered out by query_filters + if device_id not in self.devices_lookup: + continue + + # Check if device_id is part of a virtual chasis + # If so, treat its interfaces as actually part of the master + device = self.devices_lookup[device_id] + virtual_chassis_master = self._get_host_virtual_chassis_master(device) + if virtual_chassis_master is not None: + device_id = virtual_chassis_master + + self.device_interfaces_lookup[device_id][interface_id] = interface + + # Keep track of what devices have interfaces with IPs, so if fetch_all is False we can avoid unnecessary queries + if interface["count_ipaddresses"] > 0: + self.devices_with_ips.add(device_id) + + for interface in vm_interfaces: + interface_id = interface["id"] + vm_id = interface["virtual_machine"]["id"] + + self.vm_interfaces_lookup[vm_id][interface_id] = interface + + # Note: depends on the result of refresh_interfaces for self.devices_with_ips + def refresh_ipaddresses(self): + url = ( + self.api_endpoint + + "/api/ipam/ip-addresses/?limit=0&assigned_to_interface=true" + ) + ipaddresses = [] + + if self.fetch_all: + ipaddresses = self.get_resource_list(url) + else: + device_ips = self.get_resource_list_chunked( + api_url=url, + query_key="device_id", + query_values=list(self.devices_with_ips), + ) + vm_ips = self.get_resource_list_chunked( + api_url=url, + query_key="virtual_machine_id", + query_values=self.vms_lookup.keys(), + ) + + ipaddresses = chain(device_ips, vm_ips) + + # Construct a dictionary of lists, to allow looking up ip addresses by interface id + # Note that interface ids share the same namespace for both devices and vms so this is a single dictionary + self.ipaddresses_intf_lookup = defaultdict(dict) + # Construct a dictionary of the IP addresses themselves + self.ipaddresses_lookup = defaultdict(dict) + # NetBox v2.9 and onwards + self.vm_ipaddresses_intf_lookup = defaultdict(dict) + self.vm_ipaddresses_lookup = defaultdict(dict) + self.device_ipaddresses_intf_lookup = defaultdict(dict) + self.device_ipaddresses_lookup = defaultdict(dict) + + for ipaddress in ipaddresses: + # As of NetBox v2.9 "assigned_object_x" replaces "interface" + if ipaddress.get("assigned_object_id"): + interface_id = ipaddress["assigned_object_id"] + ip_id = ipaddress["id"] + # We need to copy the ipaddress entry to preserve the original in case caching is used. + ipaddress_copy = ipaddress.copy() + + if ipaddress["assigned_object_type"] == "virtualization.vminterface": + self.vm_ipaddresses_lookup[ip_id] = ipaddress_copy + self.vm_ipaddresses_intf_lookup[interface_id][ + ip_id + ] = ipaddress_copy + else: + self.device_ipaddresses_lookup[ip_id] = ipaddress_copy + self.device_ipaddresses_intf_lookup[interface_id][ + ip_id + ] = ipaddress_copy # Remove "assigned_object_X" attributes, as that's redundant when ipaddress is added to an interface + + del ipaddress_copy["assigned_object_id"] + del ipaddress_copy["assigned_object_type"] + del ipaddress_copy["assigned_object"] + continue + + if not ipaddress.get("interface"): + continue + interface_id = ipaddress["interface"]["id"] + ip_id = ipaddress["id"] + + # We need to copy the ipaddress entry to preserve the original in case caching is used. + ipaddress_copy = ipaddress.copy() + + self.ipaddresses_intf_lookup[interface_id][ip_id] = ipaddress_copy + self.ipaddresses_lookup[ip_id] = ipaddress_copy + # Remove "interface" attribute, as that's redundant when ipaddress is added to an interface + del ipaddress_copy["interface"] + + @property + def lookup_processes(self): + lookups = [ + self.refresh_sites_lookup, + self.refresh_regions_lookup, + self.refresh_tenants_lookup, + self.refresh_racks_lookup, + self.refresh_rack_groups_lookup, + self.refresh_device_roles_lookup, + self.refresh_platforms_lookup, + self.refresh_device_types_lookup, + self.refresh_manufacturers_lookup, + self.refresh_clusters_lookup, + ] + + if self.interfaces: + lookups.append(self.refresh_interfaces) + + if self.services: + lookups.append(self.refresh_services) + + return lookups + + @property + def lookup_processes_secondary(self): + lookups = [] + + # IP addresses are needed for either interfaces or dns_name options + if self.interfaces or self.dns_name: + lookups.append(self.refresh_ipaddresses) + + return lookups + + def refresh_lookups(self, lookups): + + # Exceptions that occur in threads by default are printed to stderr, and ignored by the main thread + # They need to be caught, and raised in the main thread to prevent further execution of this plugin + + thread_exceptions = [] + + def handle_thread_exceptions(lookup): + def wrapper(): + try: + lookup() + except Exception as e: + # Save for the main-thread to re-raise + # Also continue to raise on this thread, so the default handler can run to print to stderr + thread_exceptions.append(e) + raise e + + return wrapper + + thread_list = [] + + try: + for lookup in lookups: + thread = Thread(target=handle_thread_exceptions(lookup)) + thread_list.append(thread) + thread.start() + + for thread in thread_list: + thread.join() + + # Wait till we've joined all threads before raising any exceptions + for exception in thread_exceptions: + raise exception + + finally: + # Avoid retain cycles + thread_exceptions = None + + def fetch_api_docs(self): + openapi = self._fetch_information( + self.api_endpoint + "/api/docs/?format=openapi" + ) + + self.api_version = openapi["info"]["version"] + self.allowed_device_query_parameters = [ + p["name"] for p in openapi["paths"]["/dcim/devices/"]["get"]["parameters"] + ] + self.allowed_vm_query_parameters = [ + p["name"] + for p in openapi["paths"]["/virtualization/virtual-machines/"]["get"][ + "parameters" + ] + ] + + def validate_query_parameter(self, parameter, allowed_query_parameters): + if not (isinstance(parameter, dict) and len(parameter) == 1): + self.display.warning( + "Warning query parameters %s not a dict with a single key." % parameter + ) + return None + + k = tuple(parameter.keys())[0] + v = tuple(parameter.values())[0] + + if not (k in allowed_query_parameters or k.startswith("cf_")): + msg = "Warning: %s not in %s or starting with cf (Custom field)" % ( + k, + allowed_query_parameters, + ) + self.display.warning(msg=msg) + return None + return k, v + + def filter_query_parameters(self, parameters, allowed_query_parameters): + return filter( + lambda parameter: parameter is not None, + # For each element of query_filters, test if it's allowed + map( + # Create a partial function with the device-specific list of query parameters + partial( + self.validate_query_parameter, + allowed_query_parameters=allowed_query_parameters, + ), + parameters, + ), + ) + + def refresh_url(self): + device_query_parameters = [("limit", 0)] + vm_query_parameters = [("limit", 0)] + device_url = self.api_endpoint + "/api/dcim/devices/?" + vm_url = self.api_endpoint + "/api/virtualization/virtual-machines/?" + + # Add query_filtes to both devices and vms query, if they're valid + if isinstance(self.query_filters, Iterable): + device_query_parameters.extend( + self.filter_query_parameters( + self.query_filters, self.allowed_device_query_parameters + ) + ) + + vm_query_parameters.extend( + self.filter_query_parameters( + self.query_filters, self.allowed_vm_query_parameters + ) + ) + + if isinstance(self.device_query_filters, Iterable): + device_query_parameters.extend( + self.filter_query_parameters( + self.device_query_filters, self.allowed_device_query_parameters + ) + ) + + if isinstance(self.vm_query_filters, Iterable): + vm_query_parameters.extend( + self.filter_query_parameters( + self.vm_query_filters, self.allowed_vm_query_parameters + ) + ) + + # When query_filters is Iterable, and is not empty: + # - If none of the filters are valid for devices, do not fetch any devices + # - If none of the filters are valid for VMs, do not fetch any VMs + # If either device_query_filters or vm_query_filters are set, + # device_query_parameters and vm_query_parameters will have > 1 element so will continue to be requested + if self.query_filters and isinstance(self.query_filters, Iterable): + if len(device_query_parameters) <= 1: + device_url = None + + if len(vm_query_parameters) <= 1: + vm_url = None + + # Append the parameters to the URLs + if device_url: + device_url = device_url + urlencode(device_query_parameters) + if vm_url: + vm_url = vm_url + urlencode(vm_query_parameters) + + # Exclude config_context if not required + if not self.config_context: + if device_url: + device_url = device_url + "&exclude=config_context" + if vm_url: + vm_url = vm_url + "&exclude=config_context" + + return device_url, vm_url + + def fetch_hosts(self): + device_url, vm_url = self.refresh_url() + + self.devices_list = [] + self.vms_list = [] + + if device_url: + self.devices_list = self.get_resource_list(device_url) + + if vm_url: + self.vms_list = self.get_resource_list(vm_url) + + # Allow looking up devices/vms by their ids + self.devices_lookup = {device["id"]: device for device in self.devices_list} + self.vms_lookup = {vm["id"]: vm for vm in self.vms_list} + + # There's nothing that explicitly says if a host is virtual or not - add in a new field + for host in self.devices_list: + host["is_virtual"] = False + + for host in self.vms_list: + host["is_virtual"] = True + + def extract_name(self, host): + # An host in an Ansible inventory requires an hostname. + # name is an unique but not required attribute for a device in NetBox + # We default to an UUID for hostname in case the name is not set in NetBox + # Use virtual chassis name if set by the user. + if self.virtual_chassis_name and self._get_host_virtual_chassis_master(host): + return host["virtual_chassis"]["name"] or str(uuid.uuid4()) + else: + return host["name"] or str(uuid.uuid4()) + + def generate_group_name(self, grouping, group): + + # Check for special case - if group is a boolean, just return grouping name instead + # eg. "is_virtual" - returns true for VMs, should put them in a group named "is_virtual", not "is_virtual_True" + if isinstance(group, bool): + if group: + return grouping + else: + # Don't create the inverse group + return None + + # Special case. Extract name from service, which is a hash. + if grouping == "services": + group = group["name"] + grouping = "service" + + if grouping == "status": + group = group["value"] + + if self.group_names_raw: + return group + else: + return "_".join([grouping, group]) + + def add_host_to_groups(self, host, hostname): + + # If we're grouping by regions, hosts are not added to region groups + # - the site groups are added as sub-groups of regions + # So, we need to make sure we're also grouping by sites if regions are enabled + + if "region" in self.group_by: + # Make sure "site" or "sites" grouping also exists, depending on plurals options + site_group_by = self._pluralize_group_by("site") + if site_group_by not in self.group_by: + self.group_by.append(site_group_by) + + for grouping in self.group_by: + + # Don't handle regions here - that will happen in main() + if grouping == "region": + continue + + if grouping not in self.group_extractors: + raise AnsibleError( + 'group_by option "%s" is not valid. (Maybe check the plurals option? It can determine what group_by options are valid)' + % grouping + ) + + groups_for_host = self.group_extractors[grouping](host) + + if not groups_for_host: + continue + + # Make groups_for_host a list if it isn't already + if not isinstance(groups_for_host, list): + groups_for_host = [groups_for_host] + + for group_for_host in groups_for_host: + group_name = self.generate_group_name(grouping, group_for_host) + + if not group_name: + continue + + # Group names may be transformed by the ansible TRANSFORM_INVALID_GROUP_CHARS setting + # add_group returns the actual group name used + transformed_group_name = self.inventory.add_group(group=group_name) + self.inventory.add_host(group=transformed_group_name, host=hostname) + + def _add_region_groups(self): + + # Mapping of region id to group name + region_transformed_group_names = dict() + + # Create groups for each region + for region_id in self.regions_lookup: + region_group_name = self.generate_group_name( + "region", self.regions_lookup[region_id] + ) + region_transformed_group_names[region_id] = self.inventory.add_group( + group=region_group_name + ) + + # Now that all region groups exist, add relationships between them + for region_id in self.regions_lookup: + region_group_name = region_transformed_group_names[region_id] + parent_region_id = self.regions_parent_lookup.get(region_id, None) + if ( + parent_region_id is not None + and parent_region_id in region_transformed_group_names + ): + parent_region_name = region_transformed_group_names[parent_region_id] + self.inventory.add_child(parent_region_name, region_group_name) + + # Add site groups as children of region groups + for site_id in self.sites_lookup: + region_id = self.sites_region_lookup.get(site_id, None) + if region_id is None: + continue + + region_transformed_group_name = region_transformed_group_names[region_id] + + site_name = self.sites_lookup[site_id] + site_group_name = self.generate_group_name( + self._pluralize_group_by("site"), site_name + ) + # Add the site group to get its transformed name + # Will already be created by add_host_to_groups - it's ok to call add_group again just to get its name + site_transformed_group_name = self.inventory.add_group( + group=site_group_name + ) + + self.inventory.add_child( + region_transformed_group_name, site_transformed_group_name + ) + + def _fill_host_variables(self, host, hostname): + extracted_primary_ip = self.extract_primary_ip(host=host) + if extracted_primary_ip: + self.inventory.set_variable(hostname, "ansible_host", extracted_primary_ip) + + extracted_primary_ip4 = self.extract_primary_ip4(host=host) + if extracted_primary_ip4: + self.inventory.set_variable(hostname, "primary_ip4", extracted_primary_ip4) + + extracted_primary_ip6 = self.extract_primary_ip6(host=host) + if extracted_primary_ip6: + self.inventory.set_variable(hostname, "primary_ip6", extracted_primary_ip6) + + for attribute, extractor in self.group_extractors.items(): + extracted_value = extractor(host) + + # Compare with None, not just check for a truth comparison - allow empty arrays, etc to be host vars + if extracted_value is None: + continue + + # Special case - all group_by options are single strings, but tag is a list of tags + # Keep the groups named singular "tag_sometag", but host attribute should be "tags":["sometag", "someothertag"] + if attribute == "tag": + attribute = "tags" + + if attribute == "region": + attribute = "regions" + + if attribute == "rack_group": + attribute = "rack_groups" + + # Flatten the dict into separate host vars, if enabled + if isinstance(extracted_value, dict) and ( + (attribute == "config_context" and self.flatten_config_context) + or (attribute == "custom_fields" and self.flatten_custom_fields) + or ( + attribute == "local_context_data" + and self.flatten_local_context_data + ) + ): + for key, value in extracted_value.items(): + self.inventory.set_variable(hostname, key, value) + else: + self.inventory.set_variable(hostname, attribute, extracted_value) + + def _get_host_virtual_chassis_master(self, host): + virtual_chassis = host.get("virtual_chassis", None) + + if not virtual_chassis: + return None + + master = virtual_chassis.get("master", None) + + if not master: + return None + + return master.get("id", None) + + def main(self): + # Get info about the API - version, allowed query parameters + self.fetch_api_docs() + + self.fetch_hosts() + + # Interface, and Service lookup will depend on hosts, if option fetch_all is false + self.refresh_lookups(self.lookup_processes) + + # Looking up IP Addresses depends on the result of interfaces count_ipaddresses field + # - can skip any device/vm without any IPs + self.refresh_lookups(self.lookup_processes_secondary) + + for host in chain(self.devices_list, self.vms_list): + + virtual_chassis_master = self._get_host_virtual_chassis_master(host) + if ( + virtual_chassis_master is not None + and virtual_chassis_master != host["id"] + ): + # Device is part of a virtual chassis, but is not the master + continue + + hostname = self.extract_name(host=host) + self.inventory.add_host(host=hostname) + self._fill_host_variables(host=host, hostname=hostname) + + strict = self.get_option("strict") + + # Composed variables + self._set_composite_vars( + self.get_option("compose"), host, hostname, strict=strict + ) + + # Complex groups based on jinja2 conditionals, hosts that meet the conditional are added to group + self._add_host_to_composed_groups( + self.get_option("groups"), host, hostname, strict=strict + ) + + # Create groups based on variable values and add the corresponding hosts to it + self._add_host_to_keyed_groups( + self.get_option("keyed_groups"), host, hostname, strict=strict + ) + self.add_host_to_groups(host=host, hostname=hostname) + + # Create groups for regions, containing the site groups + if "region" in self.group_by: + self._add_region_groups() + + def parse(self, inventory, loader, path, cache=True): + super(InventoryModule, self).parse(inventory, loader, path) + self._read_config_data(path=path) + self.use_cache = cache + + # Netbox access + token = self.get_option("token") + # Handle extra "/" from api_endpoint configuration and trim if necessary, see PR#49943 + self.api_endpoint = self.get_option("api_endpoint").strip("/") + self.timeout = self.get_option("timeout") + self.max_uri_length = self.get_option("max_uri_length") + self.validate_certs = self.get_option("validate_certs") + self.follow_redirects = self.get_option("follow_redirects") + self.config_context = self.get_option("config_context") + self.flatten_config_context = self.get_option("flatten_config_context") + self.flatten_local_context_data = self.get_option("flatten_local_context_data") + self.flatten_custom_fields = self.get_option("flatten_custom_fields") + self.plurals = self.get_option("plurals") + self.interfaces = self.get_option("interfaces") + self.services = self.get_option("services") + self.fetch_all = self.get_option("fetch_all") + self.headers = { + "User-Agent": "ansible %s Python %s" + % (ansible_version, python_version.split(" ")[0]), + "Content-type": "application/json", + } + if token: + self.headers.update({"Authorization": "Token %s" % token}) + + # Filter and group_by options + self.group_by = self.get_option("group_by") + self.group_names_raw = self.get_option("group_names_raw") + self.query_filters = self.get_option("query_filters") + self.device_query_filters = self.get_option("device_query_filters") + self.vm_query_filters = self.get_option("vm_query_filters") + self.virtual_chassis_name = self.get_option("virtual_chassis_name") + self.dns_name = self.get_option("dns_name") + + self.main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/lookup/nb_lookup.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/lookup/nb_lookup.py new file mode 100644 index 00000000..13230b64 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/lookup/nb_lookup.py @@ -0,0 +1,382 @@ +# -*- coding: utf-8 -*- + +# Copyright: (c) 2019. Chris Mills <chris@discreet-its.co.uk> +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +netbox.py + +A lookup function designed to return data from the Netbox application +""" + +from __future__ import absolute_import, division, print_function + +import os +import functools +from pprint import pformat + +from ansible.errors import AnsibleError +from ansible.plugins.lookup import LookupBase +from ansible.parsing.splitter import parse_kv, split_args +from ansible.utils.display import Display + +import pynetbox +import requests + +__metaclass__ = type + +DOCUMENTATION = """ + lookup: nb_lookup + author: Chris Mills (@cpmills1975) + version_added: "2.9" + short_description: Queries and returns elements from Netbox + description: + - Queries Netbox via its API to return virtually any information + capable of being held in Netbox. + - If wanting to obtain the plaintext attribute of a secret, key_file must be provided. + options: + _terms: + description: + - The Netbox object type to query + required: True + api_endpoint: + description: + - The URL to the Netbox instance to query + env: + # in order of precendence + - name: NETBOX_API + - name: NETBOX_URL + required: True + api_filter: + description: + - The api_filter to use. + required: False + plugin: + description: + - The Netbox plugin to query + required: False + token: + description: + - The API token created through Netbox + - This may not be required depending on the Netbox setup. + env: + # in order of precendence + - name: NETBOX_TOKEN + - name: NETBOX_API_TOKEN + required: False + validate_certs: + description: + - Whether or not to validate SSL of the NetBox instance + required: False + default: True + key_file: + description: + - The location of the private key tied to user account. + required: False + raw_data: + description: + - Whether to return raw API data with the lookup/query or whether to return a key/value dict + required: False + requirements: + - pynetbox +""" + +EXAMPLES = """ +tasks: + # query a list of devices + - name: Obtain list of devices from Netbox + debug: + msg: > + "Device {{ item.value.display_name }} (ID: {{ item.key }}) was + manufactured by {{ item.value.device_type.manufacturer.name }}" + loop: "{{ query('netbox.netbox.nb_lookup', 'devices', + api_endpoint='http://localhost/', + token='<redacted>') }}" + +# This example uses an API Filter + +tasks: + # query a list of devices + - name: Obtain list of devices from Netbox + debug: + msg: > + "Device {{ item.value.display_name }} (ID: {{ item.key }}) was + manufactured by {{ item.value.device_type.manufacturer.name }}" + loop: "{{ query('netbox.netbox.nb_lookup', 'devices', + api_endpoint='http://localhost/', + api_filter='role=management tag=Dell'), + token='<redacted>') }}" + +# Obtain a secret for R1-device +tasks: + - name: "Obtain secrets for R1-Device" + debug: + msg: "{{ query('netbox.netbox.nb_lookup', 'secrets', api_filter='device=R1-Device', api_endpoint='http://localhost/', token='<redacted>', key_file='~/.ssh/id_rsa') }}" + +# Fetch bgp sessions for R1-device +tasks: + - name: "Obtain bgp sessions for R1-Device" + debug: + msg: "{{ query('netbox.netbox.nb_lookup', 'bgp_sessions', + api_filter='device=R1-Device', + api_endpoint='http://localhost/', + token='<redacted>', + plugin='mycustomstuff') }}" + + msg: "{{ query('netbox.netbox.nb_lookup', 'secrets', api_filter='device=R1-Device', api_endpoint='http://localhost/', token='<redacted>', key_file='~/.ssh/id_rsa') }}" +""" + +RETURN = """ + _list: + description: + - list of composed dictionaries with key and value + type: list +""" + + +def get_endpoint(netbox, term): + """ + get_endpoint(netbox, term) + netbox: a predefined pynetbox.api() pointing to a valid instance + of Netbox + term: the term passed to the lookup function upon which the api + call will be identified + """ + + netbox_endpoint_map = { + "aggregates": {"endpoint": netbox.ipam.aggregates}, + "circuit-terminations": {"endpoint": netbox.circuits.circuit_terminations}, + "circuit-types": {"endpoint": netbox.circuits.circuit_types}, + "circuits": {"endpoint": netbox.circuits.circuits}, + "circuit-providers": {"endpoint": netbox.circuits.providers}, + "cables": {"endpoint": netbox.dcim.cables}, + "cluster-groups": {"endpoint": netbox.virtualization.cluster_groups}, + "cluster-types": {"endpoint": netbox.virtualization.cluster_types}, + "clusters": {"endpoint": netbox.virtualization.clusters}, + "config-contexts": {"endpoint": netbox.extras.config_contexts}, + "console-connections": {"endpoint": netbox.dcim.console_connections}, + "console-ports": {"endpoint": netbox.dcim.console_ports}, + "console-server-port-templates": { + "endpoint": netbox.dcim.console_server_port_templates + }, + "console-server-ports": {"endpoint": netbox.dcim.console_server_ports}, + "device-bay-templates": {"endpoint": netbox.dcim.device_bay_templates}, + "device-bays": {"endpoint": netbox.dcim.device_bays}, + "device-roles": {"endpoint": netbox.dcim.device_roles}, + "device-types": {"endpoint": netbox.dcim.device_types}, + "devices": {"endpoint": netbox.dcim.devices}, + "export-templates": {"endpoint": netbox.dcim.export_templates}, + "front-port-templates": {"endpoint": netbox.dcim.front_port_templates}, + "front-ports": {"endpoint": netbox.dcim.front_ports}, + "graphs": {"endpoint": netbox.extras.graphs}, + "image-attachments": {"endpoint": netbox.extras.image_attachments}, + "interface-connections": {"endpoint": netbox.dcim.interface_connections}, + "interface-templates": {"endpoint": netbox.dcim.interface_templates}, + "interfaces": {"endpoint": netbox.dcim.interfaces}, + "inventory-items": {"endpoint": netbox.dcim.inventory_items}, + "ip-addresses": {"endpoint": netbox.ipam.ip_addresses}, + "manufacturers": {"endpoint": netbox.dcim.manufacturers}, + "object-changes": {"endpoint": netbox.extras.object_changes}, + "platforms": {"endpoint": netbox.dcim.platforms}, + "power-connections": {"endpoint": netbox.dcim.power_connections}, + "power-outlet-templates": {"endpoint": netbox.dcim.power_outlet_templates}, + "power-outlets": {"endpoint": netbox.dcim.power_outlets}, + "power-port-templates": {"endpoint": netbox.dcim.power_port_templates}, + "power-ports": {"endpoint": netbox.dcim.power_ports}, + "prefixes": {"endpoint": netbox.ipam.prefixes}, + "rack-groups": {"endpoint": netbox.dcim.rack_groups}, + "rack-reservations": {"endpoint": netbox.dcim.rack_reservations}, + "rack-roles": {"endpoint": netbox.dcim.rack_roles}, + "racks": {"endpoint": netbox.dcim.racks}, + "rear-port-templates": {"endpoint": netbox.dcim.rear_port_templates}, + "rear-ports": {"endpoint": netbox.dcim.rear_ports}, + "regions": {"endpoint": netbox.dcim.regions}, + "reports": {"endpoint": netbox.extras.reports}, + "rirs": {"endpoint": netbox.ipam.rirs}, + "roles": {"endpoint": netbox.ipam.roles}, + "secret-roles": {"endpoint": netbox.secrets.secret_roles}, + "secrets": {"endpoint": netbox.secrets.secrets}, + "services": {"endpoint": netbox.ipam.services}, + "sites": {"endpoint": netbox.dcim.sites}, + "tags": {"endpoint": netbox.extras.tags}, + "tenant-groups": {"endpoint": netbox.tenancy.tenant_groups}, + "tenants": {"endpoint": netbox.tenancy.tenants}, + "topology-maps": {"endpoint": netbox.extras.topology_maps}, + "virtual-chassis": {"endpoint": netbox.dcim.virtual_chassis}, + "virtual-machines": {"endpoint": netbox.virtualization.virtual_machines}, + "virtualization-interfaces": {"endpoint": netbox.virtualization.interfaces}, + "vlan-groups": {"endpoint": netbox.ipam.vlan_groups}, + "vlans": {"endpoint": netbox.ipam.vlans}, + "vrfs": {"endpoint": netbox.ipam.vrfs}, + } + + return netbox_endpoint_map[term]["endpoint"] + + +def build_filters(filters): + """ + This will build the filters to be handed to NetBox endpoint call if they exist. + + Args: + filters (str): String of filters to parse. + + Returns: + result (list): List of dictionaries to filter by. + """ + filter = {} + args_split = split_args(filters) + args = [parse_kv(x) for x in args_split] + for arg in args: + for k, v in arg.items(): + if k not in filter: + filter[k] = list() + filter[k].append(v) + else: + filter[k].append(v) + + return filter + + +def get_plugin_endpoint(netbox, plugin, term): + """ + get_plugin_endpoint(netbox, plugin, term) + netbox: a predefined pynetbox.api() pointing to a valid instance + of Netbox + plugin: a string referencing the plugin name + term: the term passed to the lookup function upon which the api + call will be identified + """ + attr = "plugins.%s.%s" % (plugin, term) + + def _getattr(netbox, attr): + return getattr(netbox, attr) + + return functools.reduce(_getattr, [netbox] + attr.split(".")) + + +def make_netbox_call(nb_endpoint, filters=None): + """ + Wrapper for calls to NetBox and handle any possible errors. + + Args: + nb_endpoint (object): The NetBox endpoint object to make calls. + + Returns: + results (object): Pynetbox result. + + Raises: + AnsibleError: Ansible Error containing an error message. + """ + try: + if filters: + results = nb_endpoint.filter(**filters) + else: + results = nb_endpoint.all() + except pynetbox.RequestError as e: + if e.req.status_code == 404 and "plugins" in e: + raise AnsibleError( + "{0} - Not a valid plugin endpoint, please make sure to provide valid plugin endpoint.".format( + e.error + ) + ) + else: + raise AnsibleError(e.error) + + return results + + +class LookupModule(LookupBase): + """ + LookupModule(LookupBase) is defined by Ansible + """ + + def run(self, terms, variables=None, **kwargs): + + netbox_api_token = ( + kwargs.get("token") + or os.getenv("NETBOX_TOKEN") + or os.getenv("NETBOX_API_TOKEN") + ) + netbox_api_endpoint = ( + kwargs.get("api_endpoint") + or os.getenv("NETBOX_API") + or os.getenv("NETBOX_URL") + ) + netbox_ssl_verify = kwargs.get("validate_certs", True) + netbox_private_key_file = kwargs.get("key_file") + netbox_api_filter = kwargs.get("api_filter") + netbox_raw_return = kwargs.get("raw_data") + netbox_plugin = kwargs.get("plugin") + + if not isinstance(terms, list): + terms = [terms] + + try: + session = requests.Session() + session.verify = netbox_ssl_verify + + netbox = pynetbox.api( + netbox_api_endpoint, + token=netbox_api_token if netbox_api_token else None, + private_key_file=netbox_private_key_file, + ) + netbox.http_session = session + except FileNotFoundError: + raise AnsibleError( + "%s cannot be found. Please make sure file exists." + % netbox_private_key_file + ) + + results = [] + for term in terms: + if netbox_plugin: + endpoint = get_plugin_endpoint(netbox, netbox_plugin, term) + else: + try: + endpoint = get_endpoint(netbox, term) + except KeyError: + raise AnsibleError( + "Unrecognised term %s. Check documentation" % term + ) + + Display().vvvv( + u"Netbox lookup for %s to %s using token %s filter %s" + % (term, netbox_api_endpoint, netbox_api_token, netbox_api_filter) + ) + + if netbox_api_filter: + filter = build_filters(netbox_api_filter) + + if "id" in filter: + Display().vvvv( + u"Filter is: %s and includes id, will use .get instead of .filter" + % (filter) + ) + try: + id = int(filter["id"][0]) + nb_data = endpoint.get(id) + data = dict(nb_data) + Display().vvvvv(pformat(data)) + return [data] + except pynetbox.RequestError as e: + raise AnsibleError(e.error) + + Display().vvvv("filter is %s" % filter) + + # Make call to NetBox API and capture any failures + nb_data = make_netbox_call( + endpoint, filters=filter if netbox_api_filter else None + ) + + for data in nb_data: + data = dict(data) + Display().vvvvv(pformat(data)) + + if netbox_raw_return: + results.append(data) + else: + key = data["id"] + result = {key: data} + results.extend(self._flatten_hash_to_list(result)) + + return results diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/__init__.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/__init__.py diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_circuits.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_circuits.py new file mode 100644 index 00000000..91cb6373 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_circuits.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@fragmentedpacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxModule, + ENDPOINT_NAME_MAPPING, + SLUG_REQUIRED, +) + + +NB_PROVIDERS = "providers" +NB_CIRCUIT_TYPES = "circuit_types" +NB_CIRCUIT_TERMINATIONS = "circuit_terminations" +NB_CIRCUITS = "circuits" + + +class NetboxCircuitsModule(NetboxModule): + def __init__(self, module, endpoint): + super().__init__(module, endpoint) + + def run(self): + """ + This function should have all necessary code for endpoints within the application + to create/update/delete the endpoint objects + Supported endpoints: + - circuit_types + - circuit_terminations + - circuits + - providers + """ + # Used to dynamically set key when returning results + endpoint_name = ENDPOINT_NAME_MAPPING[self.endpoint] + + self.result = {"changed": False} + + application = self._find_app(self.endpoint) + nb_app = getattr(self.nb, application) + nb_endpoint = getattr(nb_app, self.endpoint) + user_query_params = self.module.params.get("query_params") + + data = self.data + + # Used for msg output + if data.get("name"): + name = data["name"] + elif data.get("slug"): + name = data["slug"] + elif data.get("cid"): + name = data["cid"] + elif data.get("circuit") and data.get("term_side"): + circuit = self.nb.circuits.circuits.get(data["circuit"]).serialize() + name = "{0}_{1}".format( + circuit["cid"].replace(" ", "_"), data["term_side"] + ).lower() + + if self.endpoint in SLUG_REQUIRED: + if not data.get("slug"): + data["slug"] = self._to_slug(name) + + object_query_params = self._build_query_params( + endpoint_name, data, user_query_params + ) + self.nb_object = self._nb_endpoint_get(nb_endpoint, object_query_params, name) + + if self.state == "present": + self._ensure_object_exists(nb_endpoint, endpoint_name, name, data) + elif self.state == "absent": + self._ensure_object_absent(endpoint_name, name) + + try: + serialized_object = self.nb_object.serialize() + except AttributeError: + serialized_object = self.nb_object + + self.result.update({endpoint_name: serialized_object}) + + self.module.exit_json(**self.result) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_dcim.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_dcim.py new file mode 100644 index 00000000..ba8aa37c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_dcim.py @@ -0,0 +1,196 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@fragmentedpacket) <mikhail.yohman@gmail.com> +# Copyright: (c) 2020, Nokia, Tobias Groß (@toerb) <tobias.gross@nokia.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +# Import necessary packages +import traceback +from ansible.module_utils.basic import missing_required_lib + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxModule, + ENDPOINT_NAME_MAPPING, + SLUG_REQUIRED, +) + + +NB_CABLES = "cables" +NB_CONSOLE_PORTS = "console_ports" +NB_CONSOLE_PORT_TEMPLATES = "console_port_templates" +NB_CONSOLE_SERVER_PORTS = "console_server_ports" +NB_CONSOLE_SERVER_PORT_TEMPLATES = "console_server_port_templates" +NB_DEVICE_BAYS = "device_bays" +NB_DEVICE_BAY_TEMPLATES = "device_bay_templates" +NB_DEVICES = "devices" +NB_DEVICE_ROLES = "device_roles" +NB_DEVICE_TYPES = "device_types" +NB_FRONT_PORTS = "front_ports" +NB_FRONT_PORT_TEMPLATES = "front_port_templates" +NB_INTERFACES = "interfaces" +NB_INTERFACE_TEMPLATES = "interface_templates" +NB_INVENTORY_ITEMS = "inventory_items" +NB_MANUFACTURERS = "manufacturers" +NB_PLATFORMS = "platforms" +NB_POWER_FEEDS = "power_feeds" +NB_POWER_OUTLETS = "power_outlets" +NB_POWER_OUTLET_TEMPLATES = "power_outlet_templates" +NB_POWER_PANELS = "power_panels" +NB_POWER_PORTS = "power_ports" +NB_POWER_PORT_TEMPLATES = "power_port_templates" +NB_RACKS = "racks" +NB_RACK_ROLES = "rack_roles" +NB_RACK_GROUPS = "rack_groups" +NB_REAR_PORTS = "rear_ports" +NB_REAR_PORT_TEMPLATES = "rear_port_templates" +NB_REGIONS = "regions" +NB_SITES = "sites" +NB_VIRTUAL_CHASSIS = "virtual_chassis" + + +class NetboxDcimModule(NetboxModule): + def __init__(self, module, endpoint): + super().__init__(module, endpoint) + + def run(self): + """ + This function should have all necessary code for endpoints within the application + to create/update/delete the endpoint objects + Supported endpoints: + - cables + - console_ports + - console_port_templates + - console_server_ports + - console_server_port_templates + - device_bays + - device_bay_templates + - devices + - device_roles + - device_types + - front_ports + - front_port_templates + - interfaces + - interface_templates + - inventory_items + - manufacturers + - platforms + - power_feeds + - power_outlets + - power_outlet_templates + - power_panels + - power_ports + - power_port_templates + - sites + - racks + - rack_roles + - rack_groups + - rear_ports + - rear_port_templates + - regions + - virtual_chassis + """ + # Used to dynamically set key when returning results + endpoint_name = ENDPOINT_NAME_MAPPING[self.endpoint] + + self.result = {"changed": False} + + application = self._find_app(self.endpoint) + nb_app = getattr(self.nb, application) + nb_endpoint = getattr(nb_app, self.endpoint) + user_query_params = self.module.params.get("query_params") + + data = self.data + + # Used for msg output + if data.get("name"): + name = data["name"] + elif data.get("model") and not data.get("slug"): + name = data["model"] + elif data.get("master"): + name = self.module.params["data"]["master"] + elif data.get("slug"): + name = data["slug"] + elif endpoint_name == "cable": + if self.module.params["data"]["termination_a"].get("name"): + termination_a_name = self.module.params["data"]["termination_a"]["name"] + elif self.module.params["data"]["termination_a"].get("slug"): + termination_a_name = self.module.params["data"]["termination_a"]["slug"] + else: + termination_a_name = data.get("termination_a_id") + + if self.module.params["data"]["termination_b"].get("name"): + termination_b_name = self.module.params["data"]["termination_b"]["name"] + elif self.module.params["data"]["termination_b"].get("slug"): + termination_b_name = self.module.params["data"]["termination_b"]["slug"] + else: + termination_b_name = data.get("termination_b_id") + + name = "%s %s <> %s %s" % ( + data.get("termination_a_type"), + termination_a_name, + data.get("termination_b_type"), + termination_b_name, + ) + + if self.endpoint in SLUG_REQUIRED: + if not data.get("slug"): + data["slug"] = self._to_slug(name) + + # Make color params lowercase + if data.get("color"): + data["color"] = data["color"].lower() + + if self.endpoint == "cables": + cables = [ + cable + for cable in nb_endpoint.all() + if cable.termination_a_type == data["termination_a_type"] + and cable.termination_a_id == data["termination_a_id"] + and cable.termination_b_type == data["termination_b_type"] + and cable.termination_b_id == data["termination_b_id"] + ] + if len(cables) == 0: + self.nb_object = None + elif len(cables) == 1: + self.nb_object = cables[0] + else: + self._handle_errors(msg="More than one result returned for %s" % (name)) + else: + object_query_params = self._build_query_params( + endpoint_name, data, user_query_params + ) + self.nb_object = self._nb_endpoint_get( + nb_endpoint, object_query_params, name + ) + + # This is logic to handle interfaces on a VC + if self.endpoint == "interfaces": + if self.nb_object: + device = self.nb.dcim.devices.get(self.nb_object.device.id) + if ( + device["virtual_chassis"] + and self.nb_object.device.id != self.data["device"] + ): + if self.module.params.get("update_vc_child"): + data["device"] = self.nb_object.device.id + else: + self._handle_errors( + msg="Must set update_vc_child to True to allow child device interface modification" + ) + + if self.state == "present": + self._ensure_object_exists(nb_endpoint, endpoint_name, name, data) + + elif self.state == "absent": + self._ensure_object_absent(endpoint_name, name) + + try: + serialized_object = self.nb_object.serialize() + except AttributeError: + serialized_object = self.nb_object + + self.result.update({endpoint_name: serialized_object}) + + self.module.exit_json(**self.result) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_extras.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_extras.py new file mode 100644 index 00000000..675f9973 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_extras.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@fragmentedpacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxModule, + ENDPOINT_NAME_MAPPING, + SLUG_REQUIRED, +) + +NB_TAGS = "tags" + + +class NetboxExtrasModule(NetboxModule): + def __init__(self, module, endpoint): + super().__init__(module, endpoint) + + def run(self): + """ + This function should have all necessary code for endpoints within the application + to create/update/delete the endpoint objects + Supported endpoints: + - tags + """ + # Used to dynamically set key when returning results + endpoint_name = ENDPOINT_NAME_MAPPING[self.endpoint] + + self.result = {"changed": False} + + application = self._find_app(self.endpoint) + nb_app = getattr(self.nb, application) + nb_endpoint = getattr(nb_app, self.endpoint) + user_query_params = self.module.params.get("query_params") + + data = self.data + + # Used for msg output + if data.get("name"): + name = data["name"] + elif data.get("slug"): + name = data["slug"] + + if self.endpoint in SLUG_REQUIRED: + if not data.get("slug"): + data["slug"] = self._to_slug(name) + + # Make color params lowercase + if data.get("color"): + data["color"] = data["color"].lower() + + object_query_params = self._build_query_params( + endpoint_name, data, user_query_params + ) + self.nb_object = self._nb_endpoint_get(nb_endpoint, object_query_params, name) + + if self.state == "present": + self._ensure_object_exists(nb_endpoint, endpoint_name, name, data) + elif self.state == "absent": + self._ensure_object_absent(endpoint_name, name) + + try: + serialized_object = self.nb_object.serialize() + except AttributeError: + serialized_object = self.nb_object + + self.result.update({endpoint_name: serialized_object}) + + self.module.exit_json(**self.result) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_ipam.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_ipam.py new file mode 100644 index 00000000..3f9bb99f --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_ipam.py @@ -0,0 +1,219 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@fragmentedpacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +# Import necessary packages +import traceback +from ansible_collections.ansible.netcommon.plugins.module_utils.compat import ipaddress +from ansible.module_utils._text import to_text +from ansible.module_utils.basic import missing_required_lib + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxModule, + ENDPOINT_NAME_MAPPING, + SLUG_REQUIRED, +) + + +NB_AGGREGATES = "aggregates" +NB_IP_ADDRESSES = "ip_addresses" +NB_PREFIXES = "prefixes" +NB_IPAM_ROLES = "roles" +NB_RIRS = "rirs" +NB_VLANS = "vlans" +NB_VLAN_GROUPS = "vlan_groups" +NB_VRFS = "vrfs" +NB_SERVICES = "services" + + +class NetboxIpamModule(NetboxModule): + def __init__(self, module, endpoint): + super().__init__(module, endpoint) + + def _handle_state_new_present(self, nb_app, nb_endpoint, endpoint_name, name, data): + if data.get("address"): + if self.state == "present": + self._ensure_object_exists(nb_endpoint, endpoint_name, name, data) + elif self.state == "new": + self.nb_object, diff = self._create_netbox_object(nb_endpoint, data) + self.result["msg"] = "%s %s created" % (endpoint_name, name) + self.result["changed"] = True + self.result["diff"] = diff + else: + if self.state == "present": + self._ensure_ip_in_prefix_present_on_netif( + nb_app, nb_endpoint, data, endpoint_name + ) + elif self.state == "new": + self._get_new_available_ip_address(nb_app, data, endpoint_name) + + def _ensure_ip_in_prefix_present_on_netif( + self, nb_app, nb_endpoint, data, endpoint_name + ): + query_params = { + "parent": data["prefix"], + } + + if not self._version_check_greater(self.version, "2.9", greater_or_equal=True): + if not data.get("interface") or not data.get("prefix"): + self._handle_errors("A prefix and interface is required") + data_intf_key = "interface" + + else: + if not data.get("assigned_object_id") or not data.get("prefix"): + self._handle_errors("A prefix and assigned_object is required") + data_intf_key = "assigned_object_id" + + intf_obj_type = data.get("assigned_object_type", "dcim.interface") + if intf_obj_type == "virtualization.vminterface": + intf_type = "vminterface_id" + else: + intf_type = "interface_id" + + query_params.update({intf_type: data[data_intf_key]}) + + if data.get("vrf"): + query_params["vrf_id"] = data["vrf"] + + attached_ips = nb_endpoint.filter(**query_params) + if attached_ips: + self.nb_object = attached_ips[-1].serialize() + self.result["changed"] = False + self.result["msg"] = "%s %s already attached" % ( + endpoint_name, + self.nb_object["address"], + ) + else: + self._get_new_available_ip_address(nb_app, data, endpoint_name) + + def _get_new_available_ip_address(self, nb_app, data, endpoint_name): + prefix_query = self._build_query_params("prefix", data) + prefix = self._nb_endpoint_get(nb_app.prefixes, prefix_query, data["prefix"]) + if not prefix: + self.result["changed"] = False + self.result["msg"] = "%s does not exist - please create first" % ( + data["prefix"] + ) + elif prefix.available_ips.list(): + self.nb_object, diff = self._create_netbox_object( + prefix.available_ips, data + ) + self.nb_object = self.nb_object.serialize() + self.result["changed"] = True + self.result["msg"] = "%s %s created" % ( + endpoint_name, + self.nb_object["address"], + ) + self.result["diff"] = diff + else: + self.result["changed"] = False + self.result["msg"] = "No available IPs available within %s" % ( + data["prefix"] + ) + + def _get_new_available_prefix(self, data, endpoint_name): + if not self.nb_object: + self.result["changed"] = False + self.result["msg"] = "Parent prefix does not exist - %s" % (data["parent"]) + elif self.nb_object.available_prefixes.list(): + if self.check_mode: + self.result["changed"] = True + self.result["msg"] = "New prefix created within %s" % (data["parent"]) + self.module.exit_json(**self.result) + + self.nb_object, diff = self._create_netbox_object( + self.nb_object.available_prefixes, data + ) + self.nb_object = self.nb_object.serialize() + self.result["changed"] = True + self.result["msg"] = "%s %s created" % ( + endpoint_name, + self.nb_object["prefix"], + ) + self.result["diff"] = diff + else: + self.result["changed"] = False + self.result["msg"] = "No available prefixes within %s" % (data["parent"]) + + def run(self): + """ + This function should have all necessary code for endpoints within the application + to create/update/delete the endpoint objects + Supported endpoints: + - aggregates + - ipam_roles + - ip_addresses + - prefixes + - rirs + - vlans + - vlan_groups + - vrfs + """ + # Used to dynamically set key when returning results + endpoint_name = ENDPOINT_NAME_MAPPING[self.endpoint] + + self.result = {"changed": False} + + application = self._find_app(self.endpoint) + nb_app = getattr(self.nb, application) + nb_endpoint = getattr(nb_app, self.endpoint) + user_query_params = self.module.params.get("query_params") + + data = self.data + + if self.endpoint == "ip_addresses": + if data.get("address"): + try: + data["address"] = to_text(ipaddress.ip_network(data["address"])) + except ValueError: + pass + name = data.get("address") + elif self.endpoint in ["aggregates", "prefixes"]: + name = data.get("prefix") + else: + name = data.get("name") + + if self.endpoint in SLUG_REQUIRED: + if not data.get("slug"): + data["slug"] = self._to_slug(name) + + if self.module.params.get("first_available"): + first_available = True + else: + first_available = False + + object_query_params = self._build_query_params( + endpoint_name, data, user_query_params + ) + if data.get("prefix") and self.endpoint == "ip_addresses": + object_query_params = self._build_query_params("prefix", data) + self.nb_object = self._nb_endpoint_get( + nb_app.prefixes, object_query_params, name + ) + else: + self.nb_object = self._nb_endpoint_get( + nb_endpoint, object_query_params, name + ) + + if self.state in ("new", "present") and endpoint_name == "ip_address": + self._handle_state_new_present( + nb_app, nb_endpoint, endpoint_name, name, data + ) + elif self.state == "present" and first_available and data.get("parent"): + self._get_new_available_prefix(data, endpoint_name) + elif self.state == "present": + self._ensure_object_exists(nb_endpoint, endpoint_name, name, data) + elif self.state == "absent": + self._ensure_object_absent(endpoint_name, name) + + try: + serialized_object = self.nb_object.serialize() + except AttributeError: + serialized_object = self.nb_object + + self.result.update({endpoint_name: serialized_object}) + + self.module.exit_json(**self.result) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_secrets.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_secrets.py new file mode 100644 index 00000000..3bce9655 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_secrets.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@fragmentedpacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxModule, + ENDPOINT_NAME_MAPPING, +) + + +class NetboxSecretsModule(NetboxModule): + def __init__(self, module, endpoint): + super().__init__(module, endpoint) + + def run(self): + """ + This function should have all necessary code for endpoints within the application + to create/update/delete the endpoint objects + Supported endpoints: + """ + # Used to dynamically set key when returning results + endpoint_name = ENDPOINT_NAME_MAPPING[self.endpoint] + + self.result = {"changed": False} + + application = self._find_app(self.endpoint) + nb_app = getattr(self.nb, application) + nb_endpoint = getattr(nb_app, self.endpoint) + user_query_params = self.module.params.get("query_params") + + data = self.data + + # Used for msg output + name = data.get("name") + + data["slug"] = self._to_slug(name) + + object_query_params = self._build_query_params( + endpoint_name, data, user_query_params + ) + self.nb_object = self._nb_endpoint_get(nb_endpoint, object_query_params, name) + + if self.state == "present": + self._ensure_object_exists(nb_endpoint, endpoint_name, name, data) + elif self.state == "absent": + self._ensure_object_absent(endpoint_name, name) + + try: + serialized_object = self.nb_object.serialize() + except AttributeError: + serialized_object = self.nb_object + + self.result.update({endpoint_name: serialized_object}) + + self.module.exit_json(**self.result) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_tenancy.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_tenancy.py new file mode 100644 index 00000000..babcee62 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_tenancy.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@fragmentedpacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxModule, + ENDPOINT_NAME_MAPPING, + SLUG_REQUIRED, +) + + +NB_TENANTS = "tenants" +NB_TENANT_GROUPS = "tenant_groups" + + +class NetboxTenancyModule(NetboxModule): + def __init__(self, module, endpoint): + super().__init__(module, endpoint) + + def run(self): + """ + This function should have all necessary code for endpoints within the application + to create/update/delete the endpoint objects + Supported endpoints: + tenants + tenant groups + """ + # Used to dynamically set key when returning results + endpoint_name = ENDPOINT_NAME_MAPPING[self.endpoint] + + self.result = {"changed": False} + + application = self._find_app(self.endpoint) + nb_app = getattr(self.nb, application) + nb_endpoint = getattr(nb_app, self.endpoint) + user_query_params = self.module.params.get("query_params") + + data = self.data + + # Used for msg output + if data.get("name"): + name = data["name"] + elif data.get("slug"): + name = data["slug"] + + if self.endpoint in SLUG_REQUIRED: + if not data.get("slug"): + data["slug"] = self._to_slug(name) + + object_query_params = self._build_query_params( + endpoint_name, data, user_query_params + ) + self.nb_object = self._nb_endpoint_get(nb_endpoint, object_query_params, name) + + if self.state == "present": + self._ensure_object_exists(nb_endpoint, endpoint_name, name, data) + elif self.state == "absent": + self._ensure_object_absent(endpoint_name, name) + + try: + serialized_object = self.nb_object.serialize() + except AttributeError: + serialized_object = self.nb_object + + self.result.update({endpoint_name: serialized_object}) + + self.module.exit_json(**self.result) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py new file mode 100644 index 00000000..36252886 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py @@ -0,0 +1,1275 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@fragmentedpacket) <mikhail.yohman@gmail.com> +# Copyright: (c) 2018, David Gomez (@amb1s1) <david.gomez@networktocode.com> +# Copyright: (c) 2020, Nokia, Tobias Groß (@toerb) <tobias.gross@nokia.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +# Import necessary packages +import traceback +import re +import json + +from itertools import chain + +from ansible_collections.ansible.netcommon.plugins.module_utils.compat import ipaddress + +from ansible.module_utils.common.text.converters import to_text + +from ansible.module_utils._text import to_native +from ansible.module_utils.common.collections import is_iterable +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.urls import open_url + +PYNETBOX_IMP_ERR = None +try: + import pynetbox + import requests + + HAS_PYNETBOX = True +except ImportError: + PYNETBOX_IMP_ERR = traceback.format_exc() + HAS_PYNETBOX = False + +# Used to map endpoints to applications dynamically +API_APPS_ENDPOINTS = dict( + circuits=["circuits", "circuit_types", "circuit_terminations", "providers"], + dcim=[ + "cables", + "console_ports", + "console_port_templates", + "console_server_ports", + "console_server_port_templates", + "device_bays", + "device_bay_templates", + "devices", + "device_roles", + "device_types", + "front_ports", + "front_port_templates", + "interfaces", + "interface_templates", + "inventory_items", + "manufacturers", + "platforms", + "power_feeds", + "power_outlets", + "power_outlet_templates", + "power_panels", + "power_ports", + "power_port_templates", + "racks", + "rack_groups", + "rack_roles", + "rear_ports", + "rear_port_templates", + "regions", + "sites", + "virtual_chassis", + ], + extras=["tags"], + ipam=[ + "aggregates", + "ip_addresses", + "prefixes", + "rirs", + "roles", + "vlans", + "vlan_groups", + "vrfs", + "services", + ], + secrets=[], + tenancy=["tenants", "tenant_groups"], + virtualization=["cluster_groups", "cluster_types", "clusters", "virtual_machines"], +) + +# Used to normalize data for the respective query types used to find endpoints +QUERY_TYPES = dict( + circuit="cid", + circuit_termination="circuit", + circuit_type="slug", + cluster="name", + cluster_group="slug", + cluster_type="slug", + device="name", + device_role="slug", + device_type="slug", + group="slug", + installed_device="name", + manufacturer="slug", + nat_inside="address", + nat_outside="address", + parent_region="slug", + power_panel="name", + power_port="name", + platform="slug", + prefix_role="slug", + primary_ip="address", + primary_ip4="address", + primary_ip6="address", + provider="slug", + rack="name", + rack_group="slug", + rack_role="slug", + rear_port="name", + rear_port_template="name", + region="slug", + rir="slug", + slug="slug", + site="slug", + tenant="slug", + tenant_group="slug", + time_zone="timezone", + virtual_machine="name", + virtual_machine_role="slug", + vlan="name", + vlan_group="slug", + vlan_role="name", + vrf="name", +) + +# Specifies keys within data that need to be converted to ID and the endpoint to be used when queried +CONVERT_TO_ID = { + "assigned_object": "assigned_object", + "circuit": "circuits", + "circuit_type": "circuit_types", + "circuit_termination": "circuit_terminations", + "circuits.circuittermination": "circuit_terminations", + "cluster": "clusters", + "cluster_group": "cluster_groups", + "cluster_type": "cluster_types", + "dcim.consoleport": "console_ports", + "dcim.consoleserverport": "console_server_ports", + "dcim.frontport": "front_ports", + "dcim.interface": "interfaces", + "dcim.powerfeed": "power_feeds", + "dcim.poweroutlet": "power_outlets", + "dcim.powerport": "power_ports", + "dcim.rearport": "rear_ports", + "device": "devices", + "device_role": "device_roles", + "device_type": "device_types", + "group": "tenant_groups", + "installed_device": "devices", + "interface": "interfaces", + "interface_template": "interface_templates", + "ip_addresses": "ip_addresses", + "ipaddresses": "ip_addresses", + "lag": "interfaces", + "manufacturer": "manufacturers", + "master": "devices", + "nat_inside": "ip_addresses", + "nat_outside": "ip_addresses", + "platform": "platforms", + "parent_region": "regions", + "power_panel": "power_panels", + "power_port": "power_ports", + "prefix_role": "roles", + "primary_ip": "ip_addresses", + "primary_ip4": "ip_addresses", + "primary_ip6": "ip_addresses", + "provider": "providers", + "rack": "racks", + "rack_group": "rack_groups", + "rack_role": "rack_roles", + "region": "regions", + "rear_port": "rear_ports", + "rear_port_template": "rear_port_templates", + "rir": "rirs", + "services": "services", + "site": "sites", + "tags": "tags", + "tagged_vlans": "vlans", + "tenant": "tenants", + "tenant_group": "tenant_groups", + "termination_a": "interfaces", + "termination_b": "interfaces", + "untagged_vlan": "vlans", + "virtual_chassis": "virtual_chassis", + "virtual_machine": "virtual_machines", + "virtual_machine_role": "device_roles", + "vlan": "vlans", + "vlan_group": "vlan_groups", + "vlan_role": "roles", + "vrf": "vrfs", +} + +ENDPOINT_NAME_MAPPING = { + "aggregates": "aggregate", + "cables": "cable", + "circuit_terminations": "circuit_termination", + "circuit_types": "circuit_type", + "circuits": "circuit", + "clusters": "cluster", + "cluster_groups": "cluster_group", + "cluster_types": "cluster_type", + "console_ports": "console_port", + "console_port_templates": "console_port_template", + "console_server_ports": "console_server_port", + "console_server_port_templates": "console_server_port_template", + "device_bays": "device_bay", + "device_bay_templates": "device_bay_template", + "devices": "device", + "device_roles": "device_role", + "device_types": "device_type", + "front_ports": "front_port", + "front_port_templates": "front_port_template", + "interfaces": "interface", + "interface_templates": "interface_template", + "inventory_items": "inventory_item", + "ip_addresses": "ip_address", + "manufacturers": "manufacturer", + "platforms": "platform", + "power_feeds": "power_feed", + "power_outlets": "power_outlet", + "power_outlet_templates": "power_outlet_template", + "power_panels": "power_panel", + "power_ports": "power_port", + "power_port_templates": "power_port_template", + "prefixes": "prefix", + "providers": "provider", + "racks": "rack", + "rack_groups": "rack_group", + "rack_roles": "rack_role", + "rear_ports": "rear_port", + "rear_port_templates": "rear_port_template", + "regions": "region", + "rirs": "rir", + "roles": "role", + "services": "services", + "sites": "site", + "tags": "tags", + "tenants": "tenant", + "tenant_groups": "tenant_group", + "virtual_chassis": "virtual_chassis", + "virtual_machines": "virtual_machine", + "vlans": "vlan", + "vlan_groups": "vlan_group", + "vrfs": "vrf", +} + +ALLOWED_QUERY_PARAMS = { + "aggregate": set(["prefix", "rir"]), + "assigned_object": set(["name", "device", "virtual_machine"]), + "circuit": set(["cid"]), + "circuit_type": set(["slug"]), + "circuit_termination": set(["circuit", "term_side"]), + "circuits.circuittermination": set(["circuit", "term_side"]), + "cluster": set(["name", "type"]), + "cluster_group": set(["slug"]), + "cluster_type": set(["slug"]), + "console_port": set(["name", "device"]), + "console_port_template": set(["name", "device_type"]), + "console_server_port": set(["name", "device"]), + "console_server_port_template": set(["name", "device_type"]), + "dcim.consoleport": set(["name", "device"]), + "dcim.consoleserverport": set(["name", "device"]), + "dcim.frontport": set(["name", "device", "rear_port"]), + "dcim.interface": set(["name", "device", "virtual_machine"]), + "dcim.powerfeed": set(["name", "power_panel"]), + "dcim.poweroutlet": set(["name", "device"]), + "dcim.powerport": set(["name", "device"]), + "dcim.rearport": set(["name", "device"]), + "device_bay": set(["name", "device"]), + "device_bay_template": set(["name", "device_type"]), + "device": set(["name"]), + "device_role": set(["slug"]), + "device_type": set(["slug"]), + "front_port": set(["name", "device", "rear_port"]), + "front_port_template": set(["name", "device_type", "rear_port"]), + "installed_device": set(["name"]), + "interface": set(["name", "device", "virtual_machine"]), + "interface_template": set(["name", "device_type"]), + "inventory_item": set(["name", "device"]), + "ip_address": set(["address", "vrf", "interface"]), + "ip_addresses": set(["address", "vrf", "device", "interface"]), + "ipaddresses": set(["address", "vrf", "device", "interface"]), + "lag": set(["name"]), + "manufacturer": set(["slug"]), + "master": set(["name"]), + "nat_inside": set(["vrf", "address"]), + "parent_region": set(["slug"]), + "platform": set(["slug"]), + "power_feed": set(["name", "power_panel"]), + "power_outlet": set(["name", "device"]), + "power_outlet_template": set(["name", "device_type"]), + "power_panel": set(["name", "site"]), + "power_port": set(["name", "device"]), + "power_port_template": set(["name", "device_type"]), + "prefix": set(["prefix", "vrf"]), + "primary_ip4": set(["address", "vrf"]), + "primary_ip6": set(["address", "vrf"]), + "provider": set(["slug"]), + "rack": set(["name", "site"]), + "rack_group": set(["slug"]), + "rack_role": set(["slug"]), + "region": set(["slug"]), + "rear_port": set(["name", "device"]), + "rear_port_template": set(["name", "device_type"]), + "rir": set(["slug"]), + "role": set(["slug"]), + "services": set(["device", "virtual_machine", "name", "port", "protocol"]), + "site": set(["slug"]), + "tags": set(["slug"]), + "tagged_vlans": set(["group", "name", "site", "vid", "vlan_group", "tenant"]), + "tenant": set(["slug"]), + "tenant_group": set(["slug"]), + "termination_a": set(["name", "device", "virtual_machine"]), + "termination_b": set(["name", "device", "virtual_machine"]), + "untagged_vlan": set(["group", "name", "site", "vid", "vlan_group", "tenant"]), + "virtual_chassis": set(["master"]), + "virtual_machine": set(["name", "cluster"]), + "vlan": set(["group", "name", "site", "tenant", "vid", "vlan_group"]), + "vlan_group": set(["slug", "site"]), + "vrf": set(["name", "tenant"]), +} + +QUERY_PARAMS_IDS = set( + [ + "circuit", + "cluster", + "device", + "group", + "interface", + "rir", + "vrf", + "site", + "tenant", + "type", + "virtual_machine", + ] +) + +REQUIRED_ID_FIND = { + "cables": set(["status", "type", "length_unit"]), + "circuits": set(["status"]), + "console_ports": set(["type"]), + "console_port_templates": set(["type"]), + "console_server_ports": set(["type"]), + "console_server_port_templates": set(["type"]), + "devices": set(["status", "face"]), + "device_types": set(["subdevice_role"]), + "front_ports": set(["type"]), + "front_port_templates": set(["type"]), + "interfaces": set(["form_factor", "mode", "type"]), + "interface_templates": set(["type"]), + "ip_addresses": set(["status", "role"]), + "prefixes": set(["status"]), + "power_feeds": set(["status", "type", "supply", "phase"]), + "power_outlets": set(["type", "feed_leg"]), + "power_outlet_templates": set(["type", "feed_leg"]), + "power_ports": set(["type"]), + "power_port_templates": set(["type"]), + "racks": set(["status", "outer_unit", "type"]), + "rear_ports": set(["type"]), + "rear_port_templates": set(["type"]), + "services": set(["protocol"]), + "sites": set(["status"]), + "virtual_machines": set(["status", "face"]), + "vlans": set(["status"]), +} + +# This is used to map non-clashing keys to Netbox API compliant keys to prevent bad logic in code for similar keys but different modules +CONVERT_KEYS = { + "assigned_object": "assigned_object_id", + "circuit_type": "type", + "cluster_type": "type", + "cluster_group": "group", + "parent_region": "parent", + "prefix_role": "role", + "rack_group": "group", + "rack_role": "role", + "rear_port_template": "rear_port", + "rear_port_template_position": "rear_port_position", + "tenant_group": "group", + "termination_a": "termination_a_id", + "termination_b": "termination_b_id", + "virtual_machine_role": "role", + "vlan_role": "role", + "vlan_group": "group", +} + +# This is used to dynamically convert name to slug on endpoints requiring a slug +SLUG_REQUIRED = { + "circuit_types", + "cluster_groups", + "cluster_types", + "device_roles", + "device_types", + "ipam_roles", + "rack_groups", + "rack_roles", + "regions", + "rirs", + "roles", + "sites", + "tags", + "tenants", + "tenant_groups", + "manufacturers", + "platforms", + "providers", + "vlan_groups", +} + +NETBOX_ARG_SPEC = dict( + netbox_url=dict(type="str", required=True), + netbox_token=dict(type="str", required=True, no_log=True), + state=dict(required=False, default="present", choices=["present", "absent"]), + query_params=dict(required=False, type="list", elements="str"), + validate_certs=dict(type="raw", default=True), +) + + +class NetboxModule(object): + """ + Initialize connection to Netbox, sets AnsibleModule passed in to + self.module to be used throughout the class + :params module (obj): Ansible Module object + :params endpoint (str): Used to tell class which endpoint the logic needs to follow + :params nb_client (obj): pynetbox.api object passed in (not required) + """ + + def __init__(self, module, endpoint, nb_client=None): + self.module = module + self.state = self.module.params["state"] + self.check_mode = self.module.check_mode + self.endpoint = endpoint + query_params = self.module.params.get("query_params") + + if not HAS_PYNETBOX: + self.module.fail_json( + msg=missing_required_lib("pynetbox"), exception=PYNETBOX_IMP_ERR + ) + # These should not be required after making connection to Netbox + url = self.module.params["netbox_url"] + token = self.module.params["netbox_token"] + ssl_verify = self.module.params["validate_certs"] + + # Attempt to initiate connection to Netbox + if nb_client is None: + self.nb = self._connect_netbox_api(url, token, ssl_verify) + else: + self.nb = nb_client + try: + self.version = self.nb.version + except AttributeError: + self.module.fail_json(msg="Must have pynetbox >=4.1.0") + + # if self.module.params.get("query_params"): + # self._validate_query_params(self.module.params["query_params"]) + + # These methods will normalize the regular data + cleaned_data = self._remove_arg_spec_default(module.params["data"]) + norm_data = self._normalize_data(cleaned_data) + choices_data = self._change_choices_id(self.endpoint, norm_data) + data = self._find_ids(choices_data, query_params) + self.data = self._convert_identical_keys(data) + + def _version_check_greater(self, greater, lesser, greater_or_equal=False): + """Determine if first argument is greater than second argument. + + Args: + greater (str): decimal string + lesser (str): decimal string + """ + g_major, g_minor = greater.split(".") + l_major, l_minor = lesser.split(".") + + # convert to ints + g_major = int(g_major) + g_minor = int(g_minor) + l_major = int(l_major) + l_minor = int(l_minor) + + # If major version is higher then return true right off the bat + if g_major > l_major: + return True + elif greater_or_equal and g_major == l_major and g_minor >= l_minor: + return True + # If major versions are equal, and minor version is higher, return True + elif g_major == l_major and g_minor > l_minor: + return True + + def _connect_netbox_api(self, url, token, ssl_verify): + try: + session = requests.Session() + session.verify = ssl_verify + nb = pynetbox.api(url, token=token) + nb.http_session = session + try: + self.version = nb.version + except AttributeError: + self.module.fail_json(msg="Must have pynetbox >=4.1.0") + except Exception: + self.module.fail_json( + msg="Failed to establish connection to Netbox API" + ) + return nb + except Exception: + self.module.fail_json(msg="Failed to establish connection to Netbox API") + + def _nb_endpoint_get(self, nb_endpoint, query_params, search_item): + try: + response = nb_endpoint.get(**query_params) + except pynetbox.RequestError as e: + self._handle_errors(msg=e.error) + except ValueError: + self._handle_errors( + msg="More than one result returned for %s" % (search_item) + ) + + return response + + def _validate_query_params(self, query_params): + """ + Validate query_params that are passed in by users to make sure + they're valid and return error if they're not valid. + """ + invalid_query_params = [] + + app = self._find_app(self.endpoint) + nb_app = getattr(self.nb, app) + nb_endpoint = getattr(nb_app, self.endpoint) + # Fetch the OpenAPI spec to perform validation against + base_url = self.nb.base_url + junk, endpoint_url = nb_endpoint.url.split(base_url) + response = open_url(base_url + "/docs/?format=openapi") + try: + raw_data = to_text(response.read(), errors="surrogate_or_strict") + except UnicodeError: + self._handle_errors( + msg="Incorrect encoding of fetched payload from NetBox API." + ) + + try: + openapi = json.loads(raw_data) + except ValueError: + self._handle_errors(msg="Incorrect JSON payload returned: %s" % raw_data) + + valid_query_params = openapi["paths"][endpoint_url + "/"]["get"]["parameters"] + + # Loop over passed in params and add to invalid_query_params and then fail if non-empty + for param in query_params: + if param not in valid_query_params: + invalid_query_params.append(param) + + if invalid_query_params: + self._handle_errors( + "The following query_params are invalid: {0}".format( + ", ".join(invalid_query_params) + ) + ) + + def _handle_errors(self, msg): + """ + Returns message and changed = False + :params msg (str): Message indicating why there is no change + """ + if msg: + self.module.fail_json(msg=msg, changed=False) + + def _build_diff(self, before=None, after=None): + """Builds diff of before and after changes""" + return {"before": before, "after": after} + + def _convert_identical_keys(self, data): + """ + Used to change non-clashing keys for each module into identical keys that are required + to be passed to pynetbox + ex. rack_role back into role to pass to Netbox + Returns data + :params data (dict): Data dictionary after _find_ids method ran + """ + temp_dict = dict() + if self._version_check_greater(self.version, "2.7", greater_or_equal=True): + if data.get("form_factor"): + temp_dict["type"] = data.pop("form_factor") + for key in data: + if self.endpoint == "power_panels" and key == "rack_group": + temp_dict[key] = data[key] + elif key in CONVERT_KEYS: + # This will keep the original key for assigned_object, but also convert to assigned_object_id + if key == "assigned_object": + temp_dict[key] = data[key] + new_key = CONVERT_KEYS[key] + temp_dict[new_key] = data[key] + else: + temp_dict[key] = data[key] + + return temp_dict + + def _remove_arg_spec_default(self, data): + """Used to remove any data keys that were not provided by user, but has the arg spec + default values + """ + new_dict = dict() + for k, v in data.items(): + if isinstance(v, dict): + v = self._remove_arg_spec_default(v) + new_dict[k] = v + elif v is not None: + new_dict[k] = v + + return new_dict + + def _get_query_param_id(self, match, data): + """Used to find IDs of necessary searches when required under _build_query_params + :returns id (int) or data (dict): Either returns the ID or original data passed in + :params match (str): The key within the user defined data that is required to have an ID + :params data (dict): User defined data passed into the module + """ + if isinstance(data.get(match), int): + return data[match] + else: + endpoint = CONVERT_TO_ID[match] + app = self._find_app(endpoint) + nb_app = getattr(self.nb, app) + nb_endpoint = getattr(nb_app, endpoint) + + query_params = {QUERY_TYPES.get(match): data[match]} + result = self._nb_endpoint_get(nb_endpoint, query_params, match) + + if result: + return result.id + else: + return data + + def _build_query_params( + self, parent, module_data, user_query_params=None, child=None + ): + """ + :returns dict(query_dict): Returns a query dictionary built using mappings to dynamically + build available query params for Netbox endpoints + :params parent(str): This is either a key from `_find_ids` or a string passed in to determine + which keys in the data that we need to use to construct `query_dict` + :params module_data(dict): Uses the data provided to the Netbox module + :params child(dict): This is used within `_find_ids` and passes the inner dictionary + to build the appropriate `query_dict` for the parent + """ + # This is to change the parent key to use the proper ALLOWED_QUERY_PARAMS below for termination searches. + if parent == "termination_a" and module_data.get("termination_a_type"): + parent = module_data["termination_a_type"] + elif parent == "termination_b" and module_data.get("termination_b_type"): + parent = module_data["termination_b_type"] + + query_dict = dict() + if user_query_params: + query_params = set(user_query_params) + else: + query_params = ALLOWED_QUERY_PARAMS.get(parent) + + if child: + matches = query_params.intersection(set(child.keys())) + else: + matches = query_params.intersection(set(module_data.keys())) + + for match in matches: + if match in QUERY_PARAMS_IDS: + if child: + query_id = self._get_query_param_id(match, child) + else: + query_id = self._get_query_param_id(match, module_data) + query_dict.update({match + "_id": query_id}) + else: + if child: + value = child.get(match) + else: + value = module_data.get(match) + query_dict.update({match: value}) + + if user_query_params: + # This is to skip any potential changes using module_data when the user + # provides user_query_params + pass + elif parent == "lag": + if not child: + query_dict["name"] = module_data["lag"] + intf_type = self._fetch_choice_value( + "Link Aggregation Group (LAG)", "interfaces" + ) + query_dict.update({"form_factor": intf_type}) + if isinstance(module_data["device"], int): + query_dict.update({"device_id": module_data["device"]}) + else: + query_dict.update({"device": module_data["device"]}) + + elif parent == "prefix" and module_data.get("parent"): + query_dict.update({"prefix": module_data["parent"]}) + + # This is for netbox_ipam and netbox_ip_address module + elif parent == "ip_address" and module_data.get("assigned_object_type"): + if module_data["assigned_object_type"] == "virtualization.vminterface": + query_dict.update( + {"vminterface_id": module_data.get("assigned_object_id")} + ) + elif module_data["assigned_object_type"] == "dcim.interface": + query_dict.update( + {"interface_id": module_data.get("assigned_object_id")} + ) + + elif parent == "ip_addresses": + if isinstance(module_data["device"], int): + query_dict.update({"device_id": module_data["device"]}) + else: + query_dict.update({"device": module_data["device"]}) + + elif parent == "virtual_chassis": + query_dict = {"q": self.module.params["data"].get("master")} + + elif parent == "rear_port" and self.endpoint == "front_ports": + if isinstance(module_data.get("rear_port"), str): + rear_port = { + "device_id": module_data.get("device"), + "name": module_data.get("rear_port"), + } + query_dict.update(rear_port) + + elif parent == "rear_port_template" and self.endpoint == "front_port_templates": + if isinstance(module_data.get("rear_port_template"), str): + rear_port_template = { + "devicetype_id": module_data.get("device_type"), + "name": module_data.get("rear_port_template"), + } + query_dict.update(rear_port_template) + + elif "_template" in parent: + if query_dict.get("device_type"): + query_dict["devicetype_id"] = query_dict.pop("device_type") + + query_dict = self._convert_identical_keys(query_dict) + return query_dict + + def _fetch_choice_value(self, search, endpoint): + app = self._find_app(endpoint) + nb_app = getattr(self.nb, app) + nb_endpoint = getattr(nb_app, endpoint) + try: + endpoint_choices = nb_endpoint.choices() + except ValueError: + self._handle_errors( + msg="Failed to fetch endpoint choices to validate against. This requires a write-enabled token. Make sure the token is write-enabled. If looking to fetch only information, use either the inventory or lookup plugin." + ) + + choices = [x for x in chain.from_iterable(endpoint_choices.values())] + + for item in choices: + if item["display_name"].lower() == search.lower(): + return item["value"] + elif item["value"] == search.lower(): + return item["value"] + self._handle_errors( + msg="%s was not found as a valid choice for %s" % (search, endpoint) + ) + + def _change_choices_id(self, endpoint, data): + """Used to change data that is static and under _choices for the application. + ex. DEVICE_STATUS + :returns data (dict): Returns the user defined data back with updated fields for _choices + :params endpoint (str): The endpoint that will be used for mapping to required _choices + :params data (dict): User defined data passed into the module + """ + if REQUIRED_ID_FIND.get(endpoint): + required_choices = REQUIRED_ID_FIND[endpoint] + for choice in required_choices: + if data.get(choice): + if isinstance(data[choice], int): + continue + choice_value = self._fetch_choice_value(data[choice], endpoint) + data[choice] = choice_value + + return data + + def _find_app(self, endpoint): + """Dynamically finds application of endpoint passed in using the + API_APPS_ENDPOINTS for mapping + :returns nb_app (str): The application the endpoint lives under + :params endpoint (str): The endpoint requiring resolution to application + """ + for k, v in API_APPS_ENDPOINTS.items(): + if endpoint in v: + nb_app = k + return nb_app + + def _find_ids(self, data, user_query_params): + """Will find the IDs of all user specified data if resolvable + :returns data (dict): Returns the updated dict with the IDs of user specified data + :params data (dict): User defined data passed into the module + """ + for k, v in data.items(): + if k in CONVERT_TO_ID: + if ( + not self._version_check_greater( + self.version, "2.9", greater_or_equal=True + ) + and k == "tags" + ): + continue + if k == "termination_a": + endpoint = CONVERT_TO_ID[data.get("termination_a_type")] + elif k == "termination_b": + endpoint = CONVERT_TO_ID[data.get("termination_b_type")] + elif k == "assigned_object": + endpoint = "interfaces" + else: + endpoint = CONVERT_TO_ID[k] + search = v + app = self._find_app(endpoint) + nb_app = getattr(self.nb, app) + nb_endpoint = getattr(nb_app, endpoint) + + if isinstance(v, dict): + if (k == "interface" or k == "assigned_object") and v.get( + "virtual_machine" + ): + nb_app = getattr(self.nb, "virtualization") + nb_endpoint = getattr(nb_app, endpoint) + query_params = self._build_query_params(k, data, child=v) + query_id = self._nb_endpoint_get(nb_endpoint, query_params, k) + elif isinstance(v, list): + id_list = list() + for list_item in v: + if k == "tags" and isinstance(list_item, str): + temp_dict = {"slug": self._to_slug(list_item)} + elif isinstance(list_item, dict): + norm_data = self._normalize_data(list_item) + temp_dict = self._build_query_params( + k, data, child=norm_data + ) + # If user passes in an integer, add to ID list to id_list as user + # should have passed in a tag ID + elif isinstance(list_item, int): + id_list.append(list_item) + continue + query_id = self._nb_endpoint_get(nb_endpoint, temp_dict, k) + if query_id: + id_list.append(query_id.id) + else: + self._handle_errors(msg="%s not found" % (list_item)) + else: + if k in ["lag", "rear_port", "rear_port_template"]: + query_params = self._build_query_params( + k, data, user_query_params + ) + else: + query_params = {QUERY_TYPES.get(k, "q"): search} + query_id = self._nb_endpoint_get(nb_endpoint, query_params, k) + + if isinstance(v, list): + data[k] = id_list + elif isinstance(v, int): + pass + elif query_id: + data[k] = query_id.id + else: + self._handle_errors(msg="Could not resolve id of %s: %s" % (k, v)) + + return data + + def _to_slug(self, value): + """ + :returns slug (str): Slugified value + :params value (str): Value that needs to be changed to slug format + """ + if value is None: + return value + elif isinstance(value, int): + return value + else: + removed_chars = re.sub(r"[^\-\.\w\s]", "", value) + convert_chars = re.sub(r"[\-\.\s]+", "-", removed_chars) + return convert_chars.strip().lower() + + def _normalize_data(self, data): + """ + :returns data (dict): Normalized module data to formats accepted by Netbox searches + such as changing from user specified value to slug + ex. Test Rack -> test-rack + :params data (dict): Original data from Netbox module + """ + for k, v in data.items(): + if isinstance(v, dict): + if v.get("id"): + try: + data[k] = int(v["id"]) + except (ValueError, TypeError): + pass + else: + for subk, subv in v.items(): + sub_data_type = QUERY_TYPES.get(subk, "q") + if sub_data_type == "slug": + data[k][subk] = self._to_slug(subv) + else: + data_type = QUERY_TYPES.get(k, "q") + if data_type == "slug": + data[k] = self._to_slug(v) + elif data_type == "timezone": + if " " in v: + data[k] = v.replace(" ", "_") + if k == "description": + data[k] = v.strip() + + if k == "mac_address": + data[k] = v.upper() + + # We need to assign the correct type for the assigned object so the user doesn't have to worry about this. + # We determine it by whether or not they pass in a device or virtual_machine + if data.get("assigned_object"): + if data["assigned_object"].get("device"): + data["assigned_object_type"] = "dcim.interface" + if data["assigned_object"].get("virtual_machine"): + data["assigned_object_type"] = "virtualization.vminterface" + + return data + + def _create_netbox_object(self, nb_endpoint, data): + """Create a Netbox object. + :returns tuple(serialized_nb_obj, diff): tuple of the serialized created + Netbox object and the Ansible diff. + """ + if self.check_mode: + nb_obj = data + else: + try: + nb_obj = nb_endpoint.create(data) + except pynetbox.RequestError as e: + self._handle_errors(msg=e.error) + + diff = self._build_diff(before={"state": "absent"}, after={"state": "present"}) + return nb_obj, diff + + def _delete_netbox_object(self): + """Delete a Netbox object. + :returns diff (dict): Ansible diff + """ + if not self.check_mode: + try: + self.nb_object.delete() + except pynetbox.RequestError as e: + self._handle_errors(msg=e.error) + + diff = self._build_diff(before={"state": "present"}, after={"state": "absent"}) + return diff + + def _update_netbox_object(self, data): + """Update a Netbox object. + :returns tuple(serialized_nb_obj, diff): tuple of the serialized updated + Netbox object and the Ansible diff. + """ + serialized_nb_obj = self.nb_object.serialize() + updated_obj = serialized_nb_obj.copy() + updated_obj.update(data) + if serialized_nb_obj.get("tags") and data.get("tags"): + serialized_nb_obj["tags"] = set(serialized_nb_obj["tags"]) + updated_obj["tags"] = set(data["tags"]) + + if serialized_nb_obj == updated_obj: + return serialized_nb_obj, None + else: + data_before, data_after = {}, {} + for key in data: + try: + if serialized_nb_obj[key] != updated_obj[key]: + data_before[key] = serialized_nb_obj[key] + data_after[key] = updated_obj[key] + except KeyError: + if key == "form_factor": + msg = "form_factor is not valid for NetBox 2.7 onword. Please use the type key instead." + else: + msg = ( + "%s does not exist on existing object. Check to make sure valid field." + % (key) + ) + + self._handle_errors(msg=msg) + + if not self.check_mode: + self.nb_object.update(data) + updated_obj = self.nb_object.serialize() + + diff = self._build_diff(before=data_before, after=data_after) + return updated_obj, diff + + def _ensure_object_exists(self, nb_endpoint, endpoint_name, name, data): + """Used when `state` is present to make sure object exists or if the object exists + that it is updated + :params nb_endpoint (pynetbox endpoint object): This is the nb endpoint to be used + to create or update the object + :params endpoint_name (str): Endpoint name that was created/updated. ex. device + :params name (str): Name of the object + :params data (dict): User defined data passed into the module + """ + if not self.nb_object: + self.nb_object, diff = self._create_netbox_object(nb_endpoint, data) + self.result["msg"] = "%s %s created" % (endpoint_name, name) + self.result["changed"] = True + self.result["diff"] = diff + else: + self.nb_object, diff = self._update_netbox_object(data) + if self.nb_object is False: + self._handle_errors( + msg="Request failed, couldn't update device: %s" % name + ) + if diff: + self.result["msg"] = "%s %s updated" % (endpoint_name, name) + self.result["changed"] = True + self.result["diff"] = diff + else: + self.result["msg"] = "%s %s already exists" % (endpoint_name, name) + + def _ensure_object_absent(self, endpoint_name, name): + """Used when `state` is absent to make sure object does not exist + :params endpoint_name (str): Endpoint name that was created/updated. ex. device + :params name (str): Name of the object + """ + if self.nb_object: + diff = self._delete_netbox_object() + self.result["msg"] = "%s %s deleted" % (endpoint_name, name) + self.result["changed"] = True + self.result["diff"] = diff + else: + self.result["msg"] = "%s %s already absent" % (endpoint_name, name) + + def run(self): + """ + Must be implemented in subclasses + """ + raise NotImplementedError + + +class NetboxAnsibleModule(AnsibleModule): + """ + Creating this due to needing to override some functionality to provide required_together, required_if + and will be able to override more in the future. + This is due to the Netbox modules having the module arguments within a key in the argument spec, using suboptions rather than + having all module arguments within the regular argument spec. + + Didn't want to change that functionality of the Netbox modules as its disruptive and we're required to send a specific payload + to the Netbox API + """ + + def __init__( + self, + argument_spec, + bypass_checks=False, + no_log=False, + mutually_exclusive=None, + required_together=None, + required_one_of=None, + add_file_common_args=False, + supports_check_mode=False, + required_if=None, + required_by=None, + ): + super().__init__( + argument_spec, + bypass_checks=False, + no_log=False, + mutually_exclusive=mutually_exclusive, + required_together=required_together, + required_one_of=required_one_of, + add_file_common_args=False, + supports_check_mode=supports_check_mode, + required_if=required_if, + ) + + def _check_mutually_exclusive(self, spec, param=None): + if param is None: + param = self.params + + try: + self.check_mutually_exclusive(spec, param) + except TypeError as e: + msg = to_native(e) + if self._options_context: + msg += " found in %s" % " -> ".join(self._options_context) + self.fail_json(msg=msg) + + def check_mutually_exclusive(self, terms, module_parameters): + """Check mutually exclusive terms against argument parameters + Accepts a single list or list of lists that are groups of terms that should be + mutually exclusive with one another + :arg terms: List of mutually exclusive module parameters + :arg module_parameters: Dictionary of module parameters + :returns: Empty list or raises TypeError if the check fails. + """ + + results = [] + if terms is None: + return results + + for check in terms: + count = self.count_terms(check, module_parameters["data"]) + if count > 1: + results.append(check) + + if results: + full_list = ["|".join(check) for check in results] + msg = "parameters are mutually exclusive: %s" % ", ".join(full_list) + raise TypeError(to_native(msg)) + + return results + + def _check_required_if(self, spec, param=None): + """ ensure that parameters which conditionally required are present """ + if spec is None: + return + + if param is None: + param = self.params + + try: + self.check_required_if(spec, param) + except TypeError as e: + msg = to_native(e) + if self._options_context: + msg += " found in %s" % " -> ".join(self._options_context) + self.fail_json(msg=msg) + + def check_required_if(self, requirements, module_parameters): + results = [] + if requirements is None: + return results + + for req in requirements: + missing = {} + missing["missing"] = [] + max_missing_count = 0 + is_one_of = False + if len(req) == 4: + key, val, requirements, is_one_of = req + else: + key, val, requirements = req + + # is_one_of is True at least one requirement should be + # present, else all requirements should be present. + if is_one_of: + max_missing_count = len(requirements) + missing["requires"] = "any" + else: + missing["requires"] = "all" + + if key in module_parameters and module_parameters[key] == val: + for check in requirements: + count = self.count_terms(check, module_parameters["data"]) + if count == 0: + missing["missing"].append(check) + if len(missing["missing"]) and len(missing["missing"]) >= max_missing_count: + missing["parameter"] = key + missing["value"] = val + missing["requirements"] = requirements + results.append(missing) + + if results: + for missing in results: + msg = "%s is %s but %s of the following are missing: %s" % ( + missing["parameter"], + missing["value"], + missing["requires"], + ", ".join(missing["missing"]), + ) + raise TypeError(to_native(msg)) + + return results + + def _check_required_one_of(self, spec, param=None): + if spec is None: + return + + if param is None: + param = self.params + + try: + self.check_required_one_of(spec, param) + except TypeError as e: + msg = to_native(e) + if self._options_context: + msg += " found in %s" % " -> ".join(self._options_context) + self.fail_json(msg=msg) + + def check_required_one_of(self, terms, module_parameters): + """Check each list of terms to ensure at least one exists in the given module + parameters + Accepts a list of lists or tuples + :arg terms: List of lists of terms to check. For each list of terms, at + least one is required. + :arg module_parameters: Dictionary of module parameters + :returns: Empty list or raises TypeError if the check fails. + """ + + results = [] + if terms is None: + return results + + for term in terms: + count = self.count_terms(term, module_parameters["data"]) + if count == 0: + results.append(term) + + if results: + for term in results: + msg = "one of the following is required: %s" % ", ".join(term) + raise TypeError(to_native(msg)) + + return results + + def _check_required_together(self, spec, param=None): + if spec is None: + return + if param is None: + param = self.params + + try: + self.check_required_together(spec, param) + except TypeError as e: + msg = to_native(e) + if self._options_context: + msg += " found in %s" % " -> ".join(self._options_context) + self.fail_json(msg=msg) + + def check_required_together(self, terms, module_parameters): + """Check each list of terms to ensure every parameter in each list exists + in the given module parameters + Accepts a list of lists or tuples + :arg terms: List of lists of terms to check. Each list should include + parameters that are all required when at least one is specified + in the module_parameters. + :arg module_parameters: Dictionary of module parameters + :returns: Empty list or raises TypeError if the check fails. + """ + + results = [] + if terms is None: + return results + + for term in terms: + counts = [ + self.count_terms(field, module_parameters["data"]) for field in term + ] + non_zero = [c for c in counts if c > 0] + if len(non_zero) > 0: + if 0 in counts: + results.append(term) + if results: + for term in results: + msg = "parameters are required together: %s" % ", ".join(term) + raise TypeError(to_native(msg)) + + return results + + def count_terms(self, terms, module_parameters): + """Count the number of occurrences of a key in a given dictionary + :arg terms: String or iterable of values to check + :arg module_parameters: Dictionary of module parameters + :returns: An integer that is the number of occurrences of the terms values + in the provided dictionary. + """ + + if not is_iterable(terms): + terms = [terms] + + return len(set(terms).intersection(module_parameters)) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_virtualization.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_virtualization.py new file mode 100644 index 00000000..64723baf --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/module_utils/netbox_virtualization.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@fragmentedpacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxModule, + ENDPOINT_NAME_MAPPING, + SLUG_REQUIRED, +) + + +NB_VIRTUAL_MACHINES = "virtual_machines" +NB_CLUSTERS = "clusters" +NB_CLUSTER_GROUP = "cluster_groups" +NB_CLUSTER_TYPE = "cluster_types" +NB_VM_INTERFACES = "interfaces" + + +class NetboxVirtualizationModule(NetboxModule): + def __init__(self, module, endpoint): + super().__init__(module, endpoint) + + def run(self): + """ + This function should have all necessary code for endpoints within the application + to create/update/delete the endpoint objects + Supported endpoints: + - clusters + - cluster_groups + - cluster_types + - interfaces + - virtual_machines + - netbox_cluster + """ + # Used to dynamically set key when returning results + endpoint_name = ENDPOINT_NAME_MAPPING[self.endpoint] + + self.result = {"changed": False} + + if self.endpoint == "interfaces": + application = "virtualization" + else: + application = self._find_app(self.endpoint) + nb_app = getattr(self.nb, application) + nb_endpoint = getattr(nb_app, self.endpoint) + user_query_params = self.module.params.get("query_params") + + data = self.data + + # Used for msg output + if data.get("name"): + name = data["name"] + elif data.get("slug"): + name = data["slug"] + + if self.endpoint in SLUG_REQUIRED: + if not data.get("slug"): + data["slug"] = self._to_slug(name) + + object_query_params = self._build_query_params( + endpoint_name, data, user_query_params + ) + self.nb_object = self._nb_endpoint_get(nb_endpoint, object_query_params, name) + + if self.state == "present": + self._ensure_object_exists(nb_endpoint, endpoint_name, name, data) + elif self.state == "absent": + self._ensure_object_absent(endpoint_name, name) + + try: + serialized_object = self.nb_object.serialize() + except AttributeError: + serialized_object = self.nb_object + + self.result.update({endpoint_name: serialized_object}) + + self.module.exit_json(**self.result) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/__init__.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/__init__.py diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_aggregate.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_aggregate.py new file mode 100644 index 00000000..b3ee1066 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_aggregate.py @@ -0,0 +1,191 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_aggregate +short_description: Creates or removes aggregates from Netbox +description: + - Creates or removes aggregates from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - "URL of the Netbox instance resolvable by Ansible control host" + required: true + type: str + netbox_token: + description: + - "The token created within Netbox to authorize API access" + required: true + type: str + data: + description: + - "Defines the aggregate configuration" + type: dict + suboptions: + prefix: + description: + - "The aggregate prefix" + required: true + type: raw + rir: + description: + - "The RIR the aggregate will be assigned to" + required: false + type: raw + date_added: + description: + - "Date added, format: YYYY-MM-DD" + required: false + type: str + description: + description: + - "The description of the aggregate" + required: false + type: str + tags: + description: + - "Any tags that the aggregate may need to be associated with" + required: false + type: list + custom_fields: + description: + - "must exist in Netbox" + required: false + type: dict + required: true + state: + description: + - "The state of the aggregate" + choices: [ present, absent ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - "If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates." + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox aggregate module" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create aggregate within Netbox with only required information + netbox_aggregate: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.0.0/16 + rir: Test RIR + state: present + + - name: Create aggregate with several specified options + netbox_aggregate: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.0.0/16 + rir: Test RIR + date_added: 1989-01-18 + description: Test description + tags: + - Schnozzberry + state: present + + - name: Delete aggregate within netbox + netbox_aggregate: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.0.0/16 + state: absent +""" + +RETURN = r""" +aggregate: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_ipam import ( + NetboxIpamModule, + NB_AGGREGATES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + prefix=dict(required=True, type="raw"), + rir=dict(required=False, type="raw"), + date_added=dict(required=False, type="str"), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [("state", "present", ["prefix"]), ("state", "absent", ["prefix"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_aggregate = NetboxIpamModule(module, NB_AGGREGATES) + netbox_aggregate.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cable.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cable.py new file mode 100644 index 00000000..d788c9ab --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cable.py @@ -0,0 +1,367 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_cable +short_description: Create, update or delete cables within Netbox +description: + - Creates, updates or removes cables from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.3.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the cable configuration + suboptions: + termination_a_type: + description: + - The type of the termination a + choices: + - circuits.circuittermination + - dcim.consoleport + - dcim.consoleserverport + - dcim.frontport + - dcim.interface + - dcim.powerfeed + - dcim.poweroutlet + - dcim.powerport + - dcim.rearport + required: true + type: str + termination_a: + description: + - The termination a + required: true + type: raw + termination_b_type: + description: + - The type of the termination b + choices: + - circuits.circuittermination + - dcim.consoleport + - dcim.consoleserverport + - dcim.frontport + - dcim.interface + - dcim.powerfeed + - dcim.poweroutlet + - dcim.powerport + - dcim.rearport + required: true + type: str + termination_b: + description: + - The termination b + required: true + type: raw + type: + description: + - The type of the cable + choices: + - cat3 + - cat5 + - cat5e + - cat6 + - cat6a + - cat7 + - dac-active + - dac-passive + - mrj21-trunk + - coaxial + - mmf + - mmf-om1 + - mmf-om2 + - mmf-om3 + - mmf-om4 + - smf + - smf-os1 + - smf-os2 + - aoc + - power + required: false + type: str + status: + description: + - The status of the cable + choices: + - connected + - planned + - decommissioning + required: false + type: str + label: + description: + - The label of the cable + required: false + type: str + color: + description: + - The color of the cable + required: false + type: str + length: + description: + - The length of the cable + required: false + type: int + length_unit: + description: + - The unit in which the length of the cable is measured + choices: + - m + - cm + - ft + - in + required: false + type: str + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create cable within Netbox with only required information + netbox_cable: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + state: present + + - name: Update cable with other fields + netbox_cable: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + type: mmf-om4 + status: planned + label: label123 + color: abcdef + length: 30 + length_unit: m + state: present + + - name: Delete cable within netbox + netbox_cable: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + state: absent +""" + +RETURN = r""" +cable: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_CABLES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + termination_a_type=dict( + required=True, + choices=[ + "circuits.circuittermination", + "dcim.consoleport", + "dcim.consoleserverport", + "dcim.frontport", + "dcim.interface", + "dcim.powerfeed", + "dcim.poweroutlet", + "dcim.powerport", + "dcim.rearport", + ], + type="str", + ), + termination_a=dict(required=True, type="raw"), + termination_b_type=dict( + required=True, + choices=[ + "circuits.circuittermination", + "dcim.consoleport", + "dcim.consoleserverport", + "dcim.frontport", + "dcim.interface", + "dcim.powerfeed", + "dcim.poweroutlet", + "dcim.powerport", + "dcim.rearport", + ], + type="str", + ), + termination_b=dict(required=True, type="raw"), + type=dict( + required=False, + choices=[ + "cat3", + "cat5", + "cat5e", + "cat6", + "cat6a", + "cat7", + "dac-active", + "dac-passive", + "mrj21-trunk", + "coaxial", + "mmf", + "mmf-om1", + "mmf-om2", + "mmf-om3", + "mmf-om4", + "smf", + "smf-os1", + "smf-os2", + "aoc", + "power", + ], + type="str", + ), + status=dict( + required=False, + choices=["connected", "planned", "decommissioning"], + type="str", + ), + label=dict(required=False, type="str"), + color=dict(required=False, type="str"), + length=dict(required=False, type="int"), + length_unit=dict( + required=False, choices=["m", "cm", "ft", "in"], type="str" + ), + ), + ), + ) + ) + + required_if = [ + ( + "state", + "present", + [ + "termination_a_type", + "termination_a", + "termination_b_type", + "termination_b", + ], + ), + ( + "state", + "absent", + [ + "termination_a_type", + "termination_a", + "termination_b_type", + "termination_b", + ], + ), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_cable = NetboxDcimModule(module, NB_CABLES) + netbox_cable.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_circuit.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_circuit.py new file mode 100644 index 00000000..1fdbced9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_circuit.py @@ -0,0 +1,225 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_circuit +short_description: Create, update or delete circuits within Netbox +description: + - Creates, updates or removes circuits from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the circuit configuration + suboptions: + cid: + description: + - The circuit id of the circuit + required: true + type: str + provider: + description: + - The provider of the circuit + required: false + type: raw + circuit_type: + description: + - The circuit type of the circuit + required: false + type: raw + status: + description: + - The status of the circuit + required: false + type: raw + tenant: + description: + - The tenant assigned to the circuit + required: false + type: raw + install_date: + description: + - The date the circuit was installed. e.g. YYYY-MM-DD + required: false + type: str + commit_rate: + description: + - Commit rate of the circuit (Kbps) + required: false + type: int + description: + description: + - Description of the circuit + required: false + type: str + comments: + description: + - Comments related to circuit + required: false + type: str + tags: + description: + - Any tags that the device may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create circuit within Netbox with only required information + netbox_circuit: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + cid: Test Circuit + provider: Test Provider + circuit_type: Test Circuit Type + state: present + + - name: Update circuit with other fields + netbox_circuit: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + cid: Test-Circuit-1000 + provider: Test Provider + circuit_type: Test Circuit Type + status: Active + tenant: Test Tenant + install_date: "2018-12-25" + commit_rate: 10000 + description: Test circuit + comments: "FAST CIRCUIT" + state: present + + - name: Delete circuit within netbox + netbox_circuit: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + cid: Test-Circuit-1000 + state: absent +""" + +RETURN = r""" +circuit: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_circuits import ( + NetboxCircuitsModule, + NB_CIRCUITS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + cid=dict(required=True, type="str"), + provider=dict(required=False, type="raw"), + circuit_type=dict(required=False, type="raw"), + status=dict(required=False, type="raw"), + tenant=dict(required=False, type="raw"), + install_date=dict(required=False, type="str"), + commit_rate=dict(required=False, type="int"), + description=dict(required=False, type="str"), + comments=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [("state", "present", ["cid"]), ("state", "absent", ["cid"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_circuit = NetboxCircuitsModule(module, NB_CIRCUITS) + netbox_circuit.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_circuit_termination.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_circuit_termination.py new file mode 100644 index 00000000..0b13df50 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_circuit_termination.py @@ -0,0 +1,212 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_circuit_termination +short_description: Create, update or delete circuit terminations within Netbox +description: + - Creates, updates or removes circuit terminations from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + required: true + type: dict + description: + - Defines the circuit termination configuration + suboptions: + circuit: + description: + - The circuit to assign to circuit termination + required: true + type: raw + term_side: + description: + - The side of the circuit termination + choices: + - A + - Z + required: true + type: str + site: + description: + - The site the circuit termination will be assigned to + required: false + type: raw + port_speed: + description: + - The speed of the port (Kbps) + required: false + type: int + upstream_speed: + description: + - The upstream speed of the circuit termination + required: false + type: int + xconnect_id: + description: + - The cross connect ID of the circuit termination + required: false + type: str + pp_info: + description: + - Patch panel information + required: false + type: str + description: + description: + - Description of the circuit termination + required: false + type: str + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create circuit termination within Netbox with only required information + netbox_circuit_termination: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + circuit: Test Circuit + term_side: A + site: Test Site + port_speed: 10000 + state: present + + - name: Update circuit termination with other fields + netbox_circuit_termination: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + circuit: Test Circuit + term_side: A + upstream_speed: 1000 + xconnect_id: 10X100 + pp_info: PP10-24 + description: "Test description" + state: present + + - name: Delete circuit termination within netbox + netbox_circuit_termination: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + circuit: Test Circuit + term_side: A + state: absent +""" + +RETURN = r""" +circuit_termination: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_circuits import ( + NetboxCircuitsModule, + NB_CIRCUIT_TERMINATIONS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + circuit=dict(required=True, type="raw"), + term_side=dict(required=True, choices=["A", "Z"]), + site=dict(required=False, type="raw"), + port_speed=dict(required=False, type="int"), + upstream_speed=dict(required=False, type="int"), + xconnect_id=dict(required=False, type="str"), + pp_info=dict(required=False, type="str"), + description=dict(required=False, type="str"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["circuit", "term_side"]), + ("state", "absent", ["circuit", "term_side"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_circuit_termination = NetboxCircuitsModule(module, NB_CIRCUIT_TERMINATIONS) + netbox_circuit_termination.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_circuit_type.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_circuit_type.py new file mode 100644 index 00000000..285c89ed --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_circuit_type.py @@ -0,0 +1,154 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_circuit_type +short_description: Create, update or delete circuit types within Netbox +description: + - Creates, updates or removes circuit types from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + required: true + type: dict + description: + - Defines the circuit type configuration + suboptions: + name: + description: + - The name of the circuit type + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create type within Netbox with only required information + netbox_circuit_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Circuit Type + state: present + + - name: Delete circuit type within netbox + netbox_circuit_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Circuit Type + state: absent +""" + +RETURN = r""" +circuit_type: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_circuits import ( + NetboxCircuitsModule, + NB_CIRCUIT_TYPES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_circuit_type = NetboxCircuitsModule(module, NB_CIRCUIT_TYPES) + netbox_circuit_type.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cluster.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cluster.py new file mode 100644 index 00000000..ccdd6c47 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cluster.py @@ -0,0 +1,212 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Gaelle Mangin (@gmangin) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_cluster +short_description: Create, update or delete clusters within Netbox +description: + - Creates, updates or removes clusters from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Gaelle MANGIN (@gmangin) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + required: true + type: dict + description: + - Defines the cluster configuration + suboptions: + name: + description: + - The name of the cluster + required: true + type: str + cluster_type: + description: + - type of the cluster + required: false + type: raw + cluster_group: + description: + - group of the cluster + required: false + type: raw + site: + description: + - Required if I(state=present) and the cluster does not exist yet + required: false + type: raw + comments: + description: + - Comments that may include additional information in regards to the cluster + required: false + type: str + tenant: + description: + - Tenant the cluster will be assigned to. + required: false + type: raw + tags: + description: + - Any tags that the cluster may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create cluster within Netbox with only required information + netbox_cluster: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster + cluster_type: libvirt + state: present + + - name: Delete cluster within netbox + netbox_cluster: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster + state: absent + + - name: Create cluster with tags + netbox_cluster: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Another Test Cluster + cluster_type: libvirt + tags: + - Schnozzberry + state: present + + - name: Update the group and site of an existing cluster + netbox_cluster: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster + cluster_type: qemu + cluster_group: GROUP + site: SITE + state: present +""" + +RETURN = r""" +cluster: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_virtualization import ( + NetboxVirtualizationModule, + NB_CLUSTERS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + cluster_type=dict(required=False, type="raw"), + cluster_group=dict(required=False, type="raw"), + site=dict(required=False, type="raw"), + tenant=dict(required=False, type="raw"), + comments=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_cluster = NetboxVirtualizationModule(module, NB_CLUSTERS) + netbox_cluster.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cluster_group.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cluster_group.py new file mode 100644 index 00000000..cc71fa91 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cluster_group.py @@ -0,0 +1,154 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_cluster_group +short_description: Create, update or delete cluster groups within Netbox +description: + - Creates, updates or removes cluster groups from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + required: true + type: dict + description: + - Defines the cluster group configuration + suboptions: + name: + description: + - The name of the cluster group + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create cluster group within Netbox with only required information + netbox_cluster_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster Group + state: present + + - name: Delete cluster within netbox + netbox_cluster_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster Group + state: absent +""" + +RETURN = r""" +cluster_group: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_virtualization import ( + NetboxVirtualizationModule, + NB_CLUSTER_GROUP, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_cluster_group = NetboxVirtualizationModule(module, NB_CLUSTER_GROUP) + netbox_cluster_group.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cluster_type.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cluster_type.py new file mode 100644 index 00000000..6d28fea3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_cluster_type.py @@ -0,0 +1,154 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_cluster_type +short_description: Create, update or delete cluster types within Netbox +description: + - Creates, updates or removes cluster types from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + required: true + type: dict + description: + - Defines the cluster type configuration + suboptions: + name: + description: + - The name of the cluster type + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create cluster type within Netbox with only required information + netbox_cluster_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster Type + state: present + + - name: Delete cluster within netbox + netbox_cluster_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Cluster Type + state: absent +""" + +RETURN = r""" +cluster_type: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_virtualization import ( + NetboxVirtualizationModule, + NB_CLUSTER_TYPE, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_cluster_type = NetboxVirtualizationModule(module, NB_CLUSTER_TYPE) + netbox_cluster_type.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_port.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_port.py new file mode 100644 index 00000000..704dc1a9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_port.py @@ -0,0 +1,220 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_console_port +short_description: Create, update or delete console ports within Netbox +description: + - Creates, updates or removes console ports from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the console port configuration + suboptions: + device: + description: + - The device the console port is attached to + required: true + type: raw + name: + description: + - The name of the console port + required: true + type: str + type: + description: + - The type of the console port + choices: + - de-9 + - db-25 + - rj-11 + - rj-12 + - rj-45 + - usb-a + - usb-b + - usb-c + - usb-mini-a + - usb-mini-b + - usb-micro-a + - usb-micro-b + - other + required: false + type: str + description: + description: + - Description of the console port + required: false + type: str + tags: + description: + - Any tags that the console port may need to be associated with + required: false + type: list + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create console port within Netbox with only required information + netbox_console_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port + device: Test Device + state: present + + - name: Update console port with other fields + netbox_console_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port + device: Test Device + type: usb-a + description: console port description + state: present + + - name: Delete console port within netbox + netbox_console_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port + device: Test Device + state: absent +""" + +RETURN = r""" +console_port: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_CONSOLE_PORTS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=False, + choices=[ + "de-9", + "db-25", + "rj-11", + "rj-12", + "rj-45", + "usb-a", + "usb-b", + "usb-c", + "usb-mini-a", + "usb-mini-b", + "usb-micro-a", + "usb-micro-b", + "other", + ], + type="str", + ), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device", "name"]), + ("state", "absent", ["device", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_console_port = NetboxDcimModule(module, NB_CONSOLE_PORTS) + netbox_console_port.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_port_template.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_port_template.py new file mode 100644 index 00000000..aca87a01 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_port_template.py @@ -0,0 +1,207 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_console_port_template +short_description: Create, update or delete console port templates within Netbox +description: + - Creates, updates or removes console port templates from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the console port template configuration + suboptions: + device_type: + description: + - The device type the console port template is attached to + required: true + type: raw + name: + description: + - The name of the console port template + required: true + type: str + type: + description: + - The type of the console port template + choices: + - de-9 + - db-25 + - rj-11 + - rj-12 + - rj-45 + - usb-a + - usb-b + - usb-c + - usb-mini-a + - usb-mini-b + - usb-micro-a + - usb-micro-b + - other + required: false + type: str + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create console port template within Netbox with only required information + netbox_console_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port Template + device_type: Test Device Type + state: present + + - name: Update console port template with other fields + netbox_console_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port Template + device_type: Test Device Type + type: iec-60320-c6 + state: present + + - name: Delete console port template within netbox + netbox_console_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Port Template + device_type: Test Device Type + state: absent +""" + +RETURN = r""" +console_port_template: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_CONSOLE_PORT_TEMPLATES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device_type=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=False, + choices=[ + "de-9", + "db-25", + "rj-11", + "rj-12", + "rj-45", + "usb-a", + "usb-b", + "usb-c", + "usb-mini-a", + "usb-mini-b", + "usb-micro-a", + "usb-micro-b", + "other", + ], + type="str", + ), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device_type", "name"]), + ("state", "absent", ["device_type", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_console_port_template = NetboxDcimModule(module, NB_CONSOLE_PORT_TEMPLATES) + netbox_console_port_template.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_server_port.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_server_port.py new file mode 100644 index 00000000..28eeea56 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_server_port.py @@ -0,0 +1,220 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_console_server_port +short_description: Create, update or delete console server ports within Netbox +description: + - Creates, updates or removes console server ports from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the console server port configuration + suboptions: + device: + description: + - The device the console server port is attached to + required: true + type: raw + name: + description: + - The name of the console server port + required: true + type: str + type: + description: + - The type of the console server port + choices: + - de-9 + - db-25 + - rj-11 + - rj-12 + - rj-45 + - usb-a + - usb-b + - usb-c + - usb-mini-a + - usb-mini-b + - usb-micro-a + - usb-micro-b + - other + required: false + type: str + description: + description: + - Description of the console server port + required: false + type: str + tags: + description: + - Any tags that the console server port may need to be associated with + required: false + type: list + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create console server port within Netbox with only required information + netbox_console_server_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port + device: Test Device + state: present + + - name: Update console server port with other fields + netbox_console_server_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port + device: Test Device + type: usb-a + description: console server port description + state: present + + - name: Delete console server port within netbox + netbox_console_server_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port + device: Test Device + state: absent +""" + +RETURN = r""" +console_server_port: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_CONSOLE_SERVER_PORTS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=False, + choices=[ + "de-9", + "db-25", + "rj-11", + "rj-12", + "rj-45", + "usb-a", + "usb-b", + "usb-c", + "usb-mini-a", + "usb-mini-b", + "usb-micro-a", + "usb-micro-b", + "other", + ], + type="str", + ), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device", "name"]), + ("state", "absent", ["device", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_console_server_port = NetboxDcimModule(module, NB_CONSOLE_SERVER_PORTS) + netbox_console_server_port.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_server_port_template.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_server_port_template.py new file mode 100644 index 00000000..9ce6b0ed --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_console_server_port_template.py @@ -0,0 +1,209 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_console_server_port_template +short_description: Create, update or delete console server port templates within Netbox +description: + - Creates, updates or removes console server port templates from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the console server port template configuration + suboptions: + device_type: + description: + - The device type the console server port template is attached to + required: true + type: raw + name: + description: + - The name of the console server port template + required: true + type: str + type: + description: + - The type of the console server port template + choices: + - de-9 + - db-25 + - rj-11 + - rj-12 + - rj-45 + - usb-a + - usb-b + - usb-c + - usb-mini-a + - usb-mini-b + - usb-micro-a + - usb-micro-b + - other + required: false + type: str + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create console server port template within Netbox with only required information + netbox_console_server_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port Template + device_type: Test Device Type + state: present + + - name: Update console server port template with other fields + netbox_console_server_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port Template + device_type: Test Device Type + type: iec-60320-c6 + state: present + + - name: Delete console server port template within netbox + netbox_console_server_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Console Server Port Template + device_type: Test Device Type + state: absent +""" + +RETURN = r""" +console_server_port_template: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_CONSOLE_SERVER_PORT_TEMPLATES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device_type=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=False, + choices=[ + "de-9", + "db-25", + "rj-11", + "rj-12", + "rj-45", + "usb-a", + "usb-b", + "usb-c", + "usb-mini-a", + "usb-mini-b", + "usb-micro-a", + "usb-micro-b", + "other", + ], + type="str", + ), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device_type", "name"]), + ("state", "absent", ["device_type", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_console_server_port_template = NetboxDcimModule( + module, NB_CONSOLE_SERVER_PORT_TEMPLATES + ) + netbox_console_server_port_template.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device.py new file mode 100644 index 00000000..f659d993 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device.py @@ -0,0 +1,327 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# Copyright: (c) 2018, David Gomez (@amb1s1) <david.gomez@networktocode.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_device +short_description: Create, update or delete devices within Netbox +description: + - Creates, updates or removes devices from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) + - David Gomez (@amb1s1) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + description: + - Defines the device configuration + suboptions: + name: + description: + - The name of the device + required: true + type: str + device_type: + description: + - Required if I(state=present) and the device does not exist yet + required: false + type: raw + device_role: + description: + - Required if I(state=present) and the device does not exist yet + required: false + type: raw + tenant: + description: + - The tenant that the device will be assigned to + required: false + type: raw + platform: + description: + - The platform of the device + required: false + type: raw + serial: + description: + - Serial number of the device + required: false + type: str + asset_tag: + description: + - Asset tag that is associated to the device + required: false + type: str + site: + description: + - Required if I(state=present) and the device does not exist yet + required: false + type: raw + rack: + description: + - The name of the rack to assign the device to + required: false + type: raw + position: + description: + - The position of the device in the rack defined above + required: false + type: int + face: + description: + - Required if I(rack) is defined + choices: + - Front + - front + - Rear + - rear + required: false + type: str + status: + description: + - The status of the device + required: false + type: raw + primary_ip4: + description: + - Primary IPv4 address assigned to the device + required: false + type: raw + primary_ip6: + description: + - Primary IPv6 address assigned to the device + required: false + type: raw + cluster: + description: + - Cluster that the device will be assigned to + required: false + type: raw + virtual_chassis: + description: + - Virtual chassis the device will be assigned to + required: false + type: raw + vc_position: + description: + - Position in the assigned virtual chassis + required: false + type: int + vc_priority: + description: + - Priority in the assigned virtual chassis + required: false + type: int + comments: + description: + - Comments that may include additional information in regards to the device + required: false + type: str + tags: + description: + - Any tags that the device may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + local_context_data: + description: + - Arbitrary JSON data to define the devices configuration variables. + required: false + type: dict + required: true + type: dict + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create device within Netbox with only required information + netbox_device: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Device + device_type: C9410R + device_role: Core Switch + site: Main + state: present + + - name: Create device within Netbox with empty string name to generate UUID + netbox_device: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: "" + device_type: C9410R + device_role: Core Switch + site: Main + state: present + + - name: Delete device within netbox + netbox_device: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Device + state: absent + + - name: Create device with tags + netbox_device: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Another Test Device + device_type: C9410R + device_role: Core Switch + site: Main + local_context_data: + bgp: "65000" + tags: + - Schnozzberry + state: present + + - name: Update the rack and position of an existing device + netbox_device: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Device + rack: Test Rack + position: 10 + face: Front + state: present +""" + +RETURN = r""" +device: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_DEVICES, +) +from copy import deepcopy +import uuid + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + device_type=dict(required=False, type="raw"), + device_role=dict(required=False, type="raw"), + tenant=dict(required=False, type="raw"), + platform=dict(required=False, type="raw"), + serial=dict(required=False, type="str"), + asset_tag=dict(required=False, type="str"), + site=dict(required=False, type="raw"), + rack=dict(required=False, type="raw"), + position=dict(required=False, type="int"), + face=dict( + required=False, + type="str", + choices=["Front", "front", "Rear", "rear"], + ), + status=dict(required=False, type="raw"), + primary_ip4=dict(required=False, type="raw"), + primary_ip6=dict(required=False, type="raw"), + cluster=dict(required=False, type="raw"), + virtual_chassis=dict(required=False, type="raw"), + vc_position=dict(required=False, type="int"), + vc_priority=dict(required=False, type="int"), + comments=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + local_context_data=dict(required=False, type="dict"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + if module.params["data"]["name"] == "": + module.params["data"]["name"] = str(uuid.uuid4()) + + netbox_device = NetboxDcimModule(module, NB_DEVICES) + netbox_device.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_bay.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_bay.py new file mode 100644 index 00000000..d9755f14 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_bay.py @@ -0,0 +1,184 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_device_bay +short_description: Create, update or delete device bays within Netbox +description: + - Creates, updates or removes device bays from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + description: + - Defines the device bay configuration + suboptions: + device: + description: + - The device the device bay will be associated to. The device type must be "parent". + required: false + type: raw + name: + description: + - The name of the device bay + required: true + type: str + description: + description: + - The description of the device bay. This is supported on v2.6+ of Netbox + required: false + type: str + installed_device: + description: + - The ddevice that will be installed into the bay. The device type must be "child". + required: false + type: raw + tags: + description: + - Any tags that the device bay may need to be associated with + required: false + type: list + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create device bay within Netbox with only required information + netbox_device_bay: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: Test Nexus One + name: "Device Bay One" + state: present + + - name: Add device into device bay + netbox_device_bay: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: Test Nexus One + name: "Device Bay One" + description: "First child" + installed_device: Test Nexus Child One + state: absent + + - name: Delete device bay within netbox + netbox_device_bay: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Device Bay One + state: absent + +""" + +RETURN = r""" +device_bay: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_DEVICE_BAYS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device=dict(required=False, type="raw"), + name=dict(required=True, type="str"), + description=dict(required=False, type="str"), + installed_device=dict(required=False, type="raw"), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_device_bay = NetboxDcimModule(module, NB_DEVICE_BAYS) + netbox_device_bay.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_bay_template.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_bay_template.py new file mode 100644 index 00000000..7df84ab7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_bay_template.py @@ -0,0 +1,160 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_device_bay_template +short_description: Create, update or delete device bay templates within Netbox +description: + - Creates, updates or removes device bay templates from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.3.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + description: + - Defines the device bay template configuration + suboptions: + device_type: + description: + - The device type the device bay template will be associated to. The device type must be "parent". + required: true + type: raw + name: + description: + - The name of the device bay template + required: true + type: str + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create device bay template within Netbox with only required information + netbox_device_bay_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: device bay template One + device_type: Device Type One + state: present + + - name: Delete device bay template within netbox + netbox_device_bay_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: device bay template One + device_type: Device Type One + state: absent + +""" + +RETURN = r""" +device_bay_template: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_DEVICE_BAY_TEMPLATES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device_type=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["name", "device_type"]), + ("state", "absent", ["name", "device_type"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_device_bay_template = NetboxDcimModule(module, NB_DEVICE_BAY_TEMPLATES) + netbox_device_bay_template.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_interface.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_interface.py new file mode 100644 index 00000000..9d594fd2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_interface.py @@ -0,0 +1,305 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_device_interface +short_description: Creates or removes interfaces on devices from Netbox +description: + - Creates or removes interfaces from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: "0.1.0" +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + description: + - Defines the interface configuration + suboptions: + device: + description: + - Name of the device the interface will be associated with (case-sensitive) + required: false + type: raw + name: + description: + - Name of the interface to be created + required: true + type: str + form_factor: + description: + - | + Form factor of the interface: + ex. 1000Base-T (1GE), Virtual, 10GBASE-T (10GE) + This has to be specified exactly as what is found within UI + required: false + type: raw + type: + description: + - | + Form factor of the interface: + ex. 1000Base-T (1GE), Virtual, 10GBASE-T (10GE) + This has to be specified exactly as what is found within UI + required: false + type: str + enabled: + description: + - Sets whether interface shows enabled or disabled + required: false + type: bool + lag: + description: + - Parent LAG interface will be a member of + required: false + type: raw + mtu: + description: + - The MTU of the interface + required: false + type: int + mac_address: + description: + - The MAC address of the interface + required: false + type: str + mgmt_only: + description: + - This interface is used only for out-of-band management + required: false + type: bool + description: + description: + - The description of the interface + required: false + type: str + mode: + description: + - The mode of the interface + required: false + type: raw + untagged_vlan: + description: + - The untagged VLAN to be assigned to interface + required: false + type: raw + tagged_vlans: + description: + - A list of tagged VLANS to be assigned to interface. Mode must be set to either C(Tagged) or C(Tagged All) + required: false + type: raw + tags: + description: + - Any tags that the interface may need to be associated with + required: false + type: list + required: true + type: dict + update_vc_child: + type: bool + default: False + description: + - | + Use when master device is specified for C(device) and the specified interface exists on a child device + and needs updated + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox interface module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create interface within Netbox with only required information + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + state: present + - name: Delete interface within netbox + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + state: absent + - name: Create LAG with several specified options + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: port-channel1 + type: Link Aggregation Group (LAG) + mtu: 1600 + mgmt_only: false + mode: Access + state: present + - name: Create interface and assign it to parent LAG + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + enabled: false + type: 1000Base-t (1GE) + lag: + name: port-channel1 + mtu: 1600 + mgmt_only: false + mode: Access + state: present + - name: Create interface as a trunk port + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet25 + enabled: false + type: 1000Base-t (1GE) + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + mtu: 1600 + mgmt_only: true + mode: Tagged + state: present + - name: Update interface on child device on virtual chassis + netbox_device_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet2/0/1 + enabled: false + update_vc_child: True +""" + +RETURN = r""" +interface: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_INTERFACES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + update_vc_child=dict(type="bool", required=False, default=False), + data=dict( + type="dict", + required=True, + options=dict( + device=dict(required=False, type="raw"), + name=dict(required=True, type="str"), + form_factor=dict( + required=False, type="raw", removed_in_version="0.3.0" + ), + type=dict(required=False, type="str"), + enabled=dict(required=False, type="bool"), + lag=dict(required=False, type="raw"), + mtu=dict(required=False, type="int"), + mac_address=dict(required=False, type="str"), + mgmt_only=dict(required=False, type="bool"), + description=dict(required=False, type="str"), + mode=dict(required=False, type="raw"), + untagged_vlan=dict(required=False, type="raw"), + tagged_vlans=dict(required=False, type="raw"), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device", "name"]), + ("state", "absent", ["device", "name"]), + ("update_vc_child", True, ["device"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_device_interface = NetboxDcimModule(module, NB_INTERFACES) + netbox_device_interface.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_interface_template.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_interface_template.py new file mode 100644 index 00000000..b265ec5a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_interface_template.py @@ -0,0 +1,176 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_device_interface_template +short_description: Creates or removes interfaces on devices from Netbox +description: + - Creates or removes interfaces from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: "0.3.0" +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + description: + - Defines the prefix configuration + suboptions: + device_type: + description: + - Name of the device the interface template will be associated with (case-sensitive) + required: true + type: raw + name: + description: + - Name of the interface template to be created + required: true + type: str + type: + description: + - | + Form factor of the interface: + ex. 1000Base-T (1GE), Virtual, 10GBASE-T (10GE) + This has to be specified exactly as what is found within UI + required: true + type: str + mgmt_only: + description: + - This interface template is used only for out-of-band management + required: false + type: bool + required: true + type: dict + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox interface template module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create interface template within Netbox with only required information + netbox_device_interface_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + state: present + - name: Delete interface template within netbox + netbox_device_interface_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + state: absent +""" + +RETURN = r""" +interface_template: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_INTERFACE_TEMPLATES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device_type=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict(required=True, type="str",), + mgmt_only=dict(required=False, type="bool"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device_type", "name", "type"]), + ("state", "absent", ["device_type", "name", "type"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_device_interface_template = NetboxDcimModule(module, NB_INTERFACE_TEMPLATES) + netbox_device_interface_template.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_role.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_role.py new file mode 100644 index 00000000..401f58c9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_role.py @@ -0,0 +1,165 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_device_role +short_description: Create, update or delete devices roles within Netbox +description: + - Creates, updates or removes devices roles from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + description: + - Defines the device role configuration + suboptions: + name: + description: + - The name of the device role + required: true + type: str + color: + description: + - Hexidecimal code for a color, ex. FFFFFF + required: false + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + vm_role: + description: + - Whether the role is a VM role + type: bool + required: true + type: dict + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create device role within Netbox with only required information + netbox_device_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test device role + color: FFFFFF + state: present + + - name: Delete device role within netbox + netbox_device_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rack role + state: absent +""" + +RETURN = r""" +device_role: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_DEVICE_ROLES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + color=dict(required=False, type="str"), + slug=dict(required=False, type="str"), + vm_role=dict(required=False, type="bool"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_device_role = NetboxDcimModule(module, NB_DEVICE_ROLES) + netbox_device_role.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_type.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_type.py new file mode 100644 index 00000000..ddc2af5c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_device_type.py @@ -0,0 +1,228 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_device_type +short_description: Create, update or delete device types within Netbox +description: + - Creates, updates or removes device types from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + description: + - Defines the device type configuration + suboptions: + manufacturer: + description: + - The manufacturer of the device type + required: false + type: raw + model: + description: + - The model of the device type + required: true + type: raw + slug: + description: + - The slug of the device type. Must follow slug formatting (URL friendly) + - If not specified, it will slugify the model + - ex. test-device-type + required: false + type: str + part_number: + description: + - The part number of the device type + required: false + type: str + u_height: + description: + - The height of the device type in rack units + required: false + type: int + is_full_depth: + description: + - Whether or not the device consumes both front and rear rack faces + required: false + type: bool + subdevice_role: + description: + - Whether the device type is parent, child, or neither + choices: + - Parent + - parent + - Child + - child + required: false + type: str + comments: + description: + - Comments that may include additional information in regards to the device_type + required: false + type: str + tags: + description: + - Any tags that the device type may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + required: true + type: dict + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create device type within Netbox with only required information + netbox_device_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + slug: test-device-type + model: ws-test-3750 + manufacturer: Test Manufacturer + state: present + + - name: Create device type within Netbox with only required information + netbox_device_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + slug: test-device-type + model: ws-test-3750 + manufacturer: Test Manufacturer + part_number: ws-3750g-v2 + u_height: 1 + is_full_depth: False + subdevice_role: parent + state: present + + - name: Delete device type within netbox + netbox_device_type: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + slug: test-device-type + state: absent +""" + +RETURN = r""" +device_type: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_DEVICE_TYPES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + manufacturer=dict(required=False, type="raw"), + model=dict(required=True, type="raw"), + slug=dict(required=False, type="str"), + part_number=dict(required=False, type="str"), + u_height=dict(required=False, type="int"), + is_full_depth=dict(required=False, type="bool"), + subdevice_role=dict( + required=False, + choices=["Parent", "parent", "Child", "child"], + type="str", + ), + comments=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [("state", "present", ["model"]), ("state", "absent", ["model"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_device_type = NetboxDcimModule(module, NB_DEVICE_TYPES) + netbox_device_type.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_front_port.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_front_port.py new file mode 100644 index 00000000..90afff8f --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_front_port.py @@ -0,0 +1,240 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_front_port +short_description: Create, update or delete front ports within Netbox +description: + - Creates, updates or removes front ports from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the front port configuration + suboptions: + device: + description: + - The device the front port is attached to + required: true + type: raw + name: + description: + - The name of the front port + required: true + type: str + type: + description: + - The type of the front port + choices: + - 8p8c + - 110-punch + - bnc + - mrj21 + - fc + - lc + - lc-apc + - lsh + - lsh-apc + - mpo + - mtrj + - sc + - sc-apc + - st + required: true + type: str + rear_port: + description: + - The rear_port the front port is attached to + required: true + type: raw + rear_port_position: + description: + - The position of the rear port this front port is connected to + required: false + type: int + description: + description: + - Description of the front port + required: false + type: str + tags: + description: + - Any tags that the front port may need to be associated with + required: false + type: list + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create front port within Netbox with only required information + netbox_front_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port + device: Test Device + type: bnc + rear_port: Test Rear Port + state: present + + - name: Update front port with other fields + netbox_front_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port + device: Test Device + type: bnc + rear_port: Test Rear Port + rear_port_position: 5 + description: front port description + state: present + + - name: Delete front port within netbox + netbox_front_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port + device: Test Device + type: bnc + rear_port: Test Rear Port + state: absent +""" + +RETURN = r""" +front_port: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_FRONT_PORTS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=True, + choices=[ + "8p8c", + "110-punch", + "bnc", + "mrj21", + "fc", + "lc", + "lc-apc", + "lsh", + "lsh-apc", + "mpo", + "mtrj", + "sc", + "sc-apc", + "st", + ], + type="str", + ), + rear_port=dict(required=True, type="raw"), + rear_port_position=dict(required=False, type="int"), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device", "name", "type", "rear_port"]), + ("state", "absent", ["device", "name", "type", "rear_port"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_front_port = NetboxDcimModule(module, NB_FRONT_PORTS) + netbox_front_port.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_front_port_template.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_front_port_template.py new file mode 100644 index 00000000..b6212a46 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_front_port_template.py @@ -0,0 +1,227 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_front_port_template +short_description: Create, update or delete front port templates within Netbox +description: + - Creates, updates or removes front port templates from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the front port template configuration + suboptions: + device_type: + description: + - The device type the front port template is attached to + required: true + type: raw + name: + description: + - The name of the front port template + required: true + type: str + type: + description: + - The type of the front port template + choices: + - 8p8c + - 110-punch + - bnc + - mrj21 + - fc + - lc + - lc-apc + - lsh + - lsh-apc + - mpo + - mtrj + - sc + - sc-apc + - st + required: false + type: str + rear_port_template: + description: + - The rear_port_template the front port template is attached to + required: true + type: raw + rear_port_template_position: + description: + - The position of the rear port template this front port template is connected to + required: false + type: int + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create front port template within Netbox with only required information + netbox_front_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port Template + device_type: Test Device Type + type: bnc + rear_port_template: Test Rear Port Template + state: present + + - name: Update front port template with other fields + netbox_front_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port Template + device_type: Test Device Type + type: bnc + rear_port_template: Test Rear Port Template + rear_port_template_position: 5 + state: present + + - name: Delete front port template within netbox + netbox_front_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Front Port Template + device_type: Test Device Type + type: bnc + rear_port_template: Test Rear Port Template + state: absent +""" + +RETURN = r""" +front_port_template: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_FRONT_PORT_TEMPLATES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device_type=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=False, + choices=[ + "8p8c", + "110-punch", + "bnc", + "mrj21", + "fc", + "lc", + "lc-apc", + "lsh", + "lsh-apc", + "mpo", + "mtrj", + "sc", + "sc-apc", + "st", + ], + type="str", + ), + rear_port_template=dict(required=True, type="raw"), + rear_port_template_position=dict(required=False, type="int"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device_type", "name", "type", "rear_port_template"]), + ("state", "absent", ["device_type", "name", "type", "rear_port_template"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_front_port_template = NetboxDcimModule(module, NB_FRONT_PORT_TEMPLATES) + netbox_front_port_template.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_interface.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_interface.py new file mode 100644 index 00000000..de5b0059 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_interface.py @@ -0,0 +1,361 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["deprecated"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_interface +short_description: Creates or removes interfaces from Netbox +description: + - Creates or removes interfaces from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: "2.8" +deprecated: + removed_in: 0.1.0 + alternative: Use M(netbox_device_interface) or M(netbox_vm_interface) instead. + why: Moved to new modular structure for managing the modules. +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + description: + - Defines the prefix configuration + suboptions: + device: + description: + - Name of the device the interface will be associated with (case-sensitive) + required: true + type: str + name: + description: + - Name of the interface to be created + required: true + type: str + form_factor: + description: + - | + Form factor of the interface: + ex. 1000Base-T (1GE), Virtual, 10GBASE-T (10GE) + This has to be specified exactly as what is found within UI + type: str + enabled: + description: + - Sets whether interface shows enabled or disabled + type: bool + lag: + description: + - Parent LAG interface will be a member of + type: dict + mtu: + description: + - The MTU of the interface + type: str + mac_address: + description: + - The MAC address of the interface + type: str + mgmt_only: + description: + - This interface is used only for out-of-band management + type: bool + description: + description: + - The description of the prefix + type: str + mode: + description: + - The mode of the interface + choices: + - Access + - Tagged + - Tagged All + type: str + untagged_vlan: + description: + - The untagged VLAN to be assigned to interface + type: dict + tagged_vlans: + description: + - A list of tagged VLANS to be assigned to interface. Mode must be set to either C(Tagged) or C(Tagged All) + type: list + tags: + description: + - Any tags that the prefix may need to be associated with + type: list + required: true + type: dict + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: "yes" + type: bool +""" + +EXAMPLES = r""" +- name: "Test Netbox interface module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create interface within Netbox with only required information + netbox_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + state: present + - name: Delete interface within netbox + netbox_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + state: absent + - name: Create LAG with several specified options + netbox_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: port-channel1 + form_factor: Link Aggregation Group (LAG) + mtu: 1600 + mgmt_only: false + mode: Access + state: present + - name: Create interface and assign it to parent LAG + netbox_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet1 + enabled: false + form_factor: 1000Base-t (1GE) + lag: + name: port-channel1 + mtu: 1600 + mgmt_only: false + mode: Access + state: present + - name: Create interface as a trunk port + netbox_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: GigabitEthernet25 + enabled: false + form_factor: 1000Base-t (1GE) + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + mtu: 1600 + mgmt_only: true + mode: Tagged + state: present +""" + +RETURN = r""" +interface: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +import json +import traceback + +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.net_tools.netbox.netbox_utils import ( + find_ids, + normalize_data, + create_netbox_object, + delete_netbox_object, + update_netbox_object, + INTF_FORM_FACTOR, + INTF_MODE, +) +from ansible.module_utils.compat import ipaddress +from ansible.module_utils._text import to_text + + +PYNETBOX_IMP_ERR = None +try: + import pynetbox + + HAS_PYNETBOX = True +except ImportError: + PYNETBOX_IMP_ERR = traceback.format_exc() + HAS_PYNETBOX = False + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = dict( + netbox_url=dict(type="str", required=True), + netbox_token=dict(type="str", required=True, no_log=True), + data=dict(type="dict", required=True), + state=dict(required=False, default="present", choices=["present", "absent"]), + validate_certs=dict(type="bool", default=True), + ) + + global module + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + + # Fail module if pynetbox is not installed + if not HAS_PYNETBOX: + module.fail_json( + msg=missing_required_lib("pynetbox"), exception=PYNETBOX_IMP_ERR + ) + # Assign variables to be used with module + app = "dcim" + endpoint = "interfaces" + url = module.params["netbox_url"] + token = module.params["netbox_token"] + data = module.params["data"] + state = module.params["state"] + validate_certs = module.params["validate_certs"] + # Attempt to create Netbox API object + try: + nb = pynetbox.api(url, token=token, ssl_verify=validate_certs) + except Exception: + module.fail_json(msg="Failed to establish connection to Netbox API") + try: + nb_app = getattr(nb, app) + except AttributeError: + module.fail_json(msg="Incorrect application specified: %s" % (app)) + nb_endpoint = getattr(nb_app, endpoint) + norm_data = normalize_data(data) + try: + norm_data = _check_and_adapt_data(nb, norm_data) + + if "present" in state: + return module.exit_json( + **ensure_interface_present(nb, nb_endpoint, norm_data) + ) + else: + return module.exit_json( + **ensure_interface_absent(nb, nb_endpoint, norm_data) + ) + except pynetbox.RequestError as e: + return module.fail_json(msg=json.loads(e.error)) + except ValueError as e: + return module.fail_json(msg=str(e)) + except AttributeError as e: + return module.fail_json(msg=str(e)) + + +def _check_and_adapt_data(nb, data): + data = find_ids(nb, data) + + if data.get("form_factor"): + data["form_factor"] = INTF_FORM_FACTOR.get(data["form_factor"].lower()) + if data.get("mode"): + data["mode"] = INTF_MODE.get(data["mode"].lower()) + + return data + + +def ensure_interface_present(nb, nb_endpoint, data): + """ + :returns dict(interface, msg, changed): dictionary resulting of the request, + where 'interface' is the serialized interface fetched or newly created in Netbox + """ + + if not isinstance(data, dict): + changed = False + return {"msg": data, "changed": changed} + + nb_intf = nb_endpoint.get(name=data["name"], device_id=data["device"]) + result = dict() + + if not nb_intf: + intf, diff = create_netbox_object(nb_endpoint, data, module.check_mode) + changed = True + msg = "Interface %s created" % (data["name"]) + else: + intf, diff = update_netbox_object(nb_intf, data, module.check_mode) + if intf is False: + module.fail_json( + msg="Request failed, couldn't update device: %s" % (data["name"]) + ) + if diff: + msg = "Interface %s updated" % (data["name"]) + changed = True + result["diff"] = diff + else: + msg = "Interface %s already exists" % (data["name"]) + changed = False + result.update({"interface": intf, "msg": msg, "changed": changed}) + return result + + +def ensure_interface_absent(nb, nb_endpoint, data): + """ + :returns dict(msg, changed, diff) + """ + nb_intf = nb_endpoint.get(name=data["name"], device_id=data["device"]) + result = dict() + if nb_intf: + dummy, diff = delete_netbox_object(nb_intf, module.check_mode) + changed = True + msg = "Interface %s deleted" % (data["name"]) + result["diff"] = diff + else: + msg = "Interface %s already absent" % (data["name"]) + changed = False + + result.update({"msg": msg, "changed": changed}) + return result + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_inventory_item.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_inventory_item.py new file mode 100644 index 00000000..f4d5270a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_inventory_item.py @@ -0,0 +1,215 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_inventory_item +short_description: Creates or removes inventory items from Netbox +description: + - Creates or removes inventory items from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: "0.1.0" +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the inventory item configuration + suboptions: + device: + description: + - Name of the device the inventory item belongs to + required: false + type: raw + name: + description: + - Name of the inventory item to be created + required: true + type: str + manufacturer: + description: + - The manufacturer of the inventory item + required: false + type: raw + part_id: + description: + - The part ID of the inventory item + required: false + type: str + serial: + description: + - The serial number of the inventory item + required: false + type: str + asset_tag: + description: + - The asset tag of the inventory item + required: false + type: str + description: + description: + - The description of the inventory item + required: false + type: str + discovered: + description: + - Set the discovery flag for the inventory item + required: false + type: bool + tags: + description: + - Any tags that the device may need to be associated with + required: false + type: list + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox inventory_item module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create inventory item within Netbox with only required information + netbox_inventory_item: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: "10G-SFP+" + state: present + + - name: Update inventory item + netbox_inventory_item: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: "10G-SFP+" + manufacturer: "Cisco" + part_id: "10G-SFP+" + serial: "1234" + asset_tag: "1234" + description: "New SFP" + state: present + + - name: Delete inventory item within netbox + netbox_inventory_item: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + device: test100 + name: "10G-SFP+" + state: absent +""" + +RETURN = r""" +inventory_item: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_INVENTORY_ITEMS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device=dict(required=False, type="raw"), + name=dict(required=True, type="str"), + manufacturer=dict(required=False, type="raw"), + part_id=dict(required=False, type="str"), + serial=dict(required=False, type="str"), + asset_tag=dict(required=False, type="str"), + description=dict(required=False, type="str"), + discovered=dict(required=False, type="bool", default=False), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device", "name"]), + ("state", "absent", ["device", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_inventory_item = NetboxDcimModule(module, NB_INVENTORY_ITEMS) + netbox_inventory_item.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_ip_address.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_ip_address.py new file mode 100644 index 00000000..2472557a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_ip_address.py @@ -0,0 +1,384 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_ip_address +short_description: Creates or removes IP addresses from Netbox +description: + - Creates or removes IP addresses from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) + - Anthony Ruhier (@Anthony25) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the IP address configuration + suboptions: + family: + description: + - (DEPRECATED) - NetBox now handles determining the IP family natively. + - Specifies with address family the IP address belongs to + choices: + - 4 + - 6 + required: false + type: int + address: + description: + - Required if state is C(present) + required: false + type: str + prefix: + description: + - | + With state C(present), if an interface is given, it will ensure + that an IP inside this prefix (and vrf, if given) is attached + to this interface. Otherwise, it will get the next available IP + of this prefix and attach it. + With state C(new), it will force to get the next available IP in + this prefix. If an interface is given, it will also force to attach + it. + Required if state is C(present) or C(new) when no address is given. + Unused if an address is specified. + required: false + type: raw + vrf: + description: + - VRF that IP address is associated with + required: false + type: raw + tenant: + description: + - The tenant that the device will be assigned to + required: false + type: raw + status: + description: + - The status of the IP address + required: false + type: raw + role: + description: + - The role of the IP address + choices: + - Loopback + - Secondary + - Anycast + - VIP + - VRRP + - HSRP + - GLBP + - CARP + required: false + type: str + interface: + description: + - | + The name and device of the interface that the IP address should be assigned to + Required if state is C(present) and a prefix specified. + required: false + type: raw + description: + description: + - The description of the interface + required: false + type: str + nat_inside: + description: + - The inside IP address this IP is assigned to + required: false + type: raw + dns_name: + description: + - Hostname or FQDN + required: false + type: str + assigned_object: + description: + - Definition of the assigned object. + required: false + type: dict + suboptions: + name: + description: + - The name of the interface + type: str + required: False + device: + description: + - The device the interface is attached to. + type: str + required: False + virtual_machine: + description: + - The virtual machine the interface is attached to. + type: str + required: False + tags: + description: + - Any tags that the IP address may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + required: true + state: + description: + - | + Use C(present), C(new) or C(absent) for adding, force adding or removing. + C(present) will check if the IP is already created, and return it if + true. C(new) will force to create it anyway (useful for anycasts, for + example). + choices: [ absent, new, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox IP address module" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create IP address within Netbox with only required information + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + address: 192.168.1.10 + state: present + - name: Force to create (even if it already exists) the IP + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + address: 192.168.1.10 + state: new + - name: Get a new available IP inside 192.168.1.0/24 + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.1.0/24 + state: new + - name: Delete IP address within netbox + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + address: 192.168.1.10 + state: absent + - name: Create IP address with several specified options + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + family: 4 + address: 192.168.1.20 + vrf: Test + tenant: Test Tenant + status: Reserved + role: Loopback + description: Test description + tags: + - Schnozzberry + state: present + - name: Create IP address and assign a nat_inside IP + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + family: 4 + address: 192.168.1.30 + vrf: Test + nat_inside: + address: 192.168.1.20 + vrf: Test + interface: + name: GigabitEthernet1 + device: test100 + - name: Ensure that an IP inside 192.168.1.0/24 is attached to GigabitEthernet1 + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.1.0/24 + vrf: Test + interface: + name: GigabitEthernet1 + device: test100 + state: present + - name: Attach a new available IP of 192.168.1.0/24 to GigabitEthernet1 + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.1.0/24 + vrf: Test + interface: + name: GigabitEthernet1 + device: test100 + state: new + - name: Attach a new available IP of 192.168.1.0/24 to GigabitEthernet1 (NetBox 2.9+) + netbox_ip_address: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 192.168.1.0/24 + vrf: Test + assigned_object: + name: GigabitEthernet1 + device: test100 + state: new +""" + +RETURN = r""" +ip_address: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_ipam import ( + NetboxIpamModule, + NB_IP_ADDRESSES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + # state choices present, absent, new + argument_spec["state"] = dict( + required=False, default="present", choices=["present", "absent", "new"] + ) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + family=dict( + required=False, + type="int", + choices=[4, 6], + removed_in_version="0.3.0", + ), + address=dict(required=False, type="str"), + prefix=dict(required=False, type="raw"), + vrf=dict(required=False, type="raw"), + tenant=dict(required=False, type="raw"), + status=dict(required=False, type="raw"), + role=dict( + required=False, + type="str", + choices=[ + "Loopback", + "Secondary", + "Anycast", + "VIP", + "VRRP", + "HSRP", + "GLBP", + "CARP", + ], + ), + interface=dict(required=False, type="raw"), + description=dict(required=False, type="str"), + nat_inside=dict(required=False, type="raw"), + dns_name=dict(required=False, type="str"), + assigned_object=dict( + required=False, + type="dict", + options=dict( + name=dict(required=False, type="str"), + device=dict(required=False, type="str"), + virtual_machine=dict(required=False, type="str"), + ), + ), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["address", "prefix"], True), + ("state", "absent", ["address"]), + ("state", "new", ["address", "prefix"], True), + ] + mutually_exclusive = [["interface", "assigned_object"], ["address", "prefix"]] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + required_if=required_if, + mutually_exclusive=mutually_exclusive, + ) + + netbox_ip_address = NetboxIpamModule(module, NB_IP_ADDRESSES) + netbox_ip_address.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_ipam_role.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_ipam_role.py new file mode 100644 index 00000000..f72ec173 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_ipam_role.py @@ -0,0 +1,161 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_ipam_role +short_description: Creates or removes ipam roles from Netbox +description: + - Creates or removes ipam roles from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: "0.1.0" +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the ipam role configuration + suboptions: + name: + description: + - Name of the ipam role to be created + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + weight: + description: + - The weight of the ipam role to be created + required: false + type: int + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create ipam role within Netbox with only required information + netbox_ipam_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test IPAM Role + state: present + + - name: Delete ipam role within netbox + netbox_ipam_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test IPAM Role + state: absent +""" + +RETURN = r""" +role: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_ipam import ( + NetboxIpamModule, + NB_IPAM_ROLES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + weight=dict(required=False, type="int"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_ipam_role = NetboxIpamModule(module, NB_IPAM_ROLES) + netbox_ipam_role.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_manufacturer.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_manufacturer.py new file mode 100644 index 00000000..1c7fe6c1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_manufacturer.py @@ -0,0 +1,154 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_manufacturer +short_description: Create or delete manufacturers within Netbox +description: + - Creates or removes manufacturers from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the manufacturer configuration + suboptions: + name: + description: + - The name of the manufacturer + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create manufacturer within Netbox with only required information + netbox_manufacturer: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Manufacturer + state: present + + - name: Delete manufacturer within netbox + netbox_manufacturer: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Manufacturer + state: absent +""" + +RETURN = r""" +manufacturer: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_MANUFACTURERS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_manufacturer = NetboxDcimModule(module, NB_MANUFACTURERS) + netbox_manufacturer.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_platform.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_platform.py new file mode 100644 index 00000000..5ff68707 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_platform.py @@ -0,0 +1,184 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_platform +short_description: Create or delete platforms within Netbox +description: + - Creates or removes platforms from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the platform configuration + suboptions: + name: + description: + - The name of the platform + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + manufacturer: + description: + - The manufacturer the platform will be tied to + required: false + type: raw + napalm_driver: + description: + - The name of the NAPALM driver to be used when using the NAPALM plugin + required: false + type: str + napalm_args: + description: + - The optional arguments used for NAPALM connections + required: false + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create platform within Netbox with only required information + netbox_platform: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Platform + state: present + + - name: Create platform within Netbox with only required information + netbox_platform: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Platform All + manufacturer: Test Manufacturer + napalm_driver: ios + napalm_args: + global_delay_factor: 2 + state: present + + - name: Delete platform within netbox + netbox_platform: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Platform + state: absent +""" + +RETURN = r""" +platform: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_PLATFORMS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + manufacturer=dict(required=False, type="raw"), + napalm_driver=dict(required=False, type="str"), + napalm_args=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_platform = NetboxDcimModule(module, NB_PLATFORMS) + netbox_platform.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_feed.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_feed.py new file mode 100644 index 00000000..e8b06928 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_feed.py @@ -0,0 +1,266 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_power_feed +short_description: Create, update or delete power feeds within Netbox +description: + - Creates, updates or removes power feeds from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the power feed configuration + suboptions: + power_panel: + description: + - The power panel the power feed is terminated on + required: true + type: raw + rack: + description: + - The rack the power feed is assigned to + required: false + type: raw + name: + description: + - The name of the power feed + required: true + type: str + status: + description: + - The status of the power feed + choices: + - offline + - active + - planned + - failed + required: false + type: str + type: + description: + - The type of the power feed + choices: + - primary + - redundant + required: false + type: str + supply: + description: + - The supply type of the power feed + choices: + - ac + - dc + required: false + type: str + phase: + description: + - The phase type of the power feed + choices: + - single-phase + - three-phase + required: false + type: str + voltage: + description: + - The voltage of the power feed + required: false + type: int + amperage: + description: + - The amperage of the power feed + required: false + type: int + max_utilization: + description: + - The maximum permissible draw of the power feed in percent + required: false + type: int + comments: + description: + - Comments related to the power feed + required: false + type: str + tags: + description: + - Any tags that the power feed may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power feed within Netbox with only required information + netbox_power_feed: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Feed + power_panel: Test Power Panel + state: present + + - name: Update power feed with other fields + netbox_power_feed: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Feed + power_panel: Test Power Panel + status: offline + type: primary + supply: ac + phase: single-phase + voltage: 230 + amperage: 16 + max_utilization: 80 + comments: normal power feed + state: present + + - name: Delete power feed within netbox + netbox_power_feed: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Feed + power_panel: Test Power Panel + state: absent +""" + +RETURN = r""" +power_feed: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_POWER_FEEDS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + power_panel=dict(required=True, type="raw"), + rack=dict(required=False, type="raw"), + name=dict(required=True, type="str"), + status=dict( + required=False, + choices=["offline", "active", "planned", "failed"], + type="str", + ), + type=dict( + required=False, choices=["primary", "redundant"], type="str" + ), + supply=dict(required=False, choices=["ac", "dc"], type="str"), + phase=dict( + required=False, + choices=["single-phase", "three-phase"], + type="str", + ), + voltage=dict(required=False, type="int"), + amperage=dict(required=False, type="int"), + max_utilization=dict(required=False, type="int"), + comments=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["power_panel", "name"]), + ("state", "absent", ["power_panel", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_power_feed = NetboxDcimModule(module, NB_POWER_FEEDS) + netbox_power_feed.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_outlet.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_outlet.py new file mode 100644 index 00000000..175c9f75 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_outlet.py @@ -0,0 +1,320 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_power_outlet +short_description: Create, update or delete power outlets within Netbox +description: + - Creates, updates or removes power outlets from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the power outlet configuration + suboptions: + device: + description: + - The device the power outlet is attached to + required: true + type: raw + name: + description: + - The name of the power outlet + required: true + type: str + type: + description: + - The type of the power outlet + choices: + - iec-60320-c5 + - iec-60320-c7 + - iec-60320-c13 + - iec-60320-c15 + - iec-60320-c19 + - iec-60309-p-n-e-4h + - iec-60309-p-n-e-6h + - iec-60309-p-n-e-9h + - iec-60309-2p-e-4h + - iec-60309-2p-e-6h + - iec-60309-2p-e-9h + - iec-60309-3p-e-4h + - iec-60309-3p-e-6h + - iec-60309-3p-e-9h + - iec-60309-3p-n-e-4h + - iec-60309-3p-n-e-6h + - iec-60309-3p-n-e-9h + - nema-5-15r + - nema-5-20r + - nema-5-30r + - nema-5-50r + - nema-6-15r + - nema-6-20r + - nema-6-30r + - nema-6-50r + - nema-l5-15r + - nema-l5-20r + - nema-l5-30r + - nema-l5-50r + - nema-l6-20r + - nema-l6-30r + - nema-l6-50r + - nema-l14-20r + - nema-l14-30r + - nema-l21-20r + - nema-l21-30r + - CS6360C + - CS6364C + - CS8164C + - CS8264C + - CS8364C + - CS8464C + - ita-e + - ita-f + - ita-g + - ita-h + - ita-i + - ita-j + - ita-k + - ita-l + - ita-m + - ita-n + - ita-o + - hdot-cx + required: false + type: str + power_port: + description: + - The attached power port + required: false + type: raw + feed_leg: + description: + - The phase, in case of three-phase feed + choices: + - A + - B + - C + required: false + type: str + description: + description: + - Description of the power outlet + required: false + type: str + tags: + description: + - Any tags that the power outlet may need to be associated with + required: false + type: list + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power port within Netbox with only required information + netbox_power_outlet: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device: Test Device + state: present + + - name: Update power port with other fields + netbox_power_outlet: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device: Test Device + type: iec-60320-c6 + power_port: Test Power Port + feed_leg: A + description: power port description + state: present + + - name: Delete power port within netbox + netbox_power_outlet: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device: Test Device + state: absent +""" + +RETURN = r""" +power_outlet: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_POWER_OUTLETS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=False, + choices=[ + "iec-60320-c5", + "iec-60320-c7", + "iec-60320-c13", + "iec-60320-c15", + "iec-60320-c19", + "iec-60309-p-n-e-4h", + "iec-60309-p-n-e-6h", + "iec-60309-p-n-e-9h", + "iec-60309-2p-e-4h", + "iec-60309-2p-e-6h", + "iec-60309-2p-e-9h", + "iec-60309-3p-e-4h", + "iec-60309-3p-e-6h", + "iec-60309-3p-e-9h", + "iec-60309-3p-n-e-4h", + "iec-60309-3p-n-e-6h", + "iec-60309-3p-n-e-9h", + "nema-5-15r", + "nema-5-20r", + "nema-5-30r", + "nema-5-50r", + "nema-6-15r", + "nema-6-20r", + "nema-6-30r", + "nema-6-50r", + "nema-l5-15r", + "nema-l5-20r", + "nema-l5-30r", + "nema-l5-50r", + "nema-l6-20r", + "nema-l6-30r", + "nema-l6-50r", + "nema-l14-20r", + "nema-l14-30r", + "nema-l21-20r", + "nema-l21-30r", + "CS6360C", + "CS6364C", + "CS8164C", + "CS8264C", + "CS8364C", + "CS8464C", + "ita-e", + "ita-f", + "ita-g", + "ita-h", + "ita-i", + "ita-j", + "ita-k", + "ita-l", + "ita-m", + "ita-n", + "ita-o", + "hdot-cx", + ], + type="str", + ), + power_port=dict(required=False, type="raw"), + feed_leg=dict(required=False, choices=["A", "B", "C"], type="str"), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device", "name"]), + ("state", "absent", ["device", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_power_outlet = NetboxDcimModule(module, NB_POWER_OUTLETS) + netbox_power_outlet.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_outlet_template.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_outlet_template.py new file mode 100644 index 00000000..7fa04acb --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_outlet_template.py @@ -0,0 +1,307 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_power_outlet_template +short_description: Create, update or delete power outlet templates within Netbox +description: + - Creates, updates or removes power outlet templates from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the power outlet configuration + suboptions: + device_type: + description: + - The device type the power outlet is attached to + required: true + type: raw + name: + description: + - The name of the power outlet + required: true + type: str + type: + description: + - The type of the power outlet + choices: + - iec-60320-c5 + - iec-60320-c7 + - iec-60320-c13 + - iec-60320-c15 + - iec-60320-c19 + - iec-60309-p-n-e-4h + - iec-60309-p-n-e-6h + - iec-60309-p-n-e-9h + - iec-60309-2p-e-4h + - iec-60309-2p-e-6h + - iec-60309-2p-e-9h + - iec-60309-3p-e-4h + - iec-60309-3p-e-6h + - iec-60309-3p-e-9h + - iec-60309-3p-n-e-4h + - iec-60309-3p-n-e-6h + - iec-60309-3p-n-e-9h + - nema-5-15r + - nema-5-20r + - nema-5-30r + - nema-5-50r + - nema-6-15r + - nema-6-20r + - nema-6-30r + - nema-6-50r + - nema-l5-15r + - nema-l5-20r + - nema-l5-30r + - nema-l5-50r + - nema-l6-20r + - nema-l6-30r + - nema-l6-50r + - nema-l14-20r + - nema-l14-30r + - nema-l21-20r + - nema-l21-30r + - CS6360C + - CS6364C + - CS8164C + - CS8264C + - CS8364C + - CS8464C + - ita-e + - ita-f + - ita-g + - ita-h + - ita-i + - ita-j + - ita-k + - ita-l + - ita-m + - ita-n + - ita-o + - hdot-cx + required: false + type: str + power_port: + description: + - The attached power port + required: false + type: raw + feed_leg: + description: + - The phase, in case of three-phase feed + choices: + - A + - B + - C + required: false + type: str + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power port within Netbox with only required information + netbox_power_outlet_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device_type: Test Device Type + state: present + + - name: Update power port with other fields + netbox_power_outlet_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device_type: Test Device Type + type: iec-60320-c6 + power_port: Test Power Port + feed_leg: A + state: present + + - name: Delete power port within netbox + netbox_power_outlet_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Outlet + device_type: Test Device Type + state: absent +""" + +RETURN = r""" +power_outlet_template: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_POWER_OUTLET_TEMPLATES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device_type=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=False, + choices=[ + "iec-60320-c5", + "iec-60320-c7", + "iec-60320-c13", + "iec-60320-c15", + "iec-60320-c19", + "iec-60309-p-n-e-4h", + "iec-60309-p-n-e-6h", + "iec-60309-p-n-e-9h", + "iec-60309-2p-e-4h", + "iec-60309-2p-e-6h", + "iec-60309-2p-e-9h", + "iec-60309-3p-e-4h", + "iec-60309-3p-e-6h", + "iec-60309-3p-e-9h", + "iec-60309-3p-n-e-4h", + "iec-60309-3p-n-e-6h", + "iec-60309-3p-n-e-9h", + "nema-5-15r", + "nema-5-20r", + "nema-5-30r", + "nema-5-50r", + "nema-6-15r", + "nema-6-20r", + "nema-6-30r", + "nema-6-50r", + "nema-l5-15r", + "nema-l5-20r", + "nema-l5-30r", + "nema-l5-50r", + "nema-l6-20r", + "nema-l6-30r", + "nema-l6-50r", + "nema-l14-20r", + "nema-l14-30r", + "nema-l21-20r", + "nema-l21-30r", + "CS6360C", + "CS6364C", + "CS8164C", + "CS8264C", + "CS8364C", + "CS8464C", + "ita-e", + "ita-f", + "ita-g", + "ita-h", + "ita-i", + "ita-j", + "ita-k", + "ita-l", + "ita-m", + "ita-n", + "ita-o", + "hdot-cx", + ], + type="str", + ), + power_port=dict(required=False, type="raw"), + feed_leg=dict(required=False, choices=["A", "B", "C"], type="str"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device_type", "name"]), + ("state", "absent", ["device_type", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_power_outlet_template = NetboxDcimModule(module, NB_POWER_OUTLET_TEMPLATES) + netbox_power_outlet_template.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_panel.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_panel.py new file mode 100644 index 00000000..26ab406b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_panel.py @@ -0,0 +1,175 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_power_panel +short_description: Create, update or delete power panels within Netbox +description: + - Creates, updates or removes power panels from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the power panel configuration + suboptions: + site: + description: + - The site the power panel is located in + required: true + type: raw + rack_group: + description: + - The rack group the power panel is assigned to + required: false + type: raw + name: + description: + - The name of the power panel + required: true + type: str + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power panel within Netbox with only required information + netbox_power_panel: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Panel + site: Test Site + state: present + + - name: Update power panel with other fields + netbox_power_panel: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Panel + site: Test Site + rack_group: Test Rack Group + state: present + + - name: Delete power panel within netbox + netbox_power_panel: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Panel + site: Test Site + state: absent +""" + +RETURN = r""" +power_panel: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_POWER_PANELS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + site=dict(required=True, type="raw"), + rack_group=dict(required=False, type="raw"), + name=dict(required=True, type="str"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["site", "name"]), + ("state", "absent", ["site", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_power_panel = NetboxDcimModule(module, NB_POWER_PANELS) + netbox_power_panel.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_port.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_port.py new file mode 100644 index 00000000..899bc7af --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_port.py @@ -0,0 +1,316 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_power_port +short_description: Create, update or delete power ports within Netbox +description: + - Creates, updates or removes power ports from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the power port configuration + suboptions: + device: + description: + - The device the power port is attached to + required: true + type: raw + name: + description: + - The name of the power port + required: true + type: str + type: + description: + - The type of the power port + choices: + - iec-60320-c6 + - iec-60320-c8 + - iec-60320-c14 + - iec-60320-c16 + - iec-60320-c20 + - iec-60309-p-n-e-4h + - iec-60309-p-n-e-6h + - iec-60309-p-n-e-9h + - iec-60309-2p-e-4h + - iec-60309-2p-e-6h + - iec-60309-2p-e-9h + - iec-60309-3p-e-4h + - iec-60309-3p-e-6h + - iec-60309-3p-e-9h + - iec-60309-3p-n-e-4h + - iec-60309-3p-n-e-6h + - iec-60309-3p-n-e-9h + - nema-5-15p + - nema-5-20p + - nema-5-30p + - nema-5-50p + - nema-6-15p + - nema-6-20p + - nema-6-30p + - nema-6-50p + - nema-l5-15p + - nema-l5-20p + - nema-l5-30p + - nema-l5-50p + - nema-l6-20p + - nema-l6-30p + - nema-l6-50p + - nema-l14-20p + - nema-l14-30p + - nema-l21-20p + - nema-l21-30p + - cs6361c + - cs6365c + - cs8165c + - cs8265c + - cs8365c + - cs8465c + - ita-e + - ita-f + - ita-ef + - ita-g + - ita-h + - ita-i + - ita-j + - ita-k + - ita-l + - ita-m + - ita-n + - ita-o + required: false + type: str + allocated_draw: + description: + - The allocated draw of the power port in watt + required: false + type: int + maximum_draw: + description: + - The maximum permissible draw of the power port in watt + required: false + type: int + description: + description: + - Description of the power port + required: false + type: str + tags: + description: + - Any tags that the power port may need to be associated with + required: false + type: list + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power port within Netbox with only required information + netbox_power_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port + device: Test Device + state: present + + - name: Update power port with other fields + netbox_power_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port + device: Test Device + type: iec-60320-c6 + allocated_draw: 16 + maximum_draw: 80 + description: power port description + state: present + + - name: Delete power port within netbox + netbox_power_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port + device: Test Device + state: absent +""" + +RETURN = r""" +power_port: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_POWER_PORTS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=False, + choices=[ + "iec-60320-c6", + "iec-60320-c8", + "iec-60320-c14", + "iec-60320-c16", + "iec-60320-c20", + "iec-60309-p-n-e-4h", + "iec-60309-p-n-e-6h", + "iec-60309-p-n-e-9h", + "iec-60309-2p-e-4h", + "iec-60309-2p-e-6h", + "iec-60309-2p-e-9h", + "iec-60309-3p-e-4h", + "iec-60309-3p-e-6h", + "iec-60309-3p-e-9h", + "iec-60309-3p-n-e-4h", + "iec-60309-3p-n-e-6h", + "iec-60309-3p-n-e-9h", + "nema-5-15p", + "nema-5-20p", + "nema-5-30p", + "nema-5-50p", + "nema-6-15p", + "nema-6-20p", + "nema-6-30p", + "nema-6-50p", + "nema-l5-15p", + "nema-l5-20p", + "nema-l5-30p", + "nema-l5-50p", + "nema-l6-20p", + "nema-l6-30p", + "nema-l6-50p", + "nema-l14-20p", + "nema-l14-30p", + "nema-l21-20p", + "nema-l21-30p", + "cs6361c", + "cs6365c", + "cs8165c", + "cs8265c", + "cs8365c", + "cs8465c", + "ita-e", + "ita-f", + "ita-ef", + "ita-g", + "ita-h", + "ita-i", + "ita-j", + "ita-k", + "ita-l", + "ita-m", + "ita-n", + "ita-o", + ], + type="str", + ), + allocated_draw=dict(required=False, type="int"), + maximum_draw=dict(required=False, type="int"), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device", "name"]), + ("state", "absent", ["device", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_power_port = NetboxDcimModule(module, NB_POWER_PORTS) + netbox_power_port.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_port_template.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_port_template.py new file mode 100644 index 00000000..f20f6ce9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_power_port_template.py @@ -0,0 +1,303 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_power_port_template +short_description: Create, update or delete power port templates within Netbox +description: + - Creates, updates or removes power port templates from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the power port configuration + suboptions: + device_type: + description: + - The device type the power port is attached to + required: true + type: raw + name: + description: + - The name of the power port + required: true + type: str + type: + description: + - The type of the power port + choices: + - iec-60320-c6 + - iec-60320-c8 + - iec-60320-c14 + - iec-60320-c16 + - iec-60320-c20 + - iec-60309-p-n-e-4h + - iec-60309-p-n-e-6h + - iec-60309-p-n-e-9h + - iec-60309-2p-e-4h + - iec-60309-2p-e-6h + - iec-60309-2p-e-9h + - iec-60309-3p-e-4h + - iec-60309-3p-e-6h + - iec-60309-3p-e-9h + - iec-60309-3p-n-e-4h + - iec-60309-3p-n-e-6h + - iec-60309-3p-n-e-9h + - nema-5-15p + - nema-5-20p + - nema-5-30p + - nema-5-50p + - nema-6-15p + - nema-6-20p + - nema-6-30p + - nema-6-50p + - nema-l5-15p + - nema-l5-20p + - nema-l5-30p + - nema-l5-50p + - nema-l6-20p + - nema-l6-30p + - nema-l6-50p + - nema-l14-20p + - nema-l14-30p + - nema-l21-20p + - nema-l21-30p + - cs6361c + - cs6365c + - cs8165c + - cs8265c + - cs8365c + - cs8465c + - ita-e + - ita-f + - ita-ef + - ita-g + - ita-h + - ita-i + - ita-j + - ita-k + - ita-l + - ita-m + - ita-n + - ita-o + required: false + type: str + allocated_draw: + description: + - The allocated draw of the power port in watt + required: false + type: int + maximum_draw: + description: + - The maximum permissible draw of the power port in watt + required: false + type: int + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create power port within Netbox with only required information + netbox_power_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port Template + device_type: Test Device Type + state: present + + - name: Update power port with other fields + netbox_power_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port Template + device_type: Test Device Type + type: iec-60320-c6 + allocated_draw: 16 + maximum_draw: 80 + state: present + + - name: Delete power port within netbox + netbox_power_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Power Port Template + device_type: Test Device Type + state: absent +""" + +RETURN = r""" +power_port_template: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_POWER_PORT_TEMPLATES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device_type=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=False, + choices=[ + "iec-60320-c6", + "iec-60320-c8", + "iec-60320-c14", + "iec-60320-c16", + "iec-60320-c20", + "iec-60309-p-n-e-4h", + "iec-60309-p-n-e-6h", + "iec-60309-p-n-e-9h", + "iec-60309-2p-e-4h", + "iec-60309-2p-e-6h", + "iec-60309-2p-e-9h", + "iec-60309-3p-e-4h", + "iec-60309-3p-e-6h", + "iec-60309-3p-e-9h", + "iec-60309-3p-n-e-4h", + "iec-60309-3p-n-e-6h", + "iec-60309-3p-n-e-9h", + "nema-5-15p", + "nema-5-20p", + "nema-5-30p", + "nema-5-50p", + "nema-6-15p", + "nema-6-20p", + "nema-6-30p", + "nema-6-50p", + "nema-l5-15p", + "nema-l5-20p", + "nema-l5-30p", + "nema-l5-50p", + "nema-l6-20p", + "nema-l6-30p", + "nema-l6-50p", + "nema-l14-20p", + "nema-l14-30p", + "nema-l21-20p", + "nema-l21-30p", + "cs6361c", + "cs6365c", + "cs8165c", + "cs8265c", + "cs8365c", + "cs8465c", + "ita-e", + "ita-f", + "ita-ef", + "ita-g", + "ita-h", + "ita-i", + "ita-j", + "ita-k", + "ita-l", + "ita-m", + "ita-n", + "ita-o", + ], + type="str", + ), + allocated_draw=dict(required=False, type="int"), + maximum_draw=dict(required=False, type="int"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device_type", "name"]), + ("state", "absent", ["device_type", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_power_port_template = NetboxDcimModule(module, NB_POWER_PORT_TEMPLATES) + netbox_power_port_template.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_prefix.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_prefix.py new file mode 100644 index 00000000..2ef3bf13 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_prefix.py @@ -0,0 +1,306 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_prefix +short_description: Creates or removes prefixes from Netbox +description: + - Creates or removes prefixes from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) + - Anthony Ruhier (@Anthony25) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the prefix configuration + suboptions: + family: + description: + - Specifies which address family the prefix prefix belongs to + required: false + type: int + prefix: + description: + - Required if state is C(present) and first_available is False. Will allocate or free this prefix. + required: false + type: raw + parent: + description: + - Required if state is C(present) and first_available is C(yes). Will get a new available prefix in this parent prefix. + required: false + type: raw + prefix_length: + description: + - | + Required ONLY if state is C(present) and first_available is C(yes). + Will get a new available prefix of the given prefix_length in this parent prefix. + required: false + type: int + site: + description: + - Site that prefix is associated with + required: false + type: raw + vrf: + description: + - VRF that prefix is associated with + required: false + type: raw + tenant: + description: + - The tenant that the prefix will be assigned to + required: false + type: raw + vlan: + description: + - The VLAN the prefix will be assigned to + required: false + type: raw + status: + description: + - The status of the prefix + required: false + type: raw + prefix_role: + description: + - The role of the prefix + required: false + type: raw + is_pool: + description: + - All IP Addresses within this prefix are considered usable + required: false + type: bool + description: + description: + - The description of the prefix + required: false + type: str + tags: + description: + - Any tags that the prefix may need to be associated with + required: false + type: list + custom_fields: + description: + - Must exist in Netbox and in key/value format + required: false + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + first_available: + description: + - If C(yes) and state C(present), if an parent is given, it will get the + first available prefix of the given prefix_length inside the given parent (and + vrf, if given). + Unused with state C(absent). + default: false + type: bool + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox prefix module" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create prefix within Netbox with only required information + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 10.156.0.0/19 + state: present + + - name: Delete prefix within netbox + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 10.156.0.0/19 + state: absent + + - name: Create prefix with several specified options + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + family: 4 + prefix: 10.156.32.0/19 + site: Test Site + vrf: Test VRF + tenant: Test Tenant + vlan: + name: Test VLAN + site: Test Site + tenant: Test Tenant + vlan_group: Test Vlan Group + status: Reserved + prefix_role: Network of care + description: Test description + is_pool: true + tags: + - Schnozzberry + state: present + + - name: Get a new /24 inside 10.156.0.0/19 within Netbox - Parent doesn't exist + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + parent: 10.156.0.0/19 + prefix_length: 24 + state: present + first_available: yes + + - name: Create prefix within Netbox with only required information + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + prefix: 10.156.0.0/19 + state: present + + - name: Get a new /24 inside 10.156.0.0/19 within Netbox + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + parent: 10.156.0.0/19 + prefix_length: 24 + state: present + first_available: yes + + - name: Get a new /24 inside 10.157.0.0/19 within Netbox with additional values + netbox_prefix: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + parent: 10.157.0.0/19 + prefix_length: 24 + vrf: Test VRF + site: Test Site + state: present + first_available: yes +""" + +RETURN = r""" +prefix: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_ipam import ( + NetboxIpamModule, + NB_PREFIXES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + family=dict(required=False, type="int"), + prefix=dict(required=False, type="raw"), + parent=dict(required=False, type="raw"), + prefix_length=dict(required=False, type="int"), + site=dict(required=False, type="raw"), + vrf=dict(required=False, type="raw"), + tenant=dict(required=False, type="raw"), + vlan=dict(required=False, type="raw"), + status=dict(required=False, type="raw"), + prefix_role=dict(required=False, type="raw"), + is_pool=dict(required=False, type="bool"), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + first_available=dict(required=False, type="bool", default=False), + ) + ) + + required_if = [ + ("state", "present", ["prefix", "parent"], True), + ("state", "absent", ["prefix"]), + ("first_available", "yes", ["parent"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_prefix = NetboxIpamModule(module, NB_PREFIXES) + netbox_prefix.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_provider.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_provider.py new file mode 100644 index 00000000..b2bab4b4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_provider.py @@ -0,0 +1,210 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_provider +short_description: Create, update or delete providers within Netbox +description: + - Creates, updates or removes providers from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the provider configuration + suboptions: + name: + description: + - The name of the provider + required: false + type: str + asn: + description: + - The provider ASN + required: false + type: int + account: + description: + - The account number of the provider + required: false + type: str + portal_url: + description: + - The URL of the provider + required: false + type: str + noc_contact: + description: + - The NOC contact of the provider + required: false + type: str + admin_contact: + description: + - The admin contact of the provider + required: false + type: str + comments: + description: + - Comments related to the provider + required: false + type: str + tags: + description: + - Any tags that the device may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create provider within Netbox with only required information + netbox_provider: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Provider + state: present + + - name: Update provider with other fields + netbox_provider: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Provider + asn: 65001 + account: 200129104 + portal_url: http://provider.net + noc_contact: noc@provider.net + admin_contact: admin@provider.net + comments: "BAD PROVIDER" + state: present + + - name: Delete provider within netbox + netbox_provider: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Provider + state: absent +""" + +RETURN = r""" +provider: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_circuits import ( + NetboxCircuitsModule, + NB_PROVIDERS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=False, type="str"), + asn=dict(required=False, type="int"), + account=dict(required=False, type="str"), + portal_url=dict(required=False, type="str"), + noc_contact=dict(required=False, type="str"), + admin_contact=dict(required=False, type="str"), + comments=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ), + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_provider = NetboxCircuitsModule(module, NB_PROVIDERS) + netbox_provider.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rack.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rack.py new file mode 100644 index 00000000..e9698c41 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rack.py @@ -0,0 +1,282 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_rack +short_description: Create, update or delete racks within Netbox +description: + - Creates, updates or removes racks from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the rack configuration + suboptions: + name: + description: + - The name of the rack + required: true + type: str + facility_id: + description: + - The unique rack ID assigned by the facility + required: false + type: str + site: + description: + - Required if I(state=present) and the rack does not exist yet + required: false + type: raw + rack_group: + description: + - The rack group the rack will be associated to + required: false + type: raw + tenant: + description: + - The tenant that the device will be assigned to + required: false + type: raw + status: + description: + - The status of the rack + required: false + type: raw + rack_role: + description: + - The rack role the rack will be associated to + required: false + type: raw + serial: + description: + - Serial number of the rack + required: false + type: str + asset_tag: + description: + - Asset tag that is associated to the rack + required: false + type: str + type: + description: + - The type of rack + choices: + - 2-post frame + - 4-post frame + - 4-post cabinet + - Wall-mounted frame + - Wall-mounted cabinet + required: false + type: str + width: + description: + - The rail-to-rail width + choices: + - 10 + - 19 + - 21 + - 23 + required: false + type: int + u_height: + description: + - The height of the rack in rack units + required: false + type: int + desc_units: + description: + - Rack units will be numbered top-to-bottom + required: false + type: bool + outer_width: + description: + - The outer width of the rack + required: false + type: int + outer_depth: + description: + - The outer depth of the rack + required: false + type: int + outer_unit: + description: + - Whether the rack unit is in Millimeters or Inches and is I(required) if outer_width/outer_depth is specified + choices: + - Millimeters + - Inches + required: false + type: str + comments: + description: + - Comments that may include additional information in regards to the rack + required: false + type: str + tags: + description: + - Any tags that the rack may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create rack within Netbox with only required information + netbox_rack: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test rack + site: Test Site + state: present + + - name: Delete rack within netbox + netbox_rack: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rack + state: absent +""" + +RETURN = r""" +rack: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_RACKS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + facility_id=dict(required=False, type="str"), + site=dict(required=False, type="raw"), + rack_group=dict(required=False, type="raw"), + tenant=dict(required=False, type="raw"), + status=dict(required=False, type="raw"), + rack_role=dict(required=False, type="raw"), + serial=dict(required=False, type="str"), + asset_tag=dict(required=False, type="str"), + type=dict( + required=False, + type="str", + choices=[ + "2-post frame", + "4-post frame", + "4-post cabinet", + "Wall-mounted frame", + "Wall-mounted cabinet", + ], + ), + width=dict(required=False, type="int", choices=[10, 19, 21, 23,],), + u_height=dict(required=False, type="int"), + desc_units=dict(required=False, type="bool"), + outer_width=dict(required=False, type="int"), + outer_depth=dict(required=False, type="int"), + outer_unit=dict( + required=False, type="str", choices=["Millimeters", "Inches",], + ), + comments=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_rack = NetboxDcimModule(module, NB_RACKS) + netbox_rack.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rack_group.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rack_group.py new file mode 100644 index 00000000..955b5158 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rack_group.py @@ -0,0 +1,162 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_rack_group +short_description: Create, update or delete racks groups within Netbox +description: + - Creates, updates or removes racks groups from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the rack group configuration + suboptions: + name: + description: + - The name of the rack group + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + site: + description: + - Required if I(state=present) and the rack does not exist yet + required: false + type: raw + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create rack group within Netbox with only required information + netbox_rack_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test rack group + site: Test Site + state: present + + - name: Delete rack group within netbox + netbox_rack_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rack group + site: Test Site + state: absent +""" + +RETURN = r""" +rack_group: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_RACK_GROUPS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + site=dict(required=False, type="raw"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_rack_group = NetboxDcimModule(module, NB_RACK_GROUPS) + netbox_rack_group.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rack_role.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rack_role.py new file mode 100644 index 00000000..ba892954 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rack_role.py @@ -0,0 +1,161 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_rack_role +short_description: Create, update or delete racks roles within Netbox +description: + - Creates, updates or removes racks roles from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the rack role configuration + suboptions: + name: + description: + - The name of the rack role + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + color: + description: + - Hexidecimal code for a color, ex. FFFFFF + required: false + type: str + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create rack role within Netbox with only required information + netbox_rack_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test rack role + color: FFFFFF + state: present + + - name: Delete rack role within netbox + netbox_rack_role: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rack role + state: absent +""" + +RETURN = r""" +rack_role: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_RACK_ROLES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + color=dict(required=False, type="str"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_rack_role = NetboxDcimModule(module, NB_RACK_ROLES) + netbox_rack_role.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rear_port.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rear_port.py new file mode 100644 index 00000000..4c53ef6b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rear_port.py @@ -0,0 +1,231 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_rear_port +short_description: Create, update or delete rear ports within Netbox +description: + - Creates, updates or removes rear ports from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the rear port configuration + suboptions: + device: + description: + - The device the rear port is attached to + required: true + type: raw + name: + description: + - The name of the rear port + required: true + type: str + type: + description: + - The type of the rear port + choices: + - 8p8c + - 110-punch + - bnc + - mrj21 + - fc + - lc + - lc-apc + - lsh + - lsh-apc + - mpo + - mtrj + - sc + - sc-apc + - st + required: true + type: str + positions: + description: + - The number of front ports which may be mapped to each rear port + required: false + type: int + description: + description: + - Description of the rear port + required: false + type: str + tags: + description: + - Any tags that the rear port may need to be associated with + required: false + type: list + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create rear port within Netbox with only required information + netbox_rear_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port + device: Test Device + type: bnc + state: present + + - name: Update rear port with other fields + netbox_rear_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port + device: Test Device + type: bnc + positions: 5 + description: rear port description + state: present + + - name: Delete rear port within netbox + netbox_rear_port: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port + device: Test Device + type: bnc + state: absent +""" + +RETURN = r""" +rear_port: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_REAR_PORTS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=True, + choices=[ + "8p8c", + "110-punch", + "bnc", + "mrj21", + "fc", + "lc", + "lc-apc", + "lsh", + "lsh-apc", + "mpo", + "mtrj", + "sc", + "sc-apc", + "st", + ], + type="str", + ), + positions=dict(required=False, type="int"), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device", "name", "type"]), + ("state", "absent", ["device", "name", "type"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_rear_port = NetboxDcimModule(module, NB_REAR_PORTS) + netbox_rear_port.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rear_port_template.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rear_port_template.py new file mode 100644 index 00000000..80f34c5e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rear_port_template.py @@ -0,0 +1,218 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_rear_port_template +short_description: Create, update or delete rear port templates within Netbox +description: + - Creates, updates or removes rear port templates from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.2.3' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the rear port template configuration + suboptions: + device_type: + description: + - The device type the rear port template is attached to + required: true + type: raw + name: + description: + - The name of the rear port template + required: true + type: str + type: + description: + - The type of the rear port + choices: + - 8p8c + - 110-punch + - bnc + - mrj21 + - fc + - lc + - lc-apc + - lsh + - lsh-apc + - mpo + - mtrj + - sc + - sc-apc + - st + required: false + type: str + positions: + description: + - The number of front ports which may be mapped to each rear port + required: false + type: int + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create rear port template within Netbox with only required information + netbox_rear_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port Template + device_type: Test Device Type + type: bnc + state: present + + - name: Update rear port template with other fields + netbox_rear_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port Template + device_type: Test Device Type + type: bnc + positions: 5 + state: present + + - name: Delete rear port template within netbox + netbox_rear_port_template: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Rear Port Template + device_type: Test Device Type + type: bnc + state: absent +""" + +RETURN = r""" +rear_port_template: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_REAR_PORT_TEMPLATES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device_type=dict(required=True, type="raw"), + name=dict(required=True, type="str"), + type=dict( + required=False, + choices=[ + "8p8c", + "110-punch", + "bnc", + "mrj21", + "fc", + "lc", + "lc-apc", + "lsh", + "lsh-apc", + "mpo", + "mtrj", + "sc", + "sc-apc", + "st", + ], + type="str", + ), + positions=dict(required=False, type="int"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["device_type", "name", "type"]), + ("state", "absent", ["device_type", "name", "type"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_rear_port_template = NetboxDcimModule(module, NB_REAR_PORT_TEMPLATES) + netbox_rear_port_template.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_region.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_region.py new file mode 100644 index 00000000..01d9ee10 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_region.py @@ -0,0 +1,161 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_region +short_description: Creates or removes regions from Netbox +description: + - Creates or removes regions from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: "0.1.0" +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the region configuration + suboptions: + name: + description: + - Name of the region to be created + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + parent_region: + description: + - The parent region this region should be tied to + required: false + type: raw + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox region module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create tenant within Netbox with only required information + netbox_region: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: "Test Region One" + state: present + + - name: Delete tenant within netbox + netbox_region: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant Group ABC + state: absent +""" + +RETURN = r""" +region: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_REGIONS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + parent_region=dict(required=False, type="raw"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_region = NetboxDcimModule(module, NB_REGIONS) + netbox_region.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rir.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rir.py new file mode 100644 index 00000000..c74e6c52 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_rir.py @@ -0,0 +1,169 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_rir +short_description: Create, update or delete RIRs within Netbox +description: + - Creates, updates or removes RIRs from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the RIR configuration + suboptions: + name: + description: + - The name of the RIR + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + is_private: + description: + - IP space managed by this RIR is considered private + required: false + type: bool + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create RIR within Netbox with only required information + netbox_rir: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test RIR One + state: present + + - name: Update Test RIR One + netbox_rir: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test RIR One + is_private: True + state: present + + - name: Delete RIR within netbox + netbox_rir: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test RIR One + state: absent +""" + +RETURN = r""" +rir: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_ipam import ( + NetboxIpamModule, + NB_RIRS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + is_private=dict(required=False, type="bool"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_rir = NetboxIpamModule(module, NB_RIRS) + netbox_rir.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_service.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_service.py new file mode 100644 index 00000000..672955c7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_service.py @@ -0,0 +1,222 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Kulakov Ilya (@TawR1024) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_service +short_description: Creates or removes service from Netbox +description: + - Creates or removes service from Netbox +notes: + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Kulakov Ilya (@TawR1024) +requirements: + - pynetbox +version_added: '0.1.5' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the service configuration + suboptions: + device: + description: + - Specifies on which device the service is running + required: false + type: raw + virtual_machine: + description: + - Specifies on which virtual machine the service is running + required: false + type: raw + name: + description: + - Name of the region to be created + required: true + type: str + port: + description: + - Specifies which port used by service + required: false + type: int + ports: + description: + - Specifies which ports used by service (NetBox 2.10 and newer) + type: list + elements: int + protocol: + description: + - Specifies which protocol used by service + required: true + type: raw + ipaddresses: + description: + - Specifies which IPaddresses to associate with service. + required: false + type: raw + description: + description: + - Service description + required: false + type: str + tags: + description: + - What tags to add/update + required: false + type: list + custom_fields: + description: + - Must exist in Netbox and in key/value format + required: false + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Create netbox service" + connection: local + hosts: all + gather_facts: False + + tasks: + - name: Create service + netbox_service: + netbox_url: netbox_url + netbox_token: netbox_token + data: + device: Test666 + name: node-exporter + port: 9100 + protocol: TCP + ipaddresses: + - address: 127.0.0.1 + tags: + - prometheus + state: present + +- name: "Delete netbox service" + connection: local + hosts: all + gather_facts: False + + tasks: + - name: Delete service + netbox_service: + netbox_url: netbox_url + netbox_token: netbox_token + data: + device: Test666 + name: node-exporter + port: 9100 + protocol: TCP + state: absent +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_ipam import ( + NetboxIpamModule, + NB_SERVICES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + device=dict(required=False, type="raw"), + virtual_machine=dict(required=False, type="raw"), + name=dict(required=True, type="str"), + port=dict(required=False, type="int"), + ports=dict(required=False, type="list", elements="int"), + protocol=dict(required=True, type="raw"), + ipaddresses=dict(required=False, type="raw"), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["name"]), + ("state", "absent", ["name"]), + ] + mutually_exclusive = [("port", "ports")] + required_one_of = [["device", "virtual_machine"], ["port", "ports"]] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + required_if=required_if, + required_one_of=required_one_of, + mutually_exclusive=mutually_exclusive, + ) + + netbox_service = NetboxIpamModule(module, NB_SERVICES) + + # Change port to ports for 2.10+ and convert to a list with the single integer + if netbox_service.data.get("port") and netbox_service._version_check_greater( + netbox_service.version, "2.10", greater_or_equal=True + ): + netbox_service.data["ports"] = [netbox_service.data.pop("port")] + + # Run the normal run() method + netbox_service.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_site.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_site.py new file mode 100644 index 00000000..0ed85442 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_site.py @@ -0,0 +1,281 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_site +short_description: Creates or removes sites from Netbox +description: + - Creates or removes sites from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: "0.1.0" +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the site configuration + suboptions: + name: + description: + - Name of the site to be created + required: true + type: str + status: + description: + - Status of the site + required: false + type: raw + region: + description: + - The region that the site should be associated with + required: false + type: raw + tenant: + description: + - The tenant the site will be assigned to + required: false + type: raw + facility: + description: + - Data center provider or facility, ex. Equinix NY7 + required: false + type: str + asn: + description: + - The ASN associated with the site + required: false + type: int + time_zone: + description: + - Timezone associated with the site, ex. America/Denver + required: false + type: str + description: + description: + - The description of the prefix + required: false + type: str + physical_address: + description: + - Physical address of site + required: false + type: str + shipping_address: + description: + - Shipping address of site + required: false + type: str + latitude: + description: + - Latitude in decimal format + required: false + type: float + longitude: + description: + - Longitude in decimal format + required: false + type: float + contact_name: + description: + - Name of contact for site + required: false + type: str + contact_phone: + description: + - Contact phone number for site + required: false + type: str + contact_email: + description: + - Contact email for site + required: false + type: str + comments: + description: + - Comments for the site. This can be markdown syntax + required: false + type: str + slug: + description: + - URL-friendly unique shorthand + required: false + type: str + tags: + description: + - Any tags that the prefix may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox site module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create site within Netbox with only required information + netbox_site: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test - Colorado + state: present + + - name: Delete site within netbox + netbox_site: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test - Colorado + state: absent + + - name: Create site with all parameters + netbox_site: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test - California + status: Planned + region: Test Region + tenant: Test Tenant + facility: EquinoxCA7 + asn: 65001 + time_zone: America/Los Angeles + description: This is a test description + 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@changednumber.com + slug: test-california + comments: ### Placeholder + state: present +""" + +RETURN = r""" +site: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_SITES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + status=dict(required=False, type="raw"), + region=dict(required=False, type="raw"), + tenant=dict(required=False, type="raw"), + facility=dict(required=False, type="str"), + asn=dict(required=False, type="int"), + time_zone=dict(required=False, type="str"), + description=dict(required=False, type="str"), + physical_address=dict(required=False, type="str"), + shipping_address=dict(required=False, type="str"), + latitude=dict(required=False, type="float"), + longitude=dict(required=False, type="float"), + contact_name=dict(required=False, type="str"), + contact_phone=dict(required=False, type="str"), + contact_email=dict(required=False, type="str"), + comments=dict(required=False, type="str"), + slug=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_site = NetboxDcimModule(module, NB_SITES) + netbox_site.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_tag.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_tag.py new file mode 100644 index 00000000..20a399f2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_tag.py @@ -0,0 +1,173 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Pavel Korovin (@pkorovin) <p@tristero.se> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_tag +short_description: Creates or removes tags from Netbox +description: + - Creates or removes tags from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Pavel Korovin (@pkorovin) +requirements: + - pynetbox +version_added: "1.2.0" +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the tag configuration + suboptions: + name: + description: + - Tag name + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + color: + description: + - Tag color + required: false + type: str + description: + description: + - Tag description + required: false + type: str + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test tags creation/deletion" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create tags + netbox_tag: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: "{{ item.name }}" + description: "{{ item.description }}" + loop: + - { name: mgmt, description: "management" } + - { name: tun, description: "tunnel" } + + - name: Delete tags + netbox_tag: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: "{{ item }}" + state: absent + loop: + - mgmt + - tun +""" + +RETURN = r""" +tags: + description: Serialized object as created/existent/updated/deleted within Netbox + returned: always + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_extras import ( + NetboxExtrasModule, + NB_TAGS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + color=dict(required=False, type="str"), + description=dict(required=False, type="str"), + slug=dict(required=False, type="str"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_tag = NetboxExtrasModule(module, NB_TAGS) + netbox_tag.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_tenant.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_tenant.py new file mode 100644 index 00000000..5edc9066 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_tenant.py @@ -0,0 +1,200 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Amy Liebowitz (@amylieb) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_tenant +short_description: Creates or removes tenants from Netbox +description: + - Creates or removes tenants from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Amy Liebowitz (@amylieb) +requirements: + - pynetbox +version_added: "0.1.0" +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the tenant configuration + suboptions: + name: + description: + - Name of the tenant to be created + required: true + type: str + tenant_group: + description: + - Tenant group this tenant should be in + required: false + type: raw + description: + description: + - The description of the tenant + required: false + type: str + comments: + description: + - Comments for the tenant. This can be markdown syntax + required: false + type: str + slug: + description: + - URL-friendly unique shorthand + required: false + type: str + tags: + description: + - Any tags that the tenant may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create tenant within Netbox with only required information + netbox_tenant: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant ABC + state: present + + - name: Delete tenant within netbox + netbox_tenant: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant ABC + state: absent + + - name: Create tenant with all parameters + netbox_tenant: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant ABC + group: Very Special Tenants + description: ABC Incorporated + comments: '### This tenant is super cool' + slug: tenant_abc + tags: + - tagA + - tagB + - tagC + state: present +""" + +RETURN = r""" +tenant: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_tenancy import ( + NetboxTenancyModule, + NB_TENANTS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + tenant_group=dict(required=False, type="raw"), + description=dict(required=False, type="str"), + comments=dict(required=False, type="str"), + slug=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_tenant = NetboxTenancyModule(module, NB_TENANTS) + netbox_tenant.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_tenant_group.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_tenant_group.py new file mode 100644 index 00000000..0781584b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_tenant_group.py @@ -0,0 +1,156 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_tenant_group +short_description: Creates or removes tenant groups from Netbox +description: + - Creates or removes tenant groups from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: "0.1.0" +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the tenant group configuration + suboptions: + name: + description: + - Name of the tenant group to be created + required: true + type: str + slug: + description: + - URL-friendly unique shorthand + required: false + type: str + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox tenant group module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create tenant within Netbox with only required information + netbox_tenant_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant Group ABC + slug: "tenant_group_abc" + state: present + + - name: Delete tenant within netbox + netbox_tenant_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Tenant ABC + state: absent + +""" + +RETURN = r""" +tenant_group: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_tenancy import ( + NetboxTenancyModule, + NB_TENANT_GROUPS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_tenant_group = NetboxTenancyModule(module, NB_TENANT_GROUPS) + netbox_tenant_group.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_virtual_chassis.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_virtual_chassis.py new file mode 100644 index 00000000..9b085101 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_virtual_chassis.py @@ -0,0 +1,183 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_virtual_chassis +short_description: Create, update or delete virtual chassis within Netbox +description: + - Creates, updates or removes virtual chassis from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Tobias Groß (@toerb) +requirements: + - pynetbox +version_added: '0.3.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + required: true + description: + - Defines the virtual chassis configuration + suboptions: + name: + description: + - Name + required: false + type: str + master: + description: + - The master device the virtual chassis is attached to + required: false + type: raw + domain: + description: + - domain of the virtual chassis + required: false + type: str + tags: + description: + - Any tags that the virtual chassis may need to be associated with + required: false + type: list + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create virtual chassis within Netbox with only required information + netbox_virtual_chassis: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: "Virtual Chassis 1" + master: Test Device + state: present + + - name: Update virtual chassis with other fields + netbox_virtual_chassis: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + master: Test Device + domain: Domain Text + state: present + + - name: Delete virtual chassis within netbox + netbox_virtual_chassis: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + master: Test Device + state: absent +""" + +RETURN = r""" +virtual_chassis: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NetboxDcimModule, + NB_VIRTUAL_CHASSIS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=False, type="str"), + master=dict(required=False, type="raw"), + domain=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + # required_if = [ + # ("state", "present", ["master"]), + # ("state", "absent", ["master"]), + # ] + required_one_of = [["name", "master"]] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + # required_if=required_if, + required_one_of=required_one_of, + ) + + netbox_virtual_chassis = NetboxDcimModule(module, NB_VIRTUAL_CHASSIS) + netbox_virtual_chassis.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_virtual_machine.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_virtual_machine.py new file mode 100644 index 00000000..aaae4e93 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_virtual_machine.py @@ -0,0 +1,261 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Gaelle Mangin (@gmangin) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_virtual_machine +short_description: Create, update or delete virtual_machines within Netbox +description: + - Creates, updates or removes virtual_machines from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Gaelle MANGIN (@gmangin) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the virtual machine configuration + suboptions: + name: + description: + - The name of the virtual machine + required: true + type: str + site: + description: + - The name of the site attach to the virtual machine + required: false + type: raw + cluster: + description: + - The name of the cluster attach to the virtual machine + required: false + type: raw + virtual_machine_role: + description: + - The role of the virtual machine + required: false + type: raw + vcpus: + description: + - Number of vcpus of the virtual machine + required: false + type: int + tenant: + description: + - The tenant that the virtual machine will be assigned to + required: false + type: raw + platform: + description: + - The platform of the virtual machine + required: false + type: raw + primary_ip4: + description: + - Primary IPv4 address assigned to the virtual machine + required: false + type: raw + primary_ip6: + description: + - Primary IPv6 address assigned to the virtual machine + required: false + type: raw + memory: + description: + - Memory of the virtual machine (MB) + required: false + type: int + disk: + description: + - Disk of the virtual machine (GB) + required: false + type: int + status: + description: + - The status of the virtual machine + required: false + type: raw + tags: + description: + - Any tags that the virtual machine may need to be associated with + required: false + type: list + custom_fields: + description: + - Must exist in Netbox + required: false + type: dict + local_context_data: + description: + - configuration context of the virtual machine + required: false + type: dict + comments: + description: + - Comments of the virtual machine + required: false + type: str + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create virtual machine within Netbox with only required information + netbox_virtual_machine: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Virtual Machine + cluster: test cluster + state: present + + - name: Delete virtual machine within netbox + netbox_virtual_machine: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Virtual Machine + state: absent + + - name: Create virtual machine with tags + netbox_virtual_machine: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Another Test Virtual Machine + cluster: test cluster + site: Test Site + tags: + - Schnozzberry + state: present + + - name: Update vcpus, memory and disk of an existing virtual machine + netbox_virtual_machine: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test Virtual Machine + cluster: test cluster + vcpus: 8 + memory: 8 + disk: 8 + state: present +""" + +RETURN = r""" +virtual machine: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_virtualization import ( + NetboxVirtualizationModule, + NB_VIRTUAL_MACHINES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + site=dict(required=False, type="raw"), + cluster=dict(required=False, type="raw"), + virtual_machine_role=dict(required=False, type="raw"), + vcpus=dict(required=False, type="int"), + tenant=dict(required=False, type="raw"), + platform=dict(required=False, type="raw"), + primary_ip4=dict(required=False, type="raw"), + primary_ip6=dict(required=False, type="raw"), + memory=dict(required=False, type="int"), + disk=dict(required=False, type="int"), + status=dict(required=False, type="raw"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + local_context_data=dict(required=False, type="dict"), + comments=dict(required=False, type="str"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_virtual_machine = NetboxVirtualizationModule(module, NB_VIRTUAL_MACHINES) + netbox_virtual_machine.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vlan.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vlan.py new file mode 100644 index 00000000..34de99db --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vlan.py @@ -0,0 +1,222 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_vlan +short_description: Create, update or delete vlans within Netbox +description: + - Creates, updates or removes vlans from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the vlan configuration + suboptions: + site: + description: + - The site the VLAN will be associated to + required: false + type: raw + vlan_group: + description: + - The VLAN group the VLAN will be associated to + required: false + type: raw + vid: + description: + - The VLAN ID + required: false + type: int + name: + description: + - The name of the vlan + required: true + type: str + tenant: + description: + - The tenant that the vlan will be assigned to + required: false + type: raw + status: + description: + - The status of the vlan + required: false + type: raw + vlan_role: + description: + - Required if I(state=present) and the vlan does not exist yet + required: false + type: raw + description: + description: + - The description of the vlan + required: false + type: str + tags: + description: + - Any tags that the vlan may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create vlan within Netbox with only required information + netbox_vlan: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VLAN + vid: 400 + state: present + + - name: Delete vlan within netbox + netbox_vlan: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VLAN + vid: 400 + state: absent + + - name: Create vlan with all information + netbox_vlan: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VLAN + vid: 400 + site: Test Site + group: Test VLAN Group + tenant: Test Tenant + status: Deprecated + vlan_role: Test VLAN Role + description: Just a test + tags: + - Schnozzberry + state: present +""" + +RETURN = r""" +vlan: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_ipam import ( + NetboxIpamModule, + NB_VLANS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + site=dict(required=False, type="raw"), + vlan_group=dict(required=False, type="raw"), + vid=dict(required=False, type="int"), + name=dict(required=True, type="str"), + tenant=dict(required=False, type="raw"), + status=dict(required=False, type="raw"), + vlan_role=dict(required=False, type="raw"), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + required_if = [ + ("state", "present", ["name"]), + ("state", "absent", ["name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_vlan = NetboxIpamModule(module, NB_VLANS) + netbox_vlan.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vlan_group.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vlan_group.py new file mode 100644 index 00000000..582bfd24 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vlan_group.py @@ -0,0 +1,161 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_vlan_group +short_description: Create, update or delete vlans groups within Netbox +description: + - Creates, updates or removes vlans groups from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the vlan group configuration + suboptions: + name: + description: + - The name of the vlan group + required: true + type: str + slug: + description: + - The slugified version of the name or custom slug. + - This is auto-generated following NetBox rules if not provided + required: false + type: str + site: + description: + - The site the vlan will be assigned to + required: false + type: raw + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create vlan group within Netbox with only required information + netbox_vlan_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test vlan group + site: Test Site + state: present + + - name: Delete vlan group within netbox + netbox_vlan_group: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test vlan group + state: absent +""" + +RETURN = r""" +vlan_group: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_ipam import ( + NetboxIpamModule, + NB_VLAN_GROUPS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + slug=dict(required=False, type="str"), + site=dict(required=False, type="raw"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_vlan_group = NetboxIpamModule(module, NB_VLAN_GROUPS) + netbox_vlan_group.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vm_interface.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vm_interface.py new file mode 100644 index 00000000..dbc8ef3b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vm_interface.py @@ -0,0 +1,227 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Benjamin Vergnaud (@bvergnaud) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_vm_interface +short_description: Creates or removes interfaces from virtual machines in Netbox +description: + - Creates or removes interfaces from virtual machines in Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Benjamin Vergnaud (@bvergnaud) +requirements: + - pynetbox +version_added: "0.1.0" +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + description: + - Defines the vm interface configuration + suboptions: + virtual_machine: + description: + - Name of the virtual machine the interface will be associated with (case-sensitive) + required: false + type: raw + name: + description: + - Name of the interface to be created + required: true + type: str + enabled: + description: + - Sets whether interface shows enabled or disabled + required: false + type: bool + mtu: + description: + - The MTU of the interface + required: false + type: int + mac_address: + description: + - The MAC address of the interface + required: false + type: str + description: + description: + - The description of the interface + required: false + type: str + mode: + description: + - The mode of the interface + required: false + type: raw + untagged_vlan: + description: + - The untagged VLAN to be assigned to interface + required: false + type: raw + tagged_vlans: + description: + - A list of tagged VLANS to be assigned to interface. Mode must be set to either C(Tagged) or C(Tagged All) + required: false + type: raw + tags: + description: + - Any tags that the prefix may need to be associated with + required: false + type: list + required: true + type: dict + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - | + If C(no), SSL certificates will not be validated. + This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox interface module" + connection: local + hosts: localhost + gather_facts: False + tasks: + - name: Create interface within Netbox with only required information + netbox_vm_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + virtual_machine: test100 + name: GigabitEthernet1 + state: present + + - name: Delete interface within netbox + netbox_vm_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + virtual_machine: test100 + name: GigabitEthernet1 + state: absent + + - name: Create interface as a trunk port + netbox_vm_interface: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + virtual_machine: test100 + name: GigabitEthernet25 + enabled: false + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + mtu: 1600 + mode: Tagged + state: present +""" + +RETURN = r""" +interface: + description: Serialized object as created or already existent within Netbox + returned: on creation + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_virtualization import ( + NetboxVirtualizationModule, + NB_VM_INTERFACES, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + virtual_machine=dict(required=False, type="raw"), + name=dict(required=True, type="str"), + enabled=dict(required=False, type="bool"), + mtu=dict(required=False, type="int"), + mac_address=dict(required=False, type="str"), + description=dict(required=False, type="str"), + mode=dict(required=False, type="raw"), + untagged_vlan=dict(required=False, type="raw"), + tagged_vlans=dict(required=False, type="raw"), + tags=dict(required=False, type="list"), + ), + ), + ) + ) + + required_if = [ + ("state", "present", ["virtual_machine", "name"]), + ("state", "absent", ["virtual_machine", "name"]), + ] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_vm_interface = NetboxVirtualizationModule(module, NB_VM_INTERFACES) + netbox_vm_interface.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vrf.py b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vrf.py new file mode 100644 index 00000000..c23d41f0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/plugins/modules/netbox_vrf.py @@ -0,0 +1,197 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} + +DOCUMENTATION = r""" +--- +module: netbox_vrf +short_description: Create, update or delete vrfs within Netbox +description: + - Creates, updates or removes vrfs from Netbox +notes: + - Tags should be defined as a YAML list + - This should be ran with connection C(local) and hosts C(localhost) +author: + - Mikhail Yohman (@FragmentedPacket) +requirements: + - pynetbox +version_added: '0.1.0' +options: + netbox_url: + description: + - URL of the Netbox instance resolvable by Ansible control host + required: true + type: str + netbox_token: + description: + - The token created within Netbox to authorize API access + required: true + type: str + data: + type: dict + description: + - Defines the vrf configuration + suboptions: + name: + description: + - The name of the vrf + required: true + type: str + rd: + description: + - The RD of the VRF. Must be quoted to pass as a string. + required: false + type: str + tenant: + description: + - The tenant that the vrf will be assigned to + required: false + type: raw + enforce_unique: + description: + - Prevent duplicate prefixes/IP addresses within this VRF + required: false + type: bool + description: + description: + - The description of the vrf + required: false + type: str + tags: + description: + - Any tags that the vrf may need to be associated with + required: false + type: list + custom_fields: + description: + - must exist in Netbox + required: false + type: dict + required: true + state: + description: + - Use C(present) or C(absent) for adding or removing. + choices: [ absent, present ] + default: present + type: str + query_params: + description: + - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined + - in plugins/module_utils/netbox_utils.py and provides control to users on what may make + - an object unique in their environment. + required: false + type: list + elements: str + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. + default: true + type: raw +""" + +EXAMPLES = r""" +- name: "Test Netbox modules" + connection: local + hosts: localhost + gather_facts: False + + tasks: + - name: Create vrf within Netbox with only required information + netbox_vrf: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VRF + state: present + + - name: Delete vrf within netbox + netbox_vrf: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VRF + state: absent + + - name: Create vrf with all information + netbox_vrf: + netbox_url: http://netbox.local + netbox_token: thisIsMyToken + data: + name: Test VRF + rd: "65000:1" + tenant: Test Tenant + enforce_unique: true + description: VRF description + tags: + - Schnozzberry + state: present +""" + +RETURN = r""" +vrf: + description: Serialized object as created or already existent within Netbox + returned: success (when I(state=present)) + type: dict +msg: + description: Message indicating failure or info about what has been achieved + returned: always + type: str +""" + +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxAnsibleModule, + NETBOX_ARG_SPEC, +) +from ansible_collections.netbox.netbox.plugins.module_utils.netbox_ipam import ( + NetboxIpamModule, + NB_VRFS, +) +from copy import deepcopy + + +def main(): + """ + Main entry point for module execution + """ + argument_spec = deepcopy(NETBOX_ARG_SPEC) + argument_spec.update( + dict( + data=dict( + type="dict", + required=True, + options=dict( + name=dict(required=True, type="str"), + rd=dict(required=False, type="str"), + tenant=dict(required=False, type="raw"), + enforce_unique=dict(required=False, type="bool"), + description=dict(required=False, type="str"), + tags=dict(required=False, type="list"), + custom_fields=dict(required=False, type="dict"), + ), + ), + ) + ) + + required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] + + module = NetboxAnsibleModule( + argument_spec=argument_spec, supports_check_mode=True, required_if=required_if + ) + + netbox_vrf = NetboxIpamModule(module, NB_VRFS) + netbox_vrf.run() + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/poetry.lock b/collections-debian-merged/ansible_collections/netbox/netbox/poetry.lock new file mode 100644 index 00000000..de49d8ae --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/poetry.lock @@ -0,0 +1,834 @@ +[[package]] +name = "ansible-base" +version = "2.10.3" +description = "Radically simple IT automation" +category = "main" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" + +[package.dependencies] +cryptography = "*" +jinja2 = "*" +packaging = "*" +PyYAML = "*" + +[[package]] +name = "apipkg" +version = "1.5" +description = "apipkg: namespace control and lazy-import mechanism" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "appdirs" +version = "1.4.4" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "atomicwrites" +version = "1.4.0" +description = "Atomic file writes." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "attrs" +version = "20.3.0" +description = "Classes Without Boilerplate" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.extras] +dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "furo", "sphinx", "pre-commit"] +docs = ["furo", "sphinx", "zope.interface"] +tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] +tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"] + +[[package]] +name = "black" +version = "19.10b0" +description = "The uncompromising code formatter." +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +appdirs = "*" +attrs = ">=18.1.0" +click = ">=6.5" +pathspec = ">=0.6,<1" +regex = "*" +toml = ">=0.9.4" +typed-ast = ">=1.4.0" + +[package.extras] +d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] + +[[package]] +name = "certifi" +version = "2020.11.8" +description = "Python package for providing Mozilla's CA Bundle." +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "cffi" +version = "1.14.4" +description = "Foreign Function Interface for Python calling C code." +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +pycparser = "*" + +[[package]] +name = "chardet" +version = "3.0.4" +description = "Universal encoding detector for Python 2 and 3" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "click" +version = "7.1.2" +description = "Composable command line interface toolkit" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "codecov" +version = "2.1.10" +description = "Hosted coverage reports for GitHub, Bitbucket and Gitlab" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.dependencies] +coverage = "*" +requests = ">=2.7.9" + +[[package]] +name = "colorama" +version = "0.4.4" +description = "Cross-platform colored terminal text." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "coverage" +version = "4.5.4" +description = "Code coverage measurement for Python" +category = "main" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <4" + +[[package]] +name = "cryptography" +version = "3.2.1" +description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers." +category = "main" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" + +[package.dependencies] +cffi = ">=1.8,<1.11.3 || >1.11.3" +six = ">=1.4.1" + +[package.extras] +docs = ["sphinx (>=1.6.5,!=1.8.0,!=3.1.0,!=3.1.1)", "sphinx-rtd-theme"] +docstest = ["doc8", "pyenchant (>=1.6.11)", "twine (>=1.12.0)", "sphinxcontrib-spelling (>=4.0.1)"] +pep8test = ["black", "flake8", "flake8-import-order", "pep8-naming"] +ssh = ["bcrypt (>=3.1.5)"] +test = ["pytest (>=3.6.0,!=3.9.0,!=3.9.1,!=3.9.2)", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,!=3.79.2)"] + +[[package]] +name = "execnet" +version = "1.7.1" +description = "execnet: rapid multi-Python deployment" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.dependencies] +apipkg = ">=1.4" + +[package.extras] +testing = ["pre-commit"] + +[[package]] +name = "idna" +version = "2.10" +description = "Internationalized Domain Names in Applications (IDNA)" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "importlib-metadata" +version = "3.1.1" +description = "Read metadata from Python packages" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +zipp = ">=0.5" + +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] +testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] + +[[package]] +name = "iniconfig" +version = "1.1.1" +description = "iniconfig: brain-dead simple config-ini parsing" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "jinja2" +version = "2.11.2" +description = "A very fast and expressive template engine." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[package.dependencies] +MarkupSafe = ">=0.23" + +[package.extras] +i18n = ["Babel (>=0.8)"] + +[[package]] +name = "jmespath" +version = "0.10.0" +description = "JSON Matching Expressions" +category = "main" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "jsondiff" +version = "1.2.0" +description = "Diff JSON and JSON-like structures in Python" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "markupsafe" +version = "1.1.1" +description = "Safely add untrusted strings to HTML/XML markup." +category = "main" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" + +[[package]] +name = "mock" +version = "4.0.2" +description = "Rolling backport of unittest.mock for all Pythons" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.extras] +build = ["twine", "wheel", "blurb"] +docs = ["sphinx"] +test = ["pytest", "pytest-cov"] + +[[package]] +name = "packaging" +version = "20.7" +description = "Core utilities for Python packages" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.dependencies] +pyparsing = ">=2.0.2" + +[[package]] +name = "pathspec" +version = "0.8.1" +description = "Utility library for gitignore style pattern matching of file paths." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "pluggy" +version = "0.13.1" +description = "plugin and hook calling mechanisms for python" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.dependencies] +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} + +[package.extras] +dev = ["pre-commit", "tox"] + +[[package]] +name = "py" +version = "1.9.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "pycparser" +version = "2.20" +description = "C parser in Python" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "pynetbox" +version = "5.1.0" +description = "NetBox API client library" +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +requests = ">=2.20.0,<3.0" +six = ">=1.0.0,<2.0.0" + +[[package]] +name = "pyparsing" +version = "2.4.7" +description = "Python parsing module" +category = "main" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "pytest" +version = "6.1.2" +description = "pytest: simple powerful testing with Python" +category = "main" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} +attrs = ">=17.4.0" +colorama = {version = "*", markers = "sys_platform == \"win32\""} +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<1.0" +py = ">=1.8.2" +toml = "*" + +[package.extras] +checkqa_mypy = ["mypy (==0.780)"] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] + +[[package]] +name = "pytest-forked" +version = "1.3.0" +description = "run tests in isolated forked subprocesses" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[package.dependencies] +py = "*" +pytest = ">=3.10" + +[[package]] +name = "pytest-mock" +version = "3.3.1" +description = "Thin-wrapper around the mock package for easier use with pytest" +category = "main" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +pytest = ">=5.0" + +[package.extras] +dev = ["pre-commit", "tox", "pytest-asyncio"] + +[[package]] +name = "pytest-xdist" +version = "2.1.0" +description = "pytest xdist plugin for distributed testing and loop-on-failing modes" +category = "main" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +execnet = ">=1.1" +pytest = ">=6.0.0" +pytest-forked = "*" + +[package.extras] +psutil = ["psutil (>=3.0)"] +testing = ["filelock"] + +[[package]] +name = "pyyaml" +version = "5.3.1" +description = "YAML parser and emitter for Python" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "regex" +version = "2020.11.13" +description = "Alternative regular expression module, to replace re." +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "requests" +version = "2.25.0" +description = "Python HTTP for Humans." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[package.dependencies] +certifi = ">=2017.4.17" +chardet = ">=3.0.2,<4" +idna = ">=2.5,<3" +urllib3 = ">=1.21.1,<1.27" + +[package.extras] +security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"] +socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] + +[[package]] +name = "six" +version = "1.15.0" +description = "Python 2 and 3 compatibility utilities" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "main" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "typed-ast" +version = "1.4.1" +description = "a fork of Python 2 and 3 ast modules with type comment support" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "urllib3" +version = "1.26.2" +description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" + +[package.extras] +brotli = ["brotlipy (>=0.6.0)"] +secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] + +[[package]] +name = "zipp" +version = "3.4.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] +testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] + +[metadata] +lock-version = "1.1" +python-versions = "^3.6" +content-hash = "78e7161cc9436b54e68ac325144ec2e37da0d3ffb354b1928c0d21990217bac9" + +[metadata.files] +ansible-base = [ + {file = "ansible-base-2.10.3.tar.gz", hash = "sha256:35a208726b10fecbcf00c263ae4572b48f505b5796fb77a85c3e9c1036ea5e4f"}, +] +apipkg = [ + {file = "apipkg-1.5-py2.py3-none-any.whl", hash = "sha256:58587dd4dc3daefad0487f6d9ae32b4542b185e1c36db6993290e7c41ca2b47c"}, + {file = "apipkg-1.5.tar.gz", hash = "sha256:37228cda29411948b422fae072f57e31d3396d2ee1c9783775980ee9c9990af6"}, +] +appdirs = [ + {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, + {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, +] +atomicwrites = [ + {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, + {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, +] +attrs = [ + {file = "attrs-20.3.0-py2.py3-none-any.whl", hash = "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6"}, + {file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"}, +] +black = [ + {file = "black-19.10b0-py36-none-any.whl", hash = "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b"}, + {file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"}, +] +certifi = [ + {file = "certifi-2020.11.8-py2.py3-none-any.whl", hash = "sha256:1f422849db327d534e3d0c5f02a263458c3955ec0aae4ff09b95f195c59f4edd"}, + {file = "certifi-2020.11.8.tar.gz", hash = "sha256:f05def092c44fbf25834a51509ef6e631dc19765ab8a57b4e7ab85531f0a9cf4"}, +] +cffi = [ + {file = "cffi-1.14.4-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:ebb253464a5d0482b191274f1c8bf00e33f7e0b9c66405fbffc61ed2c839c775"}, + {file = "cffi-1.14.4-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:2c24d61263f511551f740d1a065eb0212db1dbbbbd241db758f5244281590c06"}, + {file = "cffi-1.14.4-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:9f7a31251289b2ab6d4012f6e83e58bc3b96bd151f5b5262467f4bb6b34a7c26"}, + {file = "cffi-1.14.4-cp27-cp27m-win32.whl", hash = "sha256:5cf4be6c304ad0b6602f5c4e90e2f59b47653ac1ed9c662ed379fe48a8f26b0c"}, + {file = "cffi-1.14.4-cp27-cp27m-win_amd64.whl", hash = "sha256:f60567825f791c6f8a592f3c6e3bd93dd2934e3f9dac189308426bd76b00ef3b"}, + {file = "cffi-1.14.4-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:c6332685306b6417a91b1ff9fae889b3ba65c2292d64bd9245c093b1b284809d"}, + {file = "cffi-1.14.4-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:d9efd8b7a3ef378dd61a1e77367f1924375befc2eba06168b6ebfa903a5e59ca"}, + {file = "cffi-1.14.4-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:51a8b381b16ddd370178a65360ebe15fbc1c71cf6f584613a7ea08bfad946698"}, + {file = "cffi-1.14.4-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:1d2c4994f515e5b485fd6d3a73d05526aa0fcf248eb135996b088d25dfa1865b"}, + {file = "cffi-1.14.4-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:af5c59122a011049aad5dd87424b8e65a80e4a6477419c0c1015f73fb5ea0293"}, + {file = "cffi-1.14.4-cp35-cp35m-win32.whl", hash = "sha256:594234691ac0e9b770aee9fcdb8fa02c22e43e5c619456efd0d6c2bf276f3eb2"}, + {file = "cffi-1.14.4-cp35-cp35m-win_amd64.whl", hash = "sha256:64081b3f8f6f3c3de6191ec89d7dc6c86a8a43911f7ecb422c60e90c70be41c7"}, + {file = "cffi-1.14.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f803eaa94c2fcda012c047e62bc7a51b0bdabda1cad7a92a522694ea2d76e49f"}, + {file = "cffi-1.14.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:105abaf8a6075dc96c1fe5ae7aae073f4696f2905fde6aeada4c9d2926752362"}, + {file = "cffi-1.14.4-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0638c3ae1a0edfb77c6765d487fee624d2b1ee1bdfeffc1f0b58c64d149e7eec"}, + {file = "cffi-1.14.4-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:7c6b1dece89874d9541fc974917b631406233ea0440d0bdfbb8e03bf39a49b3b"}, + {file = "cffi-1.14.4-cp36-cp36m-win32.whl", hash = "sha256:155136b51fd733fa94e1c2ea5211dcd4c8879869008fc811648f16541bf99668"}, + {file = "cffi-1.14.4-cp36-cp36m-win_amd64.whl", hash = "sha256:6bc25fc545a6b3d57b5f8618e59fc13d3a3a68431e8ca5fd4c13241cd70d0009"}, + {file = "cffi-1.14.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a7711edca4dcef1a75257b50a2fbfe92a65187c47dab5a0f1b9b332c5919a3fb"}, + {file = "cffi-1.14.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:00e28066507bfc3fe865a31f325c8391a1ac2916219340f87dfad602c3e48e5d"}, + {file = "cffi-1.14.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:798caa2a2384b1cbe8a2a139d80734c9db54f9cc155c99d7cc92441a23871c03"}, + {file = "cffi-1.14.4-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:a5ed8c05548b54b998b9498753fb9cadbfd92ee88e884641377d8a8b291bcc01"}, + {file = "cffi-1.14.4-cp37-cp37m-win32.whl", hash = "sha256:00a1ba5e2e95684448de9b89888ccd02c98d512064b4cb987d48f4b40aa0421e"}, + {file = "cffi-1.14.4-cp37-cp37m-win_amd64.whl", hash = "sha256:9cc46bc107224ff5b6d04369e7c595acb700c3613ad7bcf2e2012f62ece80c35"}, + {file = "cffi-1.14.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:df5169c4396adc04f9b0a05f13c074df878b6052430e03f50e68adf3a57aa28d"}, + {file = "cffi-1.14.4-cp38-cp38-manylinux1_i686.whl", hash = "sha256:9ffb888f19d54a4d4dfd4b3f29bc2c16aa4972f1c2ab9c4ab09b8ab8685b9c2b"}, + {file = "cffi-1.14.4-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8d6603078baf4e11edc4168a514c5ce5b3ba6e3e9c374298cb88437957960a53"}, + {file = "cffi-1.14.4-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:d5ff0621c88ce83a28a10d2ce719b2ee85635e85c515f12bac99a95306da4b2e"}, + {file = "cffi-1.14.4-cp38-cp38-win32.whl", hash = "sha256:b4e248d1087abf9f4c10f3c398896c87ce82a9856494a7155823eb45a892395d"}, + {file = "cffi-1.14.4-cp38-cp38-win_amd64.whl", hash = "sha256:ec80dc47f54e6e9a78181ce05feb71a0353854cc26999db963695f950b5fb375"}, + {file = "cffi-1.14.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:840793c68105fe031f34d6a086eaea153a0cd5c491cde82a74b420edd0a2b909"}, + {file = "cffi-1.14.4-cp39-cp39-manylinux1_i686.whl", hash = "sha256:b18e0a9ef57d2b41f5c68beefa32317d286c3d6ac0484efd10d6e07491bb95dd"}, + {file = "cffi-1.14.4-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:045d792900a75e8b1e1b0ab6787dd733a8190ffcf80e8c8ceb2fb10a29ff238a"}, + {file = "cffi-1.14.4-cp39-cp39-win32.whl", hash = "sha256:ba4e9e0ae13fc41c6b23299545e5ef73055213e466bd107953e4a013a5ddd7e3"}, + {file = "cffi-1.14.4-cp39-cp39-win_amd64.whl", hash = "sha256:f032b34669220030f905152045dfa27741ce1a6db3324a5bc0b96b6c7420c87b"}, + {file = "cffi-1.14.4.tar.gz", hash = "sha256:1a465cbe98a7fd391d47dce4b8f7e5b921e6cd805ef421d04f5f66ba8f06086c"}, +] +chardet = [ + {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"}, + {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"}, +] +click = [ + {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, + {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, +] +codecov = [ + {file = "codecov-2.1.10-py2.py3-none-any.whl", hash = "sha256:61bc71b5f58be8000bf9235aa9d0112f8fd3acca00aa02191bb81426d22a8584"}, + {file = "codecov-2.1.10-py3.8.egg", hash = "sha256:a333626e6ff882db760ce71a1d84baf80ddff2cd459a3cc49b41fdac47d77ca5"}, + {file = "codecov-2.1.10.tar.gz", hash = "sha256:d30ad6084501224b1ba699cbf018a340bb9553eb2701301c14133995fdd84f33"}, +] +colorama = [ + {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, + {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, +] +coverage = [ + {file = "coverage-4.5.4-cp26-cp26m-macosx_10_12_x86_64.whl", hash = "sha256:eee64c616adeff7db37cc37da4180a3a5b6177f5c46b187894e633f088fb5b28"}, + {file = "coverage-4.5.4-cp27-cp27m-macosx_10_12_x86_64.whl", hash = "sha256:ef824cad1f980d27f26166f86856efe11eff9912c4fed97d3804820d43fa550c"}, + {file = "coverage-4.5.4-cp27-cp27m-macosx_10_13_intel.whl", hash = "sha256:9a334d6c83dfeadae576b4d633a71620d40d1c379129d587faa42ee3e2a85cce"}, + {file = "coverage-4.5.4-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:7494b0b0274c5072bddbfd5b4a6c6f18fbbe1ab1d22a41e99cd2d00c8f96ecfe"}, + {file = "coverage-4.5.4-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:826f32b9547c8091679ff292a82aca9c7b9650f9fda3e2ca6bf2ac905b7ce888"}, + {file = "coverage-4.5.4-cp27-cp27m-win32.whl", hash = "sha256:63a9a5fc43b58735f65ed63d2cf43508f462dc49857da70b8980ad78d41d52fc"}, + {file = "coverage-4.5.4-cp27-cp27m-win_amd64.whl", hash = "sha256:e2ede7c1d45e65e209d6093b762e98e8318ddeff95317d07a27a2140b80cfd24"}, + {file = "coverage-4.5.4-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:dd579709a87092c6dbee09d1b7cfa81831040705ffa12a1b248935274aee0437"}, + {file = "coverage-4.5.4-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:08907593569fe59baca0bf152c43f3863201efb6113ecb38ce7e97ce339805a6"}, + {file = "coverage-4.5.4-cp33-cp33m-macosx_10_10_x86_64.whl", hash = "sha256:6b62544bb68106e3f00b21c8930e83e584fdca005d4fffd29bb39fb3ffa03cb5"}, + {file = "coverage-4.5.4-cp34-cp34m-macosx_10_12_x86_64.whl", hash = "sha256:331cb5115673a20fb131dadd22f5bcaf7677ef758741312bee4937d71a14b2ef"}, + {file = "coverage-4.5.4-cp34-cp34m-manylinux1_i686.whl", hash = "sha256:bf1ef9eb901113a9805287e090452c05547578eaab1b62e4ad456fcc049a9b7e"}, + {file = "coverage-4.5.4-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:386e2e4090f0bc5df274e720105c342263423e77ee8826002dcffe0c9533dbca"}, + {file = "coverage-4.5.4-cp34-cp34m-win32.whl", hash = "sha256:fa964bae817babece5aa2e8c1af841bebb6d0b9add8e637548809d040443fee0"}, + {file = "coverage-4.5.4-cp34-cp34m-win_amd64.whl", hash = "sha256:df6712284b2e44a065097846488f66840445eb987eb81b3cc6e4149e7b6982e1"}, + {file = "coverage-4.5.4-cp35-cp35m-macosx_10_12_x86_64.whl", hash = "sha256:efc89291bd5a08855829a3c522df16d856455297cf35ae827a37edac45f466a7"}, + {file = "coverage-4.5.4-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:e4ef9c164eb55123c62411f5936b5c2e521b12356037b6e1c2617cef45523d47"}, + {file = "coverage-4.5.4-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:ff37757e068ae606659c28c3bd0d923f9d29a85de79bf25b2b34b148473b5025"}, + {file = "coverage-4.5.4-cp35-cp35m-win32.whl", hash = "sha256:bf0a7aed7f5521c7ca67febd57db473af4762b9622254291fbcbb8cd0ba5e33e"}, + {file = "coverage-4.5.4-cp35-cp35m-win_amd64.whl", hash = "sha256:19e4df788a0581238e9390c85a7a09af39c7b539b29f25c89209e6c3e371270d"}, + {file = "coverage-4.5.4-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:60851187677b24c6085248f0a0b9b98d49cba7ecc7ec60ba6b9d2e5574ac1ee9"}, + {file = "coverage-4.5.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:245388cda02af78276b479f299bbf3783ef0a6a6273037d7c60dc73b8d8d7755"}, + {file = "coverage-4.5.4-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:c0afd27bc0e307a1ffc04ca5ec010a290e49e3afbe841c5cafc5c5a80ecd81c9"}, + {file = "coverage-4.5.4-cp36-cp36m-win32.whl", hash = "sha256:6ba744056423ef8d450cf627289166da65903885272055fb4b5e113137cfa14f"}, + {file = "coverage-4.5.4-cp36-cp36m-win_amd64.whl", hash = "sha256:af7ed8a8aa6957aac47b4268631fa1df984643f07ef00acd374e456364b373f5"}, + {file = "coverage-4.5.4-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:3a794ce50daee01c74a494919d5ebdc23d58873747fa0e288318728533a3e1ca"}, + {file = "coverage-4.5.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:0be0f1ed45fc0c185cfd4ecc19a1d6532d72f86a2bac9de7e24541febad72650"}, + {file = "coverage-4.5.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:eca2b7343524e7ba246cab8ff00cab47a2d6d54ada3b02772e908a45675722e2"}, + {file = "coverage-4.5.4-cp37-cp37m-win32.whl", hash = "sha256:93715dffbcd0678057f947f496484e906bf9509f5c1c38fc9ba3922893cda5f5"}, + {file = "coverage-4.5.4-cp37-cp37m-win_amd64.whl", hash = "sha256:23cc09ed395b03424d1ae30dcc292615c1372bfba7141eb85e11e50efaa6b351"}, + {file = "coverage-4.5.4-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:141f08ed3c4b1847015e2cd62ec06d35e67a3ac185c26f7635f4406b90afa9c5"}, + {file = "coverage-4.5.4.tar.gz", hash = "sha256:e07d9f1a23e9e93ab5c62902833bf3e4b1f65502927379148b6622686223125c"}, +] +cryptography = [ + {file = "cryptography-3.2.1-cp27-cp27m-macosx_10_10_x86_64.whl", hash = "sha256:6dc59630ecce8c1f558277ceb212c751d6730bd12c80ea96b4ac65637c4f55e7"}, + {file = "cryptography-3.2.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:75e8e6684cf0034f6bf2a97095cb95f81537b12b36a8fedf06e73050bb171c2d"}, + {file = "cryptography-3.2.1-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:4e7268a0ca14536fecfdf2b00297d4e407da904718658c1ff1961c713f90fd33"}, + {file = "cryptography-3.2.1-cp27-cp27m-win32.whl", hash = "sha256:7117319b44ed1842c617d0a452383a5a052ec6aa726dfbaffa8b94c910444297"}, + {file = "cryptography-3.2.1-cp27-cp27m-win_amd64.whl", hash = "sha256:a733671100cd26d816eed39507e585c156e4498293a907029969234e5e634bc4"}, + {file = "cryptography-3.2.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:a75f306a16d9f9afebfbedc41c8c2351d8e61e818ba6b4c40815e2b5740bb6b8"}, + {file = "cryptography-3.2.1-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:5849d59358547bf789ee7e0d7a9036b2d29e9a4ddf1ce5e06bb45634f995c53e"}, + {file = "cryptography-3.2.1-cp35-abi3-macosx_10_10_x86_64.whl", hash = "sha256:bd717aa029217b8ef94a7d21632a3bb5a4e7218a4513d2521c2a2fd63011e98b"}, + {file = "cryptography-3.2.1-cp35-abi3-manylinux1_x86_64.whl", hash = "sha256:efe15aca4f64f3a7ea0c09c87826490e50ed166ce67368a68f315ea0807a20df"}, + {file = "cryptography-3.2.1-cp35-abi3-manylinux2010_x86_64.whl", hash = "sha256:32434673d8505b42c0de4de86da8c1620651abd24afe91ae0335597683ed1b77"}, + {file = "cryptography-3.2.1-cp35-abi3-manylinux2014_aarch64.whl", hash = "sha256:7b8d9d8d3a9bd240f453342981f765346c87ade811519f98664519696f8e6ab7"}, + {file = "cryptography-3.2.1-cp35-cp35m-win32.whl", hash = "sha256:d3545829ab42a66b84a9aaabf216a4dce7f16dbc76eb69be5c302ed6b8f4a29b"}, + {file = "cryptography-3.2.1-cp35-cp35m-win_amd64.whl", hash = "sha256:a4e27ed0b2504195f855b52052eadcc9795c59909c9d84314c5408687f933fc7"}, + {file = "cryptography-3.2.1-cp36-abi3-win32.whl", hash = "sha256:13b88a0bd044b4eae1ef40e265d006e34dbcde0c2f1e15eb9896501b2d8f6c6f"}, + {file = "cryptography-3.2.1-cp36-abi3-win_amd64.whl", hash = "sha256:07ca431b788249af92764e3be9a488aa1d39a0bc3be313d826bbec690417e538"}, + {file = "cryptography-3.2.1-cp36-cp36m-win32.whl", hash = "sha256:a035a10686532b0587d58a606004aa20ad895c60c4d029afa245802347fab57b"}, + {file = "cryptography-3.2.1-cp36-cp36m-win_amd64.whl", hash = "sha256:d26a2557d8f9122f9bf445fc7034242f4375bd4e95ecda007667540270965b13"}, + {file = "cryptography-3.2.1-cp37-cp37m-win32.whl", hash = "sha256:545a8550782dda68f8cdc75a6e3bf252017aa8f75f19f5a9ca940772fc0cb56e"}, + {file = "cryptography-3.2.1-cp37-cp37m-win_amd64.whl", hash = "sha256:55d0b896631412b6f0c7de56e12eb3e261ac347fbaa5d5e705291a9016e5f8cb"}, + {file = "cryptography-3.2.1-cp38-cp38-win32.whl", hash = "sha256:3cd75a683b15576cfc822c7c5742b3276e50b21a06672dc3a800a2d5da4ecd1b"}, + {file = "cryptography-3.2.1-cp38-cp38-win_amd64.whl", hash = "sha256:d25cecbac20713a7c3bc544372d42d8eafa89799f492a43b79e1dfd650484851"}, + {file = "cryptography-3.2.1.tar.gz", hash = "sha256:d3d5e10be0cf2a12214ddee45c6bd203dab435e3d83b4560c03066eda600bfe3"}, +] +execnet = [ + {file = "execnet-1.7.1-py2.py3-none-any.whl", hash = "sha256:d4efd397930c46415f62f8a31388d6be4f27a91d7550eb79bc64a756e0056547"}, + {file = "execnet-1.7.1.tar.gz", hash = "sha256:cacb9df31c9680ec5f95553976c4da484d407e85e41c83cb812aa014f0eddc50"}, +] +idna = [ + {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"}, + {file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"}, +] +importlib-metadata = [ + {file = "importlib_metadata-3.1.1-py3-none-any.whl", hash = "sha256:6112e21359ef8f344e7178aa5b72dc6e62b38b0d008e6d3cb212c5b84df72013"}, + {file = "importlib_metadata-3.1.1.tar.gz", hash = "sha256:b0c2d3b226157ae4517d9625decf63591461c66b3a808c2666d538946519d170"}, +] +iniconfig = [ + {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, + {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, +] +jinja2 = [ + {file = "Jinja2-2.11.2-py2.py3-none-any.whl", hash = "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035"}, + {file = "Jinja2-2.11.2.tar.gz", hash = "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0"}, +] +jmespath = [ + {file = "jmespath-0.10.0-py2.py3-none-any.whl", hash = "sha256:cdf6525904cc597730141d61b36f2e4b8ecc257c420fa2f4549bac2c2d0cb72f"}, + {file = "jmespath-0.10.0.tar.gz", hash = "sha256:b85d0567b8666149a93172712e68920734333c0ce7e89b78b3e987f71e5ed4f9"}, +] +jsondiff = [ + {file = "jsondiff-1.2.0.tar.gz", hash = "sha256:34941bc431d10aa15828afe1cbb644977a114e75eef6cc74fb58951312326303"}, +] +markupsafe = [ + {file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"}, + {file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"}, + {file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183"}, + {file = "MarkupSafe-1.1.1-cp27-cp27m-win32.whl", hash = "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b"}, + {file = "MarkupSafe-1.1.1-cp27-cp27m-win_amd64.whl", hash = "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e"}, + {file = "MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f"}, + {file = "MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1"}, + {file = "MarkupSafe-1.1.1-cp34-cp34m-macosx_10_6_intel.whl", hash = "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5"}, + {file = "MarkupSafe-1.1.1-cp34-cp34m-manylinux1_i686.whl", hash = "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1"}, + {file = "MarkupSafe-1.1.1-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735"}, + {file = "MarkupSafe-1.1.1-cp34-cp34m-win32.whl", hash = "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21"}, + {file = "MarkupSafe-1.1.1-cp34-cp34m-win_amd64.whl", hash = "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235"}, + {file = "MarkupSafe-1.1.1-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b"}, + {file = "MarkupSafe-1.1.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f"}, + {file = "MarkupSafe-1.1.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905"}, + {file = "MarkupSafe-1.1.1-cp35-cp35m-win32.whl", hash = "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1"}, + {file = "MarkupSafe-1.1.1-cp35-cp35m-win_amd64.whl", hash = "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d"}, + {file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff"}, + {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473"}, + {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e"}, + {file = "MarkupSafe-1.1.1-cp36-cp36m-win32.whl", hash = "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66"}, + {file = "MarkupSafe-1.1.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5"}, + {file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d"}, + {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e"}, + {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6"}, + {file = "MarkupSafe-1.1.1-cp37-cp37m-win32.whl", hash = "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2"}, + {file = "MarkupSafe-1.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c"}, + {file = "MarkupSafe-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15"}, + {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2"}, + {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42"}, + {file = "MarkupSafe-1.1.1-cp38-cp38-win32.whl", hash = "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b"}, + {file = "MarkupSafe-1.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be"}, + {file = "MarkupSafe-1.1.1.tar.gz", hash = "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"}, +] +mock = [ + {file = "mock-4.0.2-py3-none-any.whl", hash = "sha256:3f9b2c0196c60d21838f307f5825a7b86b678cedc58ab9e50a8988187b4d81e0"}, + {file = "mock-4.0.2.tar.gz", hash = "sha256:dd33eb70232b6118298d516bbcecd26704689c386594f0f3c4f13867b2c56f72"}, +] +packaging = [ + {file = "packaging-20.7-py2.py3-none-any.whl", hash = "sha256:eb41423378682dadb7166144a4926e443093863024de508ca5c9737d6bc08376"}, + {file = "packaging-20.7.tar.gz", hash = "sha256:05af3bb85d320377db281cf254ab050e1a7ebcbf5410685a9a407e18a1f81236"}, +] +pathspec = [ + {file = "pathspec-0.8.1-py2.py3-none-any.whl", hash = "sha256:aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"}, + {file = "pathspec-0.8.1.tar.gz", hash = "sha256:86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd"}, +] +pluggy = [ + {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, + {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, +] +py = [ + {file = "py-1.9.0-py2.py3-none-any.whl", hash = "sha256:366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2"}, + {file = "py-1.9.0.tar.gz", hash = "sha256:9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"}, +] +pycparser = [ + {file = "pycparser-2.20-py2.py3-none-any.whl", hash = "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705"}, + {file = "pycparser-2.20.tar.gz", hash = "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"}, +] +pynetbox = [ + {file = "pynetbox-5.1.0-py3-none-any.whl", hash = "sha256:96b87fab0cf597e2aa38926ba62afc6e48c4b9f54805ebf516197dd20db5d0cf"}, + {file = "pynetbox-5.1.0.tar.gz", hash = "sha256:6a00d05958c8619c3db6902ee19aa4a3285cd735ddeae7cfd61b977d995568ed"}, +] +pyparsing = [ + {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, + {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, +] +pytest = [ + {file = "pytest-6.1.2-py3-none-any.whl", hash = "sha256:4288fed0d9153d9646bfcdf0c0428197dba1ecb27a33bb6e031d002fa88653fe"}, + {file = "pytest-6.1.2.tar.gz", hash = "sha256:c0a7e94a8cdbc5422a51ccdad8e6f1024795939cc89159a0ae7f0b316ad3823e"}, +] +pytest-forked = [ + {file = "pytest-forked-1.3.0.tar.gz", hash = "sha256:6aa9ac7e00ad1a539c41bec6d21011332de671e938c7637378ec9710204e37ca"}, + {file = "pytest_forked-1.3.0-py2.py3-none-any.whl", hash = "sha256:dc4147784048e70ef5d437951728825a131b81714b398d5d52f17c7c144d8815"}, +] +pytest-mock = [ + {file = "pytest-mock-3.3.1.tar.gz", hash = "sha256:a4d6d37329e4a893e77d9ffa89e838dd2b45d5dc099984cf03c703ac8411bb82"}, + {file = "pytest_mock-3.3.1-py3-none-any.whl", hash = "sha256:024e405ad382646318c4281948aadf6fe1135632bea9cc67366ea0c4098ef5f2"}, +] +pytest-xdist = [ + {file = "pytest-xdist-2.1.0.tar.gz", hash = "sha256:82d938f1a24186520e2d9d3a64ef7d9ac7ecdf1a0659e095d18e596b8cbd0672"}, + {file = "pytest_xdist-2.1.0-py3-none-any.whl", hash = "sha256:7c629016b3bb006b88ac68e2b31551e7becf173c76b977768848e2bbed594d90"}, +] +pyyaml = [ + {file = "PyYAML-5.3.1-cp27-cp27m-win32.whl", hash = "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f"}, + {file = "PyYAML-5.3.1-cp27-cp27m-win_amd64.whl", hash = "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76"}, + {file = "PyYAML-5.3.1-cp35-cp35m-win32.whl", hash = "sha256:4f4b913ca1a7319b33cfb1369e91e50354d6f07a135f3b901aca02aa95940bd2"}, + {file = "PyYAML-5.3.1-cp35-cp35m-win_amd64.whl", hash = "sha256:cc8955cfbfc7a115fa81d85284ee61147059a753344bc51098f3ccd69b0d7e0c"}, + {file = "PyYAML-5.3.1-cp36-cp36m-win32.whl", hash = "sha256:7739fc0fa8205b3ee8808aea45e968bc90082c10aef6ea95e855e10abf4a37b2"}, + {file = "PyYAML-5.3.1-cp36-cp36m-win_amd64.whl", hash = "sha256:69f00dca373f240f842b2931fb2c7e14ddbacd1397d57157a9b005a6a9942648"}, + {file = "PyYAML-5.3.1-cp37-cp37m-win32.whl", hash = "sha256:d13155f591e6fcc1ec3b30685d50bf0711574e2c0dfffd7644babf8b5102ca1a"}, + {file = "PyYAML-5.3.1-cp37-cp37m-win_amd64.whl", hash = "sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf"}, + {file = "PyYAML-5.3.1-cp38-cp38-win32.whl", hash = "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97"}, + {file = "PyYAML-5.3.1-cp38-cp38-win_amd64.whl", hash = "sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee"}, + {file = "PyYAML-5.3.1-cp39-cp39-win32.whl", hash = "sha256:ad9c67312c84def58f3c04504727ca879cb0013b2517c85a9a253f0cb6380c0a"}, + {file = "PyYAML-5.3.1-cp39-cp39-win_amd64.whl", hash = "sha256:6034f55dab5fea9e53f436aa68fa3ace2634918e8b5994d82f3621c04ff5ed2e"}, + {file = "PyYAML-5.3.1.tar.gz", hash = "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"}, +] +regex = [ + {file = "regex-2020.11.13-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa"}, + {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6"}, + {file = "regex-2020.11.13-cp36-cp36m-win32.whl", hash = "sha256:49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e"}, + {file = "regex-2020.11.13-cp36-cp36m-win_amd64.whl", hash = "sha256:749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884"}, + {file = "regex-2020.11.13-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba"}, + {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538"}, + {file = "regex-2020.11.13-cp37-cp37m-win32.whl", hash = "sha256:0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4"}, + {file = "regex-2020.11.13-cp37-cp37m-win_amd64.whl", hash = "sha256:1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444"}, + {file = "regex-2020.11.13-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5"}, + {file = "regex-2020.11.13-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b"}, + {file = "regex-2020.11.13-cp38-cp38-win32.whl", hash = "sha256:7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c"}, + {file = "regex-2020.11.13-cp38-cp38-win_amd64.whl", hash = "sha256:6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683"}, + {file = "regex-2020.11.13-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux1_i686.whl", hash = "sha256:4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9"}, + {file = "regex-2020.11.13-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c"}, + {file = "regex-2020.11.13-cp39-cp39-win32.whl", hash = "sha256:f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"}, + {file = "regex-2020.11.13-cp39-cp39-win_amd64.whl", hash = "sha256:a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d"}, + {file = "regex-2020.11.13.tar.gz", hash = "sha256:83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562"}, +] +requests = [ + {file = "requests-2.25.0-py2.py3-none-any.whl", hash = "sha256:e786fa28d8c9154e6a4de5d46a1d921b8749f8b74e28bde23768e5e16eece998"}, + {file = "requests-2.25.0.tar.gz", hash = "sha256:7f1a0b932f4a60a1a65caa4263921bb7d9ee911957e0ae4a23a6dd08185ad5f8"}, +] +six = [ + {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, + {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, +] +toml = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] +typed-ast = [ + {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"}, + {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb"}, + {file = "typed_ast-1.4.1-cp35-cp35m-win32.whl", hash = "sha256:0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919"}, + {file = "typed_ast-1.4.1-cp35-cp35m-win_amd64.whl", hash = "sha256:4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01"}, + {file = "typed_ast-1.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75"}, + {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652"}, + {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"}, + {file = "typed_ast-1.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:fcf135e17cc74dbfbc05894ebca928ffeb23d9790b3167a674921db19082401f"}, + {file = "typed_ast-1.4.1-cp36-cp36m-win32.whl", hash = "sha256:4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1"}, + {file = "typed_ast-1.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa"}, + {file = "typed_ast-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614"}, + {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41"}, + {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b"}, + {file = "typed_ast-1.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:f208eb7aff048f6bea9586e61af041ddf7f9ade7caed625742af423f6bae3298"}, + {file = "typed_ast-1.4.1-cp37-cp37m-win32.whl", hash = "sha256:d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe"}, + {file = "typed_ast-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355"}, + {file = "typed_ast-1.4.1-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6"}, + {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907"}, + {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d"}, + {file = "typed_ast-1.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:7e4c9d7658aaa1fc80018593abdf8598bf91325af6af5cce4ce7c73bc45ea53d"}, + {file = "typed_ast-1.4.1-cp38-cp38-win32.whl", hash = "sha256:715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c"}, + {file = "typed_ast-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4"}, + {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34"}, + {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:92c325624e304ebf0e025d1224b77dd4e6393f18aab8d829b5b7e04afe9b7a2c"}, + {file = "typed_ast-1.4.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:d648b8e3bf2fe648745c8ffcee3db3ff903d0817a01a12dd6a6ea7a8f4889072"}, + {file = "typed_ast-1.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:fac11badff8313e23717f3dada86a15389d0708275bddf766cca67a84ead3e91"}, + {file = "typed_ast-1.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:0d8110d78a5736e16e26213114a38ca35cb15b6515d535413b090bd50951556d"}, + {file = "typed_ast-1.4.1-cp39-cp39-win32.whl", hash = "sha256:b52ccf7cfe4ce2a1064b18594381bccf4179c2ecf7f513134ec2f993dd4ab395"}, + {file = "typed_ast-1.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:3742b32cf1c6ef124d57f95be609c473d7ec4c14d0090e5a5e05a15269fb4d0c"}, + {file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"}, +] +urllib3 = [ + {file = "urllib3-1.26.2-py2.py3-none-any.whl", hash = "sha256:d8ff90d979214d7b4f8ce956e80f4028fc6860e4431f731ea4a8c08f23f99473"}, + {file = "urllib3-1.26.2.tar.gz", hash = "sha256:19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08"}, +] +zipp = [ + {file = "zipp-3.4.0-py3-none-any.whl", hash = "sha256:102c24ef8f171fd729d46599845e95c7ab894a4cf45f5de11a44cc7444fb1108"}, + {file = "zipp-3.4.0.tar.gz", hash = "sha256:ed5eee1974372595f9e416cc7bbeeb12335201d8081ca8a0743c954d4446e5cb"}, +] diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/pyproject.toml b/collections-debian-merged/ansible_collections/netbox/netbox/pyproject.toml new file mode 100644 index 00000000..a97a0632 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/pyproject.toml @@ -0,0 +1,29 @@ +[tool.poetry] +name = "netbox_ansible_modules" +version = "1.2.1" +description = "Ansible collection to interact with NetBox's API" +authors = ["Mikhail Yohman <mikhail.yohman@gmail.com>"] +license = "GPLv3" + +[tool.poetry.dependencies] +python = "^3.6" +ansible-base = "^2.10.0" +black = "19.10b0" +codecov = "*" +coverage = "^4.0" +cryptography = "*" +jinja2 = "*" +jmespath = "*" +jsondiff = "*" +pynetbox = "*" +pytest = "*" +pytest-mock = "*" +pytest-xdist = "*" +pyyaml = "*" +mock = "^4.0.2" + +[tool.poetry.dev-dependencies] + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/integration.cfg b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/integration.cfg new file mode 100644 index 00000000..4501b1d8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/integration.cfg @@ -0,0 +1,5 @@ +[defaults] +force_valid_group_names = always + +[inventory] +enable_plugins = netbox.netbox.nb_inventory, auto, host_list, yaml, ini, toml, script diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/netbox-deploy.py b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/netbox-deploy.py new file mode 100755 index 00000000..a79b74d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/netbox-deploy.py @@ -0,0 +1,483 @@ +#!/usr/bin/env python + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import os +import sys +import pynetbox +from packaging import version + +# NOTE: If anything depends on specific versions of NetBox, can check INTEGRATION_TESTS in env +# os.environ["INTEGRATION_TESTS"] + + +# Set nb variable to connect to Netbox and use the veriable in future calls +nb_host = os.getenv("NETBOX_HOST", "http://localhost:32768") +nb_token = os.getenv("NETBOX_TOKEN", "0123456789abcdef0123456789abcdef01234567") +nb = pynetbox.api(nb_host, nb_token) +nb_version = version.parse(nb.version) + +ERRORS = False + + +def make_netbox_calls(endpoint, payload): + """Make the necessary calls to create endpoints, and pass any errors. + + Args: + endpoint (obj): pynetbox endpoint object. + payload (list): List of endpoint objects. + """ + try: + created = endpoint.create(payload) + except pynetbox.RequestError as e: + print(e.error) + ERRORS = True + return + + return created + + +# Create tags used in future tests +if nb_version >= version.parse("2.9"): + create_tags = make_netbox_calls( + nb.extras.tags, + [ + {"name": "First", "slug": "first"}, + {"name": "Second", "slug": "second"}, + {"name": "Third", "slug": "third"}, + {"name": "Schnozzberry", "slug": "schnozzberry"}, + {"name": "Lookup", "slug": "lookup"}, + {"name": "Nolookup", "slug": "nolookup"}, + {"name": "tagA", "slug": "taga"}, + {"name": "tagB", "slug": "tagb"}, + {"name": "tagC", "slug": "tagc"}, + {"name": "Updated", "slug": "updated"}, + ], + ) + +# ORDER OF OPERATIONS FOR THE MOST PART + +## Create TENANTS +tenants = [{"name": "Test Tenant", "slug": "test-tenant"}] +created_tenants = make_netbox_calls(nb.tenancy.tenants, tenants) +### Test Tenant to be used later on +test_tenant = nb.tenancy.tenants.get(slug="test-tenant") + + +## Create TENANT GROUPS +tenant_groups = [{"name": "Test Tenant Group", "slug": "test-tenant-group"}] +created_tenant_groups = make_netbox_calls(nb.tenancy.tenant_groups, tenant_groups) + + +## Create Regions +regions = [ + {"name": "Test Region", "slug": "test-region"}, + {"name": "Parent Region", "slug": "parent-region"}, + {"name": "Other Region", "slug": "other-region"}, +] +created_regions = make_netbox_calls(nb.dcim.regions, regions) +### Region variables to be used later on +parent_region = nb.dcim.regions.get(slug="parent-region") +test_region = nb.dcim.regions.get(slug="test-region") + +### Create relationship between regions +test_region.parent = parent_region +test_region.save() + + +## Create SITES and register variables +sites = [ + { + "name": "Test Site", + "slug": "test-site", + "tenant": test_tenant.id, + "region": test_region.id, + }, + {"name": "Test Site2", "slug": "test-site2"}, +] +created_sites = make_netbox_calls(nb.dcim.sites, sites) +### Site variables to be used later on +test_site = nb.dcim.sites.get(slug="test-site") +test_site2 = nb.dcim.sites.get(slug="test-site2") + + +## Create VRFs +vrfs = [{"name": "Test VRF", "rd": "1:1"}] +created_vrfs = make_netbox_calls(nb.ipam.vrfs, vrfs) + + +## Create PREFIXES +prefixes = [ + {"prefix": "192.168.100.0/24", "site": test_site2.id}, + {"prefix": "10.10.0.0/16"}, +] +created_prefixes = make_netbox_calls(nb.ipam.prefixes, prefixes) + + +## Create VLAN GROUPS +vlan_groups = [ + { + "name": "Test Vlan Group", + "slug": "test-vlan-group", + "site": test_site.id, + "tenant": test_tenant.id, + }, + { + "name": "Test Vlan Group 2", + "slug": "test-vlan-group-2", + "site": test_site.id, + "tenant": test_tenant.id, + }, +] +created_vlan_groups = make_netbox_calls(nb.ipam.vlan_groups, vlan_groups) +## VLAN Group variables to be used later on +test_vlan_group = nb.ipam.vlan_groups.get(slug="test-vlan-group") + + +## Create VLANS +vlans = [ + {"name": "Wireless", "vid": 100, "site": test_site.id}, + {"name": "Data", "vid": 200, "site": test_site.id}, + {"name": "VoIP", "vid": 300, "site": test_site.id}, + { + "name": "Test VLAN", + "vid": 400, + "site": test_site.id, + "tenant": test_tenant.id, + "group": test_vlan_group.id, + }, +] +created_vlans = make_netbox_calls(nb.ipam.vlans, vlans) + + +## Create IPAM Roles +ipam_roles = [{"name": "Network of care", "slug": "network-of-care"}] +create_ipam_roles = make_netbox_calls(nb.ipam.roles, ipam_roles) + + +## Create Manufacturers +manufacturers = [ + {"name": "Cisco", "slug": "cisco"}, + {"name": "Arista", "slug": "arista"}, + {"name": "Test Manufactuer", "slug": "test-manufacturer"}, +] +created_manufacturers = make_netbox_calls(nb.dcim.manufacturers, manufacturers) +### Manufacturer variables to be used later on +cisco_manu = nb.dcim.manufacturers.get(slug="cisco") +arista_manu = nb.dcim.manufacturers.get(slug="arista") + + +## Create Device Types +device_types = [ + {"model": "Cisco Test", "slug": "cisco-test", "manufacturer": cisco_manu.id}, + {"model": "Arista Test", "slug": "arista-test", "manufacturer": arista_manu.id}, + { + "model": "Nexus Parent", + "slug": "nexus-parent", + "u_height": 0, + "manufacturer": cisco_manu.id, + "subdevice_role": True, + }, + { + "model": "Nexus Child", + "slug": "nexus-child", + "u_height": 0, + "manufacturer": cisco_manu.id, + "subdevice_role": False, + }, + {"model": "1841", "slug": "1841", "manufacturer": cisco_manu.id,}, +] +if nb_version > version.parse("2.8"): + temp_dt = [] + for dt_type in device_types: + if dt_type.get("subdevice_role") is not None and not dt_type["subdevice_role"]: + dt_type["subdevice_role"] = "child" + if dt_type.get("subdevice_role"): + dt_type["subdevice_role"] = "parent" + temp_dt.append(dt_type) + device_types = temp_dt + +created_device_types = make_netbox_calls(nb.dcim.device_types, device_types) +### Device type variables to be used later on +cisco_test = nb.dcim.device_types.get(slug="cisco-test") +arista_test = nb.dcim.device_types.get(slug="arista-test") +nexus_parent = nb.dcim.device_types.get(slug="nexus-parent") +nexus_child = nb.dcim.device_types.get(slug="nexus-child") + +## Create Device Roles +device_roles = [ + {"name": "Core Switch", "slug": "core-switch", "color": "aa1409", "vm_role": False}, + { + "name": "Test VM Role", + "slug": "test-vm-role", + "color": "e91e63", + "vm_role": True, + }, + { + "name": "Test VM Role 1", + "slug": "test-vm-role-1", + "color": "e91e65", + "vm_role": True, + }, +] +created_device_roles = make_netbox_calls(nb.dcim.device_roles, device_roles) +### Device role variables to be used later on +core_switch = nb.dcim.device_roles.get(slug="core-switch") + + +## Create Rack Groups +rack_groups = [ + {"name": "Test Rack Group", "slug": "test-rack-group", "site": test_site.id}, + {"name": "Parent Rack Group", "slug": "parent-rack-group", "site": test_site.id}, +] +created_rack_groups = make_netbox_calls(nb.dcim.rack_groups, rack_groups) + +### Create Rack Group Parent relationship +created_rack_groups[0].parent = created_rack_groups[1] +created_rack_groups[0].save() + +## Create Rack Roles +rack_roles = [{"name": "Test Rack Role", "slug": "test-rack-role", "color": "4287f5"}] +created_rack_roles = make_netbox_calls(nb.dcim.rack_roles, rack_roles) + +## Create Racks +racks = [ + { + "name": "Test Rack Site 2", + "site": test_site2.id, + "role": created_rack_roles[0].id, + }, + {"name": "Test Rack", "site": test_site.id, "group": created_rack_groups[0].id}, +] +created_racks = make_netbox_calls(nb.dcim.racks, racks) +test_rack = nb.dcim.racks.get(name="Test Rack") # racks don't have slugs +test_rack_site2 = nb.dcim.racks.get(name="Test Rack Site 2") + + +## Create Devices +devices = [ + { + "name": "test100", + "device_type": cisco_test.id, + "device_role": core_switch.id, + "site": test_site.id, + "local_context_data": {"ntp_servers": ["pool.ntp.org"]}, + }, + { + "name": "TestDeviceR1", + "device_type": cisco_test.id, + "device_role": core_switch.id, + "site": test_site.id, + "rack": test_rack.id, + }, + { + "name": "R1-Device", + "device_type": cisco_test.id, + "device_role": core_switch.id, + "site": test_site2.id, + "rack": test_rack_site2.id, + }, + { + "name": "Test Nexus One", + "device_type": nexus_parent.id, + "device_role": core_switch.id, + "site": test_site.id, + }, + { + "name": "Test Nexus Child One", + "device_type": nexus_child.id, + "device_role": core_switch.id, + "site": test_site.id, + }, +] +created_devices = make_netbox_calls(nb.dcim.devices, devices) +### Device variables to be used later on +test100 = nb.dcim.devices.get(name="test100") + +# Create VC, assign member, create initial interface +created_vcs = make_netbox_calls(nb.dcim.virtual_chassis, {"name": "VC1", "master": 4}) +nexus_child = nb.dcim.devices.get(5) +nexus_child.update({"virtual_chassis": 1, "vc_position": 2}) +nexus = nb.dcim.devices.get(4) +nexus.update({"vc_position": 0}) +nexus_interfaces = [ + {"device": nexus.id, "name": "Ethernet1/1", "type": "1000base-t"}, + {"device": nexus_child.id, "name": "Ethernet2/1", "type": "1000base-t"}, +] +created_nexus_interfaces = make_netbox_calls(nb.dcim.interfaces, nexus_interfaces) + +## Create Interfaces +dev_interfaces = [ + {"name": "GigabitEthernet1", "device": test100.id, "type": "1000base-t"}, + {"name": "GigabitEthernet2", "device": test100.id, "type": "1000base-t"}, +] +created_interfaces = make_netbox_calls(nb.dcim.interfaces, dev_interfaces) +## Interface variables to be used later on +test100_gi1 = nb.dcim.interfaces.get(name="GigabitEthernet1", device_id=1) +test100_gi2 = nb.dcim.interfaces.get(name="GigabitEthernet2", device_id=1) + + +## Create IP Addresses +ip_addresses = [ + {"address": "172.16.180.1/24", "interface": test100_gi1.id}, + {"address": "2001::1:1/64", "interface": test100_gi2.id}, + {"address": "172.16.180.11/24", "interface": created_nexus_interfaces[0].id}, + { + "address": "172.16.180.12/24", + "interface": created_nexus_interfaces[1].id, + "dns_name": "nexus.example.com", + }, + {"address": "172.16.180.254/24"}, +] +if nb_version > version.parse("2.8"): + temp_ips = [] + for ip in ip_addresses: + if ip.get("interface"): + ip["assigned_object_id"] = ip.pop("interface") + ip["assigned_object_type"] = "dcim.interface" + temp_ips.append(ip) + +created_ip_addresses = make_netbox_calls(nb.ipam.ip_addresses, ip_addresses) + +# Assign Primary IP +nexus.update({"primary_ip4": 4}) + +## Create RIRs +rirs = [{"name": "Example RIR", "slug": "example-rir"}] +created_rirs = make_netbox_calls(nb.ipam.rirs, rirs) + +## Create Cluster Group +cluster_groups = [{"name": "Test Cluster Group", "slug": "test-cluster-group"}] +created_cluster_groups = make_netbox_calls( + nb.virtualization.cluster_groups, cluster_groups +) +test_cluster_group = nb.virtualization.cluster_groups.get(slug="test-cluster-group") + +## Create Cluster Type +cluster_types = [{"name": "Test Cluster Type", "slug": "test-cluster-type"}] +created_cluster_types = make_netbox_calls( + nb.virtualization.cluster_types, cluster_types +) +test_cluster_type = nb.virtualization.cluster_types.get(slug="test-cluster-type") + +## Create Cluster +clusters = [ + { + "name": "Test Cluster", + "type": test_cluster_type.id, + "group": test_cluster_group.id, + "site": test_site.id, + }, + {"name": "Test Cluster 2", "type": test_cluster_type.id,}, +] +created_clusters = make_netbox_calls(nb.virtualization.clusters, clusters) +test_cluster = nb.virtualization.clusters.get(name="Test Cluster") +test_cluster2 = nb.virtualization.clusters.get(name="Test Cluster 2") + +## Create Virtual Machine +virtual_machines = [ + {"name": "test100-vm", "cluster": test_cluster.id}, + {"name": "test101-vm", "cluster": test_cluster.id}, + {"name": "test102-vm", "cluster": test_cluster.id}, + {"name": "test103-vm", "cluster": test_cluster.id}, + {"name": "test104-vm", "cluster": test_cluster2.id}, + {"name": "Test VM With Spaces", "cluster": test_cluster2.id}, +] +created_virtual_machines = make_netbox_calls( + nb.virtualization.virtual_machines, virtual_machines +) +test100_vm = nb.virtualization.virtual_machines.get(name="test100-vm") +test101_vm = nb.virtualization.virtual_machines.get(name="test101-vm") +test_spaces_vm = nb.virtualization.virtual_machines.get(name="Test VM With Spaces") + +## Create Virtual Machine Interfaces +virtual_machines_intfs = [ + # Create test100-vm intfs + {"name": "Eth0", "virtual_machine": test100_vm.id}, + {"name": "Eth1", "virtual_machine": test100_vm.id}, + {"name": "Eth2", "virtual_machine": test100_vm.id}, + {"name": "Eth3", "virtual_machine": test100_vm.id}, + {"name": "Eth4", "virtual_machine": test100_vm.id}, + # Create test101-vm intfs + {"name": "Eth0", "virtual_machine": test101_vm.id}, + {"name": "Eth1", "virtual_machine": test101_vm.id}, + {"name": "Eth2", "virtual_machine": test101_vm.id}, + {"name": "Eth3", "virtual_machine": test101_vm.id}, + {"name": "Eth4", "virtual_machine": test101_vm.id}, + # Create Test VM With Spaces intfs + {"name": "Eth0", "virtual_machine": test_spaces_vm.id}, + {"name": "Eth1", "virtual_machine": test_spaces_vm.id}, +] +created_virtual_machines_intfs = make_netbox_calls( + nb.virtualization.interfaces, virtual_machines_intfs +) + + +## Create Services +services = [ + {"device": test100.id, "name": "ssh", "port": 22, "protocol": "tcp"}, + { + "device": test100.id, + "name": "http", + "port": 80, + "protocol": "tcp", + "ipaddresses": [created_ip_addresses[0].id, created_ip_addresses[1].id], + }, + {"device": nexus.id, "name": "telnet", "port": 23, "protocol": "tcp"}, + { + "virtual_machine": test_spaces_vm.id, + "name": "ssh", + "port": 22, + "protocol": "tcp", + }, +] +# 2.10+ requires the port attribute to be 'ports' and a list instead of an integer +for service in services: + if nb_version >= version.parse("2.10"): + service["ports"] = [service["port"]] + del service["port"] + +created_services = make_netbox_calls(nb.ipam.services, services) + + +## Create Circuit Provider +providers = [{"name": "Test Provider", "slug": "test-provider"}] +created_providers = make_netbox_calls(nb.circuits.providers, providers) +test_provider = nb.circuits.providers.get(slug="test-provider") + +## Create Circuit Type +circuit_types = [{"name": "Test Circuit Type", "slug": "test-circuit-type"}] +created_circuit_types = make_netbox_calls(nb.circuits.circuit_types, circuit_types) +test_circuit_type = nb.circuits.circuit_types.get(slug="test-circuit-type") + +## Create Circuit +circuits = [ + {"cid": "Test Circuit", "provider": test_provider.id, "type": test_circuit_type.id}, + { + "cid": "Test Circuit Two", + "provider": test_provider.id, + "type": test_circuit_type.id, + }, +] +created_circuits = make_netbox_calls(nb.circuits.circuits, circuits) +test_circuit_two = nb.circuits.circuits.get(cid="Test Circuit Two") + +## Create Circuit Termination +circuit_terms = [ + { + "circuit": test_circuit_two.id, + "term_side": "A", + "port_speed": 10000, + "site": test_site.id, + } +] +created_circuit_terms = make_netbox_calls( + nb.circuits.circuit_terminations, circuit_terms +) + +if ERRORS: + sys.exit( + "Errors have occurred when creating objects, and should have been printed out. Check previous output." + ) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/render_config.sh b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/render_config.sh new file mode 100755 index 00000000..3d07c663 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/render_config.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# The only way to pass variables to integration tests - write to a file inside the integration test directory. +# Usage: render_config.sh runme_config.template > runme_config +# Copied from: +# https://www.ansible.com/blog/adding-integration-tests-to-ansible-content-collections +# https://github.com/xlab-si/digital_ocean.digital_ocean/blob/master/tests/utils/render.sh + +set -o xtrace # Print commands as they're run +set -o errexit # abort on nonzero exitstatus +set -o nounset # abort on unbound variable +set -o pipefail # don't hide errors within pipes + + +function main() +{ + readonly template="$1" + readonly content="$(cat "${template}")" + + eval "echo \"$content\"" +} + +main "$@" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/.gitignore b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/.gitignore new file mode 100644 index 00000000..df76504d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/.gitignore @@ -0,0 +1 @@ +runme_config
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/aliases b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/aliases new file mode 100644 index 00000000..a3a2089b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/aliases @@ -0,0 +1 @@ +# https://docs.ansible.com/ansible/devel/dev_guide/testing/sanity/integration-aliases.html diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/compare_inventory_json.py b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/compare_inventory_json.py new file mode 100755 index 00000000..15be28b2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/compare_inventory_json.py @@ -0,0 +1,166 @@ +#!/usr/bin/env python + +# Inspired by community.aws collection script_inventory_ec2 test +# https://github.com/ansible-collections/community.aws/blob/master/tests/integration/targets/script_inventory_ec2/inventory_diff.py + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import sys +import json +import argparse +from jsondiff import diff +from typing import Iterable +from operator import itemgetter + +# Netbox includes "created" and "last_updated" times on objects. These end up in the interfaces objects that are included verbatim from the Netbox API. +# "url" may be different if local tests use a different host/port +# Remove these from files saved in git as test data +KEYS_REMOVE = frozenset(["created", "last_updated", "url"]) + +# Ignore these when performing diffs as they will be different for each test run +# (Was previously keys specific to NetBox 2.6) +KEYS_IGNORE = frozenset() + +# Rack Groups became hierarchical in NetBox 2.8. Don't bother comparing against test data in NetBox 2.7 +KEYS_IGNORE_27 = frozenset( + [ + "rack_groups", # host var + "rack_group_parent_rack_group", # group, group_names_raw = False + "parent_rack_group", # group, group_names_raw = True + ] +) + + +def all_keys_to_ignore(netbox_version): + keys = KEYS_REMOVE.union(KEYS_IGNORE) + + if netbox_version == "v2.7": + return keys.union(KEYS_IGNORE_27) + else: + return keys + + +# Assume the object will not be recursive, as it originally came from JSON +def remove_keys(obj, keys): + + if isinstance(obj, dict): + keys_to_remove = keys.intersection(obj.keys()) + for key in keys_to_remove: + del obj[key] + + for (key, value) in obj.items(): + remove_keys(value, keys) + + elif isinstance(obj, list): + # Iterate over temporary copy, as we may remove items + for item in obj[:]: + if isinstance(item, str) and item in keys: + # List contains a string that we want to remove + # eg. a group name in list of groups + obj.remove(item) + remove_keys(item, keys) + + +def sort_hostvar_arrays(obj): + meta = obj.get("_meta") + if not meta: + return + + hostvars = meta.get("hostvars") + if not hostvars: + return + + for hostname, host in hostvars.items(): + interfaces = host.get("interfaces") + if interfaces: + host["interfaces"] = sorted(interfaces, key=itemgetter("id")) + + services = host.get("services") + if services: + host["services"] = sorted(services, key=itemgetter("id")) + + +def read_json(filename): + with open(filename, "r") as f: + return json.loads(f.read()) + + +def write_json(filename, data): + with open(filename, "w") as f: + json.dump(data, f, indent=4) + + +def main(): + parser = argparse.ArgumentParser(description="Diff Ansible inventory JSON output") + parser.add_argument( + "filename_a", + metavar="ORIGINAL.json", + type=str, + help="Original json to test against", + ) + parser.add_argument( + "filename_b", + metavar="NEW.json", + type=str, + help="Newly generated json to compare against original", + ) + parser.add_argument( + "--write", + action="store_true", + help=( + "When comparing files, various keys are removed. " + "This option will not compare the files, and instead writes ORIGINAL.json to NEW.json after removing these keys. " + "This is used to clean the test json files before saving to the git repo. " + "For example, this removes dates. " + ), + ) + parser.add_argument( + "--netbox-version", + metavar="VERSION", + type=str, + help=( + "Apply comparison specific to NetBox version. " + "For example, rack_groups arrays will only contain a single item in v2.7, so are ignored in the comparison." + ), + ) + + args = parser.parse_args() + + data_a = read_json(args.filename_a) + + if args.write: + # When writing test data, only remove "remove_keys" that will change on every git commit. + # This makes diffs more easily readable to ensure changes to test data look correct. + remove_keys(data_a, KEYS_REMOVE) + sort_hostvar_arrays(data_a) + write_json(args.filename_b, data_a) + + else: + data_b = read_json(args.filename_b) + + # Ignore keys that we don't want to diff, in addition to the ones removed that change on every commit + keys = all_keys_to_ignore(args.netbox_version) + remove_keys(data_a, keys) + remove_keys(data_b, keys) + + sort_hostvar_arrays(data_a) + sort_hostvar_arrays(data_b) + + # Perform the diff + # syntax='symmetric' will produce output that prints both the before and after as "$insert" and "$delete" + # marshal=True removes any special types, allowing to be dumped as json + result = diff(data_a, data_b, marshal=True, syntax="symmetric") + + if result: + # Dictionary is not empty - print differences + print(json.dumps(result, sort_keys=True, indent=4)) + sys.exit(1) + else: + # Success, no differences + sys.exit(0) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-legacy.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-legacy.json new file mode 100644 index 00000000..2f48aa78 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-legacy.json @@ -0,0 +1,377 @@ +{ + "_meta": { + "hostvars": { + "R1-Device": { + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [], + "rack_role": "test-rack-role", + "racks": [ + "Test Rack Site 2" + ], + "regions": [], + "services": [], + "sites": [ + "test-site2" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test Nexus One": { + "ansible_host": "172.16.180.12", + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "nexus-parent" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "id": 3, + "ipaddresses": [], + "name": "telnet", + "ports": [ + 23 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": null, + "id": 4, + "ipaddresses": [], + "name": "ssh", + "ports": [ + 22 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "racks": [ + "Test Rack" + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + { + "ntp_servers": [ + "pool.ntp.org" + ] + } + ], + "manufacturers": [ + "cisco" + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 1, + "ipaddresses": [], + "name": "ssh", + "ports": [ + 22 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + }, + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 2, + "ipaddresses": [ + { + "address": "172.16.180.1/24", + "family": 4, + "id": 1 + }, + { + "address": "2001::1:1/64", + "family": 6, + "id": 2 + } + ], + "name": "http", + "ports": [ + 80 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "services": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "ungrouped" + ] + }, + "ungrouped": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "Test VM With Spaces", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-legacy.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-legacy.yml new file mode 100644 index 00000000..9aafebf8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-legacy.yml @@ -0,0 +1,9 @@ +# To generate the json result, I checked out nb_inventory.yml from the v0.2.0 release 2d6894b, +# and then ran it against this inventory with the latest test data. + +# Checks that substantial work on the inventory does not diverge from what existing users are using by default. + +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: false diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.json new file mode 100644 index 00000000..d005b0e2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.json @@ -0,0 +1,867 @@ +{ + "Test_Cluster": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "Test_Cluster_2": { + "hosts": [ + "Test VM With Spaces", + "test104-vm" + ] + }, + "Test_Rack": { + "hosts": [ + "TestDeviceR1" + ] + }, + "Test_Rack_Site_2": { + "hosts": [ + "R1-Device" + ] + }, + "_meta": { + "hostvars": { + "R1-Device": { + "device_type": "cisco-test", + "interfaces": [], + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack Site 2", + "rack_groups": [], + "rack_role": "test-rack-role", + "regions": [], + "role": "core-switch", + "services": [], + "site": "test-site2", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test Nexus One": { + "ansible_host": "172.16.180.12", + "device_type": "nexus-parent", + "dns_name": "nexus.example.com", + "interfaces": [ + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "enabled": true, + "id": 1, + "ip_addresses": [ + { + "address": "172.16.180.11/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 3, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet1/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" + }, + "enabled": true, + "id": 2, + "ip_addresses": [ + { + "address": "172.16.180.12/24", + "custom_fields": {}, + "description": "", + "dns_name": "nexus.example.com", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 4, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet2/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "manufacturer": "cisco", + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "id": 3, + "ipaddresses": [], + "name": "telnet", + "ports": [ + 23 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 11, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + }, + { + "description": "", + "enabled": true, + "id": 12, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "is_virtual": true, + "regions": [], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": null, + "id": 4, + "ipaddresses": [], + "name": "ssh", + "ports": [ + 22 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "device_type": "cisco-test", + "interfaces": [], + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack", + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "device_type": "cisco-test", + "interfaces": [ + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 3, + "ip_addresses": [ + { + "address": "172.16.180.1/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 1, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 4, + "ip_addresses": [ + { + "address": "2001::1:1/64", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv6", + "value": 6 + }, + "id": 2, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet2", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "manufacturer": "cisco", + "ntp_servers": [ + "pool.ntp.org" + ], + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 1, + "ipaddresses": [], + "name": "ssh", + "ports": [ + 22 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + }, + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 2, + "ipaddresses": [ + { + "address": "172.16.180.1/24", + "family": 4, + "id": 1 + }, + { + "address": "2001::1:1/64", + "family": 6, + "id": 2 + } + ], + "name": "http", + "ports": [ + 80 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 1, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 2, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 3, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 4, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 5, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + } + ], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 6, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 7, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 8, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 9, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 10, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + } + ], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "interfaces": [], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "interfaces": [], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "interfaces": [], + "is_virtual": true, + "regions": [], + "services": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "Test_Cluster", + "Test_Cluster_2", + "Test_Rack", + "Test_Rack_Site_2", + "active", + "cisco", + "cisco_test", + "core_switch", + "is_virtual", + "nexus_parent", + "other_region", + "parent_rack_group", + "parent_region", + "test_cluster_group", + "test_cluster_type", + "test_rack_group", + "test_rack_role", + "test_site2", + "ungrouped" + ] + }, + "cisco": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "cisco_test": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "test100" + ] + }, + "core_switch": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "is_virtual": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "nexus_parent": { + "hosts": [ + "Test Nexus One" + ] + }, + "parent_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "parent_region": { + "children": [ + "test_region" + ] + }, + "active": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "Test VM With Spaces", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "test_cluster_group": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_cluster_type": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "test_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "test_rack_role": { + "hosts": [ + "R1-Device" + ] + }, + "test_region": { + "children": [ + "test_site" + ] + }, + "test_site": { + "hosts": [ + "Test Nexus One", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_site2": { + "hosts": [ + "R1-Device" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.yml new file mode 100644 index 00000000..7b253f2a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.yml @@ -0,0 +1,39 @@ +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: False + +# Use cache on this test to make sure interfaces is tested via the cache +cache: True +cache_timeout: 3600 +cache_plugin: jsonfile +cache_connection: /tmp/inventory_netbox + +config_context: True +flatten_config_context: True +flatten_custom_fields: True +flatten_local_context_data: True +plurals: False +interfaces: True +services: True +fetch_all: False +max_uri_length: 0 +group_names_raw: True + +group_by: + - site + - tenant + - rack + - rack_group + - rack_role + - tag + - role + - device_type + - manufacturer + - platform + - region + - cluster + - cluster_group + - cluster_type + - is_virtual + - status diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options.json new file mode 100644 index 00000000..97c0acbb --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options.json @@ -0,0 +1,350 @@ +{ + "Test_Cluster": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "Test_Cluster_2": { + "hosts": [ + "Test VM With Spaces", + "test104-vm" + ] + }, + "Test_Rack": { + "hosts": [ + "TestDeviceR1" + ] + }, + "Test_Rack_Site_2": { + "hosts": [ + "R1-Device" + ] + }, + "_meta": { + "hostvars": { + "R1-Device": { + "custom_fields": {}, + "device_type": "cisco-test", + "display": "R1-Device", + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack Site 2", + "rack_groups": [], + "rack_id": "1", + "rack_role": "test-rack-role", + "regions": [], + "role": "core-switch", + "site": "test-site2", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "custom_fields": {}, + "device_type": "cisco-test", + "display": "TestDeviceR1", + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack", + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "rack_id": "2", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "VC1": { + "ansible_host": "172.16.180.12", + "custom_fields": {}, + "device_type": "nexus-parent", + "display": "Test Nexus One", + "dns_name": "nexus.example.com", + "is_virtual": false, + "manufacturer": "cisco", + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "custom_fields": {}, + "device_type": "cisco-test", + "display": "test100", + "is_virtual": false, + "local_context_data": { + "ntp_servers": [ + "pool.ntp.org" + ] + }, + "manufacturer": "cisco", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "Test_Cluster", + "Test_Cluster_2", + "Test_Rack", + "Test_Rack_Site_2", + "active", + "cisco", + "cisco_test", + "core_switch", + "is_virtual", + "jinja_test_group", + "nexus_parent", + "other_region", + "parent_rack_group", + "parent_region", + "test_cluster_group", + "test_cluster_type", + "test_rack_group", + "test_rack_role", + "test_site2", + "ungrouped" + ] + }, + "cisco": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "VC1", + "test100" + ] + }, + "cisco_test": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "test100" + ] + }, + "core_switch": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "VC1", + "test100" + ] + }, + "is_virtual": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "jinja_test_group": { + "hosts": [ + "Test VM With Spaces", + "TestDeviceR1" + ] + }, + "nexus_parent": { + "hosts": [ + "VC1" + ] + }, + "parent_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "parent_region": { + "children": [ + "test_region" + ] + }, + "active": { + "hosts": [ + "R1-Device", + "Test VM With Spaces", + "TestDeviceR1", + "VC1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "test_cluster_group": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_cluster_type": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "test_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "test_rack_role": { + "hosts": [ + "R1-Device" + ] + }, + "test_region": { + "children": [ + "test_site" + ] + }, + "test_site": { + "hosts": [ + "TestDeviceR1", + "VC1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_site2": { + "hosts": [ + "R1-Device" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options.yml new file mode 100644 index 00000000..c917fb27 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-options.yml @@ -0,0 +1,60 @@ +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: False + +# Cache is not for performance of tests, but to test the caching option works +# Also set on test-inventory-plurals.yml so that we actually hit the cache on one of these runs +cache: True +cache_timeout: 3600 +cache_plugin: jsonfile +cache_connection: /tmp/inventory_netbox + +config_context: False +plurals: False +interfaces: False +services: False +group_names_raw: True +virtual_chassis_name: True +dns_name: True + +group_by: + - site + - tenant + - rack + - rack_group + - rack_role + - tag + - role + - device_type + - manufacturer + - platform + - region + - cluster + - cluster_group + - cluster_type + - is_virtual + - status + +query_filters: + +device_query_filters: + - role: core-switch + +vm_query_filters: + - cluster_type: test-cluster-type + +# See Constructed for details +# https://docs.ansible.com/ansible/latest/plugins/inventory/constructed.html + +compose: + display: display_name + rack_id: rack.id + ntp_servers: config_context.ntp_servers + +keyed_groups: + - prefix: rack + key: rack.name + +groups: + jinja_test_group: inventory_hostname.startswith('Test') diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.json new file mode 100644 index 00000000..bc7be68f --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.json @@ -0,0 +1,402 @@ +{ + "Test_Cluster": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "Test_Cluster_2": { + "hosts": [ + "Test VM With Spaces", + "test104-vm" + ] + }, + "Test_Rack": { + "hosts": [ + "TestDeviceR1" + ] + }, + "Test_Rack_Site_2": { + "hosts": [ + "R1-Device" + ] + }, + "_meta": { + "hostvars": { + "R1-Device": { + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [], + "rack_role": "test-rack-role", + "racks": [ + "Test Rack Site 2" + ], + "regions": [], + "sites": [ + "test-site2" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test Nexus One": { + "ansible_host": "172.16.180.12", + "device_roles": [ + "core-switch" + ], + "device_types": [ + "nexus-parent" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "racks": [ + "Test Rack" + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + { + "ntp_servers": [ + "pool.ntp.org" + ] + } + ], + "manufacturers": [ + "cisco" + ], + "ntp_servers": [ + "pool.ntp.org" + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "Test_Cluster", + "Test_Cluster_2", + "Test_Rack", + "Test_Rack_Site_2", + "active", + "cisco", + "cisco_test", + "core_switch", + "is_virtual", + "nexus_parent", + "other_region", + "parent_rack_group", + "parent_region", + "test_cluster_group", + "test_cluster_type", + "test_rack_group", + "test_rack_role", + "test_site2", + "ungrouped" + ] + }, + "cisco": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "cisco_test": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "test100" + ] + }, + "core_switch": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "is_virtual": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "nexus_parent": { + "hosts": [ + "Test Nexus One" + ] + }, + "parent_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "parent_region": { + "children": [ + "test_region" + ] + }, + "active": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "Test VM With Spaces", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "test_cluster_group": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_cluster_type": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "test_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "test_rack_role": { + "hosts": [ + "R1-Device" + ] + }, + "test_region": { + "children": [ + "test_site" + ] + }, + "test_site": { + "hosts": [ + "Test Nexus One", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_site2": { + "hosts": [ + "R1-Device" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.yml new file mode 100644 index 00000000..bf110346 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.yml @@ -0,0 +1,31 @@ +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: False + +config_context: True +flatten_config_context: True +flatten_custom_fields: True +plurals: True +interfaces: False +services: False +fetch_all: True +group_names_raw: True + +group_by: + - sites + - tenants + - racks + - rack_group + - rack_role + - tags + - device_roles + - device_types + - manufacturers + - platforms + - region + - cluster + - cluster_group + - cluster_type + - is_virtual + - status diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals.json new file mode 100644 index 00000000..6ba5f48a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals.json @@ -0,0 +1,986 @@ +{ + "_meta": { + "hostvars": { + "R1-Device": { + "config_context": [ + {} + ], + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "interfaces": [], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [], + "rack_role": "test-rack-role", + "racks": [ + "Test Rack Site 2" + ], + "regions": [], + "services": [], + "sites": [ + "test-site2" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test Nexus One": { + "ansible_host": "172.16.180.12", + "config_context": [ + {} + ], + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "nexus-parent" + ], + "dns_name": "nexus.example.com", + "interfaces": [ + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "enabled": true, + "id": 1, + "ip_addresses": [ + { + "address": "172.16.180.11/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 3, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet1/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" + }, + "enabled": true, + "id": 2, + "ip_addresses": [ + { + "address": "172.16.180.12/24", + "custom_fields": {}, + "description": "", + "dns_name": "nexus.example.com", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 4, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet2/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "id": 3, + "ipaddresses": [], + "name": "telnet", + "ports": [ + 23 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 11, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + }, + { + "description": "", + "enabled": true, + "id": 12, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": null, + "id": 4, + "ipaddresses": [], + "name": "ssh", + "ports": [ + 22 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "config_context": [ + {} + ], + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "interfaces": [], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "racks": [ + "Test Rack" + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "config_context": [ + { + "ntp_servers": [ + "pool.ntp.org" + ] + } + ], + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "interfaces": [ + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 3, + "ip_addresses": [ + { + "address": "172.16.180.1/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 1, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 4, + "ip_addresses": [ + { + "address": "2001::1:1/64", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv6", + "value": 6 + }, + "id": 2, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet2", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "local_context_data": [ + { + "ntp_servers": [ + "pool.ntp.org" + ] + } + ], + "manufacturers": [ + "cisco" + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 1, + "ipaddresses": [], + "name": "ssh", + "ports": [ + 22 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + }, + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 2, + "ipaddresses": [ + { + "address": "172.16.180.1/24", + "family": 4, + "id": 1 + }, + { + "address": "2001::1:1/64", + "family": 6, + "id": 2 + } + ], + "name": "http", + "ports": [ + 80 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 1, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 2, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 3, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 4, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 5, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + } + ], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 6, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 7, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 8, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 9, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 10, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + } + ], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "services": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "cluster_Test_Cluster", + "cluster_Test_Cluster_2", + "cluster_group_test_cluster_group", + "cluster_type_test_cluster_type", + "device_roles_core_switch", + "device_types_cisco_test", + "device_types_nexus_parent", + "is_virtual", + "manufacturers_cisco", + "rack_group_parent_rack_group", + "rack_group_test_rack_group", + "rack_role_test_rack_role", + "racks_Test_Rack", + "racks_Test_Rack_Site_2", + "region_other_region", + "region_parent_region", + "sites_test_site2", + "status_active", + "ungrouped" + ] + }, + "cluster_Test_Cluster": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "cluster_Test_Cluster_2": { + "hosts": [ + "Test VM With Spaces", + "test104-vm" + ] + }, + "cluster_group_test_cluster_group": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "cluster_type_test_cluster_type": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "device_roles_core_switch": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "device_types_cisco_test": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "test100" + ] + }, + "device_types_nexus_parent": { + "hosts": [ + "Test Nexus One" + ] + }, + "is_virtual": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "manufacturers_cisco": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "rack_group_parent_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "rack_group_test_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "rack_role_test_rack_role": { + "hosts": [ + "R1-Device" + ] + }, + "racks_Test_Rack": { + "hosts": [ + "TestDeviceR1" + ] + }, + "racks_Test_Rack_Site_2": { + "hosts": [ + "R1-Device" + ] + }, + "region_parent_region": { + "children": [ + "region_test_region" + ] + }, + "region_test_region": { + "children": [ + "sites_test_site" + ] + }, + "sites_test_site": { + "hosts": [ + "Test Nexus One", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "sites_test_site2": { + "hosts": [ + "R1-Device" + ] + }, + "status_active": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "Test VM With Spaces", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals.yml new file mode 100644 index 00000000..a5cd6c62 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory-plurals.yml @@ -0,0 +1,36 @@ +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: false + +cache: True +cache_timeout: 3600 +cache_plugin: jsonfile +cache_connection: /tmp/inventory_netbox + +config_context: True +plurals: True +interfaces: True +services: True + +# Enough to fit only 2 devices, so tests chunking logic +max_uri_length: 80 +fetch_all: False + +group_by: + - sites + - tenants + - racks + - rack_group + - rack_role + - tags + - device_roles + - device_types + - manufacturers + - platforms + - region + - cluster + - cluster_group + - cluster_type + - is_virtual + - status diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory.json new file mode 100644 index 00000000..254a88ba --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory.json @@ -0,0 +1,912 @@ +{ + "_meta": { + "hostvars": { + "R1-Device": { + "config_context": {}, + "custom_fields": {}, + "device_type": "cisco-test", + "interfaces": [], + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack Site 2", + "rack_groups": [], + "rack_role": "test-rack-role", + "regions": [], + "role": "core-switch", + "services": [], + "site": "test-site2", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test Nexus One": { + "ansible_host": "172.16.180.12", + "config_context": {}, + "custom_fields": {}, + "device_type": "nexus-parent", + "dns_name": "nexus.example.com", + "interfaces": [ + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "enabled": true, + "id": 1, + "ip_addresses": [ + { + "address": "172.16.180.11/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 3, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet1/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" + }, + "enabled": true, + "id": 2, + "ip_addresses": [ + { + "address": "172.16.180.12/24", + "custom_fields": {}, + "description": "", + "dns_name": "nexus.example.com", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 4, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet2/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "manufacturer": "cisco", + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "id": 3, + "ipaddresses": [], + "name": "telnet", + "ports": [ + 23 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 11, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + }, + { + "description": "", + "enabled": true, + "id": 12, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "is_virtual": true, + "regions": [], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": null, + "id": 4, + "ipaddresses": [], + "name": "ssh", + "ports": [ + 22 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "config_context": {}, + "custom_fields": {}, + "device_type": "cisco-test", + "interfaces": [], + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack", + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "config_context": { + "ntp_servers": [ + "pool.ntp.org" + ] + }, + "custom_fields": {}, + "device_type": "cisco-test", + "interfaces": [ + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 3, + "ip_addresses": [ + { + "address": "172.16.180.1/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 1, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "cable_peer": null, + "cable_peer_type": null, + "connected_endpoint": null, + "connected_endpoint_reachable": null, + "connected_endpoint_type": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 4, + "ip_addresses": [ + { + "address": "2001::1:1/64", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv6", + "value": 6 + }, + "id": 2, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet2", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "local_context_data": { + "ntp_servers": [ + "pool.ntp.org" + ] + }, + "manufacturer": "cisco", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 1, + "ipaddresses": [], + "name": "ssh", + "ports": [ + 22 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + }, + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 2, + "ipaddresses": [ + { + "address": "172.16.180.1/24", + "family": 4, + "id": 1 + }, + { + "address": "2001::1:1/64", + "family": 6, + "id": 2 + } + ], + "name": "http", + "ports": [ + 80 + ], + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 1, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 2, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 3, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 4, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 5, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + } + ], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 6, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 7, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 8, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 9, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 10, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + } + ], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "regions": [], + "services": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "cluster_Test_Cluster", + "cluster_Test_Cluster_2", + "cluster_group_test_cluster_group", + "cluster_type_test_cluster_type", + "device_type_cisco_test", + "device_type_nexus_parent", + "is_virtual", + "manufacturer_cisco", + "rack_Test_Rack", + "rack_Test_Rack_Site_2", + "rack_group_parent_rack_group", + "rack_group_test_rack_group", + "rack_role_test_rack_role", + "region_other_region", + "region_parent_region", + "role_core_switch", + "service_http", + "service_ssh", + "service_telnet", + "site_test_site2", + "status_active", + "ungrouped" + ] + }, + "cluster_Test_Cluster": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "cluster_Test_Cluster_2": { + "hosts": [ + "Test VM With Spaces", + "test104-vm" + ] + }, + "cluster_group_test_cluster_group": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "cluster_type_test_cluster_type": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "device_type_cisco_test": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "test100" + ] + }, + "device_type_nexus_parent": { + "hosts": [ + "Test Nexus One" + ] + }, + "is_virtual": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "manufacturer_cisco": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "rack_Test_Rack": { + "hosts": [ + "TestDeviceR1" + ] + }, + "rack_Test_Rack_Site_2": { + "hosts": [ + "R1-Device" + ] + }, + "rack_group_parent_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "rack_group_test_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "rack_role_test_rack_role": { + "hosts": [ + "R1-Device" + ] + }, + "region_parent_region": { + "children": [ + "region_test_region" + ] + }, + "region_test_region": { + "children": [ + "site_test_site" + ] + }, + "role_core_switch": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "service_http": { + "hosts": [ + "test100" + ] + }, + "service_ssh": { + "hosts": [ + "Test VM With Spaces", + "test100" + ] + }, + "service_telnet": { + "hosts": [ + "Test Nexus One" + ] + }, + "site_test_site": { + "hosts": [ + "Test Nexus One", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "site_test_site2": { + "hosts": [ + "R1-Device" + ] + }, + "status_active": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "Test VM With Spaces", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory.yml new file mode 100644 index 00000000..7a1e04c0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/files/test-inventory.yml @@ -0,0 +1,28 @@ +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: False + +config_context: True +plurals: False +interfaces: True +services: True + +group_by: + - site + - tenant + - rack + - rack_group + - rack_role + - tag + - role + - device_type + - manufacturer + - platform + - region + - cluster + - cluster_group + - cluster_type + - is_virtual + - services + - status diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/runme.sh b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/runme.sh new file mode 100755 index 00000000..0850539f --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/runme.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +set -o xtrace # Print commands as they're run +set -o errexit # abort on nonzero exitstatus +set -o nounset # abort on unbound variable +set -o pipefail # don't hide errors within pipes + +# Directory of this script +SCRIPT_DIR="$( dirname "${BASH_SOURCE[0]}" )" +RUNME_CONFIG="$SCRIPT_DIR/runme_config" +INVENTORIES_DIR="$SCRIPT_DIR/files" + +# Load runme_config, if exists - the only way to pass environment when run through ansible-test +if [[ -f "$RUNME_CONFIG" ]] +then + source "$RUNME_CONFIG" +fi + +declare -a COMPARE_OPTIONS # empty array + +# Check if NETBOX_VERSION has been set by runme_config, and if so, pass to compare_inventory_json.py +if [[ "${NETBOX_VERSION:-}" == "v2.7" ]] +then + COMPARE_OPTIONS+=(--netbox-version "${NETBOX_VERSION}") +fi + +# OUTPUT_DIR is set by ansible-test +# OUTPUT_INVENTORY_JSON is only set if running hacking/update_test_inventories.sh to update the test diff data +if [[ -n "${OUTPUT_INVENTORY_JSON:-}" ]] +then + OUTPUT_DIR="$OUTPUT_INVENTORY_JSON" + + # Clean up JSON fields we don't want to store and compare against in tests (creation times, etc.) + COMPARE_OPTIONS+=(--write) +fi + +echo OUTPUT_DIR="$OUTPUT_DIR" + +inventory () { + if [[ -n "${OUTPUT_INVENTORY_JSON:-}" ]] + then + # Running for the purpose of updating test data + ansible-inventory "$@" + else + # Running inside ansible-test + # Run through python.py just to make sure we've definitely got the coverage environment set up + # Just running ansible-inventory directly may not actually find the right one in PATH + python.py "$(command -v ansible-inventory)" "$@" + fi +} + + +RESULT=0 + +for INVENTORY in "$INVENTORIES_DIR"/*.yml +do + NAME="$(basename "$INVENTORY")" + NAME_WITHOUT_EXTENSION="${NAME%.yml}" + + OUTPUT_JSON="$OUTPUT_DIR/$NAME_WITHOUT_EXTENSION.json" + inventory -vvvv --list --inventory "$INVENTORY" --output="$OUTPUT_JSON" + + # Compare the output + if ! "$SCRIPT_DIR/compare_inventory_json.py" "${COMPARE_OPTIONS[@]}" "$INVENTORIES_DIR/$NAME_WITHOUT_EXTENSION.json" "$OUTPUT_JSON" + then + # Returned non-zero status + RESULT=1 + fi + +done + +exit $RESULT diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/runme_config.template b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/runme_config.template new file mode 100644 index 00000000..80b42a32 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-latest/runme_config.template @@ -0,0 +1,6 @@ +# runme_config is source'd by runme.sh to set environment variables used to modify the test against different versions of NetBox. +# .travis.yml uses render_config.sh to generate it from runme_config.template +# There is no other way to pass environment variables to a runme.sh integration test. +# (integration_config.yml files are only helpful to ansible yaml-based tests) + +export NETBOX_VERSION=${VERSION} diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/.gitignore b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/.gitignore new file mode 100644 index 00000000..df76504d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/.gitignore @@ -0,0 +1 @@ +runme_config
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/aliases b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/aliases new file mode 100644 index 00000000..a3a2089b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/aliases @@ -0,0 +1 @@ +# https://docs.ansible.com/ansible/devel/dev_guide/testing/sanity/integration-aliases.html diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/compare_inventory_json.py b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/compare_inventory_json.py new file mode 100755 index 00000000..15be28b2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/compare_inventory_json.py @@ -0,0 +1,166 @@ +#!/usr/bin/env python + +# Inspired by community.aws collection script_inventory_ec2 test +# https://github.com/ansible-collections/community.aws/blob/master/tests/integration/targets/script_inventory_ec2/inventory_diff.py + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import sys +import json +import argparse +from jsondiff import diff +from typing import Iterable +from operator import itemgetter + +# Netbox includes "created" and "last_updated" times on objects. These end up in the interfaces objects that are included verbatim from the Netbox API. +# "url" may be different if local tests use a different host/port +# Remove these from files saved in git as test data +KEYS_REMOVE = frozenset(["created", "last_updated", "url"]) + +# Ignore these when performing diffs as they will be different for each test run +# (Was previously keys specific to NetBox 2.6) +KEYS_IGNORE = frozenset() + +# Rack Groups became hierarchical in NetBox 2.8. Don't bother comparing against test data in NetBox 2.7 +KEYS_IGNORE_27 = frozenset( + [ + "rack_groups", # host var + "rack_group_parent_rack_group", # group, group_names_raw = False + "parent_rack_group", # group, group_names_raw = True + ] +) + + +def all_keys_to_ignore(netbox_version): + keys = KEYS_REMOVE.union(KEYS_IGNORE) + + if netbox_version == "v2.7": + return keys.union(KEYS_IGNORE_27) + else: + return keys + + +# Assume the object will not be recursive, as it originally came from JSON +def remove_keys(obj, keys): + + if isinstance(obj, dict): + keys_to_remove = keys.intersection(obj.keys()) + for key in keys_to_remove: + del obj[key] + + for (key, value) in obj.items(): + remove_keys(value, keys) + + elif isinstance(obj, list): + # Iterate over temporary copy, as we may remove items + for item in obj[:]: + if isinstance(item, str) and item in keys: + # List contains a string that we want to remove + # eg. a group name in list of groups + obj.remove(item) + remove_keys(item, keys) + + +def sort_hostvar_arrays(obj): + meta = obj.get("_meta") + if not meta: + return + + hostvars = meta.get("hostvars") + if not hostvars: + return + + for hostname, host in hostvars.items(): + interfaces = host.get("interfaces") + if interfaces: + host["interfaces"] = sorted(interfaces, key=itemgetter("id")) + + services = host.get("services") + if services: + host["services"] = sorted(services, key=itemgetter("id")) + + +def read_json(filename): + with open(filename, "r") as f: + return json.loads(f.read()) + + +def write_json(filename, data): + with open(filename, "w") as f: + json.dump(data, f, indent=4) + + +def main(): + parser = argparse.ArgumentParser(description="Diff Ansible inventory JSON output") + parser.add_argument( + "filename_a", + metavar="ORIGINAL.json", + type=str, + help="Original json to test against", + ) + parser.add_argument( + "filename_b", + metavar="NEW.json", + type=str, + help="Newly generated json to compare against original", + ) + parser.add_argument( + "--write", + action="store_true", + help=( + "When comparing files, various keys are removed. " + "This option will not compare the files, and instead writes ORIGINAL.json to NEW.json after removing these keys. " + "This is used to clean the test json files before saving to the git repo. " + "For example, this removes dates. " + ), + ) + parser.add_argument( + "--netbox-version", + metavar="VERSION", + type=str, + help=( + "Apply comparison specific to NetBox version. " + "For example, rack_groups arrays will only contain a single item in v2.7, so are ignored in the comparison." + ), + ) + + args = parser.parse_args() + + data_a = read_json(args.filename_a) + + if args.write: + # When writing test data, only remove "remove_keys" that will change on every git commit. + # This makes diffs more easily readable to ensure changes to test data look correct. + remove_keys(data_a, KEYS_REMOVE) + sort_hostvar_arrays(data_a) + write_json(args.filename_b, data_a) + + else: + data_b = read_json(args.filename_b) + + # Ignore keys that we don't want to diff, in addition to the ones removed that change on every commit + keys = all_keys_to_ignore(args.netbox_version) + remove_keys(data_a, keys) + remove_keys(data_b, keys) + + sort_hostvar_arrays(data_a) + sort_hostvar_arrays(data_b) + + # Perform the diff + # syntax='symmetric' will produce output that prints both the before and after as "$insert" and "$delete" + # marshal=True removes any special types, allowing to be dumped as json + result = diff(data_a, data_b, marshal=True, syntax="symmetric") + + if result: + # Dictionary is not empty - print differences + print(json.dumps(result, sort_keys=True, indent=4)) + sys.exit(1) + else: + # Success, no differences + sys.exit(0) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.json new file mode 100644 index 00000000..531f0d52 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.json @@ -0,0 +1,369 @@ +{ + "_meta": { + "hostvars": { + "R1-Device": { + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [], + "rack_role": "test-rack-role", + "racks": [ + "Test Rack Site 2" + ], + "regions": [], + "services": [], + "sites": [ + "test-site2" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test Nexus One": { + "ansible_host": "172.16.180.12", + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "nexus-parent" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "id": 3, + "ipaddresses": [], + "name": "telnet", + "port": 23, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": null, + "id": 4, + "ipaddresses": [], + "name": "ssh", + "port": 22, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "racks": [ + "Test Rack" + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + { + "ntp_servers": [ + "pool.ntp.org" + ] + } + ], + "manufacturers": [ + "cisco" + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 1, + "ipaddresses": [], + "name": "ssh", + "port": 22, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + }, + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 2, + "ipaddresses": [ + { + "address": "172.16.180.1/24", + "family": 4, + "id": 1 + }, + { + "address": "2001::1:1/64", + "family": 6, + "id": 2 + } + ], + "name": "http", + "port": 80, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "services": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "ungrouped" + ] + }, + "ungrouped": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "Test VM With Spaces", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.yml new file mode 100644 index 00000000..9aafebf8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.yml @@ -0,0 +1,9 @@ +# To generate the json result, I checked out nb_inventory.yml from the v0.2.0 release 2d6894b, +# and then ran it against this inventory with the latest test data. + +# Checks that substantial work on the inventory does not diverge from what existing users are using by default. + +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: false diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.json new file mode 100644 index 00000000..523e668c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.json @@ -0,0 +1,836 @@ +{ + "Test_Cluster": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "Test_Cluster_2": { + "hosts": [ + "Test VM With Spaces", + "test104-vm" + ] + }, + "Test_Rack": { + "hosts": [ + "TestDeviceR1" + ] + }, + "Test_Rack_Site_2": { + "hosts": [ + "R1-Device" + ] + }, + "_meta": { + "hostvars": { + "R1-Device": { + "device_type": "cisco-test", + "interfaces": [], + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack Site 2", + "rack_groups": [], + "rack_role": "test-rack-role", + "regions": [], + "role": "core-switch", + "services": [], + "site": "test-site2", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test Nexus One": { + "ansible_host": "172.16.180.12", + "device_type": "nexus-parent", + "dns_name": "nexus.example.com", + "interfaces": [ + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "enabled": true, + "id": 1, + "ip_addresses": [ + { + "address": "172.16.180.11/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 3, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet1/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" + }, + "enabled": true, + "id": 2, + "ip_addresses": [ + { + "address": "172.16.180.12/24", + "custom_fields": {}, + "description": "", + "dns_name": "nexus.example.com", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 4, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet2/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "manufacturer": "cisco", + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "id": 3, + "ipaddresses": [], + "name": "telnet", + "port": 23, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 11, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + }, + { + "description": "", + "enabled": true, + "id": 12, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "is_virtual": true, + "regions": [], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": null, + "id": 4, + "ipaddresses": [], + "name": "ssh", + "port": 22, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "device_type": "cisco-test", + "interfaces": [], + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack", + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "device_type": "cisco-test", + "interfaces": [ + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 3, + "ip_addresses": [ + { + "address": "172.16.180.1/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 1, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 4, + "ip_addresses": [ + { + "address": "2001::1:1/64", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv6", + "value": 6 + }, + "id": 2, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet2", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "manufacturer": "cisco", + "ntp_servers": [ + "pool.ntp.org" + ], + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 1, + "ipaddresses": [], + "name": "ssh", + "port": 22, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + }, + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 2, + "ipaddresses": [ + { + "address": "172.16.180.1/24", + "family": 4, + "id": 1 + }, + { + "address": "2001::1:1/64", + "family": 6, + "id": 2 + } + ], + "name": "http", + "port": 80, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 1, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 2, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 3, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 4, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 5, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + } + ], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 6, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 7, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 8, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 9, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 10, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + } + ], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "interfaces": [], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "interfaces": [], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "interfaces": [], + "is_virtual": true, + "regions": [], + "services": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "Test_Cluster", + "Test_Cluster_2", + "Test_Rack", + "Test_Rack_Site_2", + "cisco", + "cisco_test", + "core_switch", + "is_virtual", + "nexus_parent", + "other_region", + "parent_rack_group", + "parent_region", + "test_cluster_group", + "test_cluster_type", + "test_rack_group", + "test_rack_role", + "test_site2", + "ungrouped" + ] + }, + "cisco": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "cisco_test": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "test100" + ] + }, + "core_switch": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "is_virtual": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "nexus_parent": { + "hosts": [ + "Test Nexus One" + ] + }, + "parent_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "parent_region": { + "children": [ + "test_region" + ] + }, + "test_cluster_group": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_cluster_type": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "test_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "test_rack_role": { + "hosts": [ + "R1-Device" + ] + }, + "test_region": { + "children": [ + "test_site" + ] + }, + "test_site": { + "hosts": [ + "Test Nexus One", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_site2": { + "hosts": [ + "R1-Device" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.yml new file mode 100644 index 00000000..be521111 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.yml @@ -0,0 +1,39 @@ +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: False + +# Use cache on this test to make sure interfaces is tested via the cache +cache: True +cache_timeout: 3600 +cache_plugin: jsonfile +cache_connection: /tmp/inventory_netbox + + +config_context: True +flatten_config_context: True +flatten_custom_fields: True +flatten_local_context_data: True +plurals: False +interfaces: True +services: True +fetch_all: False +max_uri_length: 0 +group_names_raw: True + +group_by: + - site + - tenant + - rack + - rack_group + - rack_role + - tag + - role + - device_type + - manufacturer + - platform + - region + - cluster + - cluster_group + - cluster_type + - is_virtual diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options.json new file mode 100644 index 00000000..a5b5712b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options.json @@ -0,0 +1,335 @@ +{ + "Test_Cluster": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "Test_Cluster_2": { + "hosts": [ + "Test VM With Spaces", + "test104-vm" + ] + }, + "Test_Rack": { + "hosts": [ + "TestDeviceR1" + ] + }, + "Test_Rack_Site_2": { + "hosts": [ + "R1-Device" + ] + }, + "_meta": { + "hostvars": { + "R1-Device": { + "custom_fields": {}, + "device_type": "cisco-test", + "display": "R1-Device", + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack Site 2", + "rack_groups": [], + "rack_id": "1", + "rack_role": "test-rack-role", + "regions": [], + "role": "core-switch", + "site": "test-site2", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "custom_fields": {}, + "device_type": "cisco-test", + "display": "TestDeviceR1", + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack", + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "rack_id": "2", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "VC1": { + "ansible_host": "172.16.180.12", + "custom_fields": {}, + "device_type": "nexus-parent", + "display": "Test Nexus One", + "dns_name": "nexus.example.com", + "is_virtual": false, + "manufacturer": "cisco", + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "custom_fields": {}, + "device_type": "cisco-test", + "display": "test100", + "is_virtual": false, + "local_context_data": { + "ntp_servers": [ + "pool.ntp.org" + ] + }, + "manufacturer": "cisco", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "custom_fields": {}, + "is_virtual": true, + "regions": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "Test_Cluster", + "Test_Cluster_2", + "Test_Rack", + "Test_Rack_Site_2", + "cisco", + "cisco_test", + "core_switch", + "is_virtual", + "jinja_test_group", + "nexus_parent", + "other_region", + "parent_rack_group", + "parent_region", + "test_cluster_group", + "test_cluster_type", + "test_rack_group", + "test_rack_role", + "test_site2", + "ungrouped" + ] + }, + "cisco": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "VC1", + "test100" + ] + }, + "cisco_test": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "test100" + ] + }, + "core_switch": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "VC1", + "test100" + ] + }, + "is_virtual": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "jinja_test_group": { + "hosts": [ + "Test VM With Spaces", + "TestDeviceR1" + ] + }, + "nexus_parent": { + "hosts": [ + "VC1" + ] + }, + "parent_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "parent_region": { + "children": [ + "test_region" + ] + }, + "test_cluster_group": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_cluster_type": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "test_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "test_rack_role": { + "hosts": [ + "R1-Device" + ] + }, + "test_region": { + "children": [ + "test_site" + ] + }, + "test_site": { + "hosts": [ + "TestDeviceR1", + "VC1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_site2": { + "hosts": [ + "R1-Device" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options.yml new file mode 100644 index 00000000..a080a1ec --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-options.yml @@ -0,0 +1,59 @@ +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: False + +# Cache is not for performance of tests, but to test the caching option works +# Also set on test-inventory-plurals.yml so that we actually hit the cache on one of these runs +cache: True +cache_timeout: 3600 +cache_plugin: jsonfile +cache_connection: /tmp/inventory_netbox + +config_context: False +plurals: False +interfaces: False +services: False +group_names_raw: True +virtual_chassis_name: True +dns_name: True + +group_by: + - site + - tenant + - rack + - rack_group + - rack_role + - tag + - role + - device_type + - manufacturer + - platform + - region + - cluster + - cluster_group + - cluster_type + - is_virtual + +query_filters: + +device_query_filters: + - role: core-switch + +vm_query_filters: + - cluster_type: test-cluster-type + +# See Constructed for details +# https://docs.ansible.com/ansible/latest/plugins/inventory/constructed.html + +compose: + display: display_name + rack_id: rack.id + ntp_servers: config_context.ntp_servers + +keyed_groups: + - prefix: rack + key: rack.name + +groups: + jinja_test_group: inventory_hostname.startswith('Test') diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.json new file mode 100644 index 00000000..3c16dc27 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.json @@ -0,0 +1,387 @@ +{ + "Test_Cluster": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "Test_Cluster_2": { + "hosts": [ + "Test VM With Spaces", + "test104-vm" + ] + }, + "Test_Rack": { + "hosts": [ + "TestDeviceR1" + ] + }, + "Test_Rack_Site_2": { + "hosts": [ + "R1-Device" + ] + }, + "_meta": { + "hostvars": { + "R1-Device": { + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [], + "rack_role": "test-rack-role", + "racks": [ + "Test Rack Site 2" + ], + "regions": [], + "sites": [ + "test-site2" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test Nexus One": { + "ansible_host": "172.16.180.12", + "device_roles": [ + "core-switch" + ], + "device_types": [ + "nexus-parent" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "racks": [ + "Test Rack" + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "is_virtual": false, + "local_context_data": [ + { + "ntp_servers": [ + "pool.ntp.org" + ] + } + ], + "manufacturers": [ + "cisco" + ], + "ntp_servers": [ + "pool.ntp.org" + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "Test_Cluster", + "Test_Cluster_2", + "Test_Rack", + "Test_Rack_Site_2", + "cisco", + "cisco_test", + "core_switch", + "is_virtual", + "nexus_parent", + "other_region", + "parent_rack_group", + "parent_region", + "test_cluster_group", + "test_cluster_type", + "test_rack_group", + "test_rack_role", + "test_site2", + "ungrouped" + ] + }, + "cisco": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "cisco_test": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "test100" + ] + }, + "core_switch": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "is_virtual": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "nexus_parent": { + "hosts": [ + "Test Nexus One" + ] + }, + "parent_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "parent_region": { + "children": [ + "test_region" + ] + }, + "test_cluster_group": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_cluster_type": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "test_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "test_rack_role": { + "hosts": [ + "R1-Device" + ] + }, + "test_region": { + "children": [ + "test_site" + ] + }, + "test_site": { + "hosts": [ + "Test Nexus One", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "test_site2": { + "hosts": [ + "R1-Device" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.yml new file mode 100644 index 00000000..b00c10e0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.yml @@ -0,0 +1,30 @@ +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: False + +config_context: True +flatten_config_context: True +flatten_custom_fields: True +plurals: True +interfaces: False +services: False +fetch_all: True +group_names_raw: True + +group_by: + - sites + - tenants + - racks + - rack_group + - rack_role + - tags + - device_roles + - device_types + - manufacturers + - platforms + - region + - cluster + - cluster_group + - cluster_type + - is_virtual diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.json new file mode 100644 index 00000000..0b7d9a19 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.json @@ -0,0 +1,955 @@ +{ + "_meta": { + "hostvars": { + "R1-Device": { + "config_context": [ + {} + ], + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "interfaces": [], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [], + "rack_role": "test-rack-role", + "racks": [ + "Test Rack Site 2" + ], + "regions": [], + "services": [], + "sites": [ + "test-site2" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test Nexus One": { + "ansible_host": "172.16.180.12", + "config_context": [ + {} + ], + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "nexus-parent" + ], + "dns_name": "nexus.example.com", + "interfaces": [ + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "enabled": true, + "id": 1, + "ip_addresses": [ + { + "address": "172.16.180.11/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 3, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet1/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" + }, + "enabled": true, + "id": 2, + "ip_addresses": [ + { + "address": "172.16.180.12/24", + "custom_fields": {}, + "description": "", + "dns_name": "nexus.example.com", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 4, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet2/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "id": 3, + "ipaddresses": [], + "name": "telnet", + "port": 23, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 11, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + }, + { + "description": "", + "enabled": true, + "id": 12, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": null, + "id": 4, + "ipaddresses": [], + "name": "ssh", + "port": 22, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "config_context": [ + {} + ], + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "interfaces": [], + "is_virtual": false, + "local_context_data": [ + null + ], + "manufacturers": [ + "cisco" + ], + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "racks": [ + "Test Rack" + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "config_context": [ + { + "ntp_servers": [ + "pool.ntp.org" + ] + } + ], + "custom_fields": {}, + "device_roles": [ + "core-switch" + ], + "device_types": [ + "cisco-test" + ], + "interfaces": [ + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 3, + "ip_addresses": [ + { + "address": "172.16.180.1/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 1, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 4, + "ip_addresses": [ + { + "address": "2001::1:1/64", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv6", + "value": 6 + }, + "id": 2, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet2", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "local_context_data": [ + { + "ntp_servers": [ + "pool.ntp.org" + ] + } + ], + "manufacturers": [ + "cisco" + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 1, + "ipaddresses": [], + "name": "ssh", + "port": 22, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + }, + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 2, + "ipaddresses": [ + { + "address": "172.16.180.1/24", + "family": 4, + "id": 1 + }, + { + "address": "2001::1:1/64", + "family": 6, + "id": 2 + } + ], + "name": "http", + "port": 80, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 1, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 2, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 3, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 4, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 5, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + } + ], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 6, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 7, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 8, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 9, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 10, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + } + ], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "sites": [ + "test-site" + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "config_context": [ + {} + ], + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "local_context_data": [ + null + ], + "regions": [], + "services": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "cluster_Test_Cluster", + "cluster_Test_Cluster_2", + "cluster_group_test_cluster_group", + "cluster_type_test_cluster_type", + "device_roles_core_switch", + "device_types_cisco_test", + "device_types_nexus_parent", + "is_virtual", + "manufacturers_cisco", + "rack_group_parent_rack_group", + "rack_group_test_rack_group", + "rack_role_test_rack_role", + "racks_Test_Rack", + "racks_Test_Rack_Site_2", + "region_other_region", + "region_parent_region", + "sites_test_site2", + "ungrouped" + ] + }, + "cluster_Test_Cluster": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "cluster_Test_Cluster_2": { + "hosts": [ + "Test VM With Spaces", + "test104-vm" + ] + }, + "cluster_group_test_cluster_group": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "cluster_type_test_cluster_type": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "device_roles_core_switch": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "device_types_cisco_test": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "test100" + ] + }, + "device_types_nexus_parent": { + "hosts": [ + "Test Nexus One" + ] + }, + "is_virtual": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "manufacturers_cisco": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "rack_group_parent_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "rack_group_test_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "rack_role_test_rack_role": { + "hosts": [ + "R1-Device" + ] + }, + "racks_Test_Rack": { + "hosts": [ + "TestDeviceR1" + ] + }, + "racks_Test_Rack_Site_2": { + "hosts": [ + "R1-Device" + ] + }, + "region_parent_region": { + "children": [ + "region_test_region" + ] + }, + "region_test_region": { + "children": [ + "sites_test_site" + ] + }, + "sites_test_site": { + "hosts": [ + "Test Nexus One", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "sites_test_site2": { + "hosts": [ + "R1-Device" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.yml new file mode 100644 index 00000000..2b610e4f --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.yml @@ -0,0 +1,35 @@ +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: false + +cache: True +cache_timeout: 3600 +cache_plugin: jsonfile +cache_connection: /tmp/inventory_netbox + +config_context: True +plurals: True +interfaces: True +services: True + +# Enough to fit only 2 devices, so tests chunking logic +max_uri_length: 80 +fetch_all: False + +group_by: + - sites + - tenants + - racks + - rack_group + - rack_role + - tags + - device_roles + - device_types + - manufacturers + - platforms + - region + - cluster + - cluster_group + - cluster_type + - is_virtual diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory.json new file mode 100644 index 00000000..12672143 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory.json @@ -0,0 +1,881 @@ +{ + "_meta": { + "hostvars": { + "R1-Device": { + "config_context": {}, + "custom_fields": {}, + "device_type": "cisco-test", + "interfaces": [], + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack Site 2", + "rack_groups": [], + "rack_role": "test-rack-role", + "regions": [], + "role": "core-switch", + "services": [], + "site": "test-site2", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test Nexus One": { + "ansible_host": "172.16.180.12", + "config_context": {}, + "custom_fields": {}, + "device_type": "nexus-parent", + "dns_name": "nexus.example.com", + "interfaces": [ + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "enabled": true, + "id": 1, + "ip_addresses": [ + { + "address": "172.16.180.11/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 3, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet1/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" + }, + "enabled": true, + "id": 2, + "ip_addresses": [ + { + "address": "172.16.180.12/24", + "custom_fields": {}, + "description": "", + "dns_name": "nexus.example.com", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 4, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "Ethernet2/1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "manufacturer": "cisco", + "primary_ip4": "172.16.180.12", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" + }, + "id": 3, + "ipaddresses": [], + "name": "telnet", + "port": 23, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "Test VM With Spaces": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 11, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + }, + { + "description": "", + "enabled": true, + "id": 12, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "is_virtual": true, + "regions": [], + "services": [ + { + "custom_fields": {}, + "description": "", + "device": null, + "id": 4, + "ipaddresses": [], + "name": "ssh", + "port": 22, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": { + "id": 6, + "name": "Test VM With Spaces" + } + } + ], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "TestDeviceR1": { + "config_context": {}, + "custom_fields": {}, + "device_type": "cisco-test", + "interfaces": [], + "is_virtual": false, + "manufacturer": "cisco", + "rack": "Test Rack", + "rack_groups": [ + "test-rack-group", + "parent-rack-group" + ], + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100": { + "config_context": { + "ntp_servers": [ + "pool.ntp.org" + ] + }, + "custom_fields": {}, + "device_type": "cisco-test", + "interfaces": [ + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 3, + "ip_addresses": [ + { + "address": "172.16.180.1/24", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv4", + "value": 4 + }, + "id": 1, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet1", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + }, + { + "cable": null, + "connected_endpoint": null, + "connected_endpoint_type": null, + "connection_status": null, + "count_ipaddresses": 1, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "enabled": true, + "id": 4, + "ip_addresses": [ + { + "address": "2001::1:1/64", + "custom_fields": {}, + "description": "", + "dns_name": "", + "family": { + "label": "IPv6", + "value": 6 + }, + "id": 2, + "nat_inside": null, + "nat_outside": null, + "role": null, + "status": { + "label": "Active", + "value": "active" + }, + "tags": [], + "tenant": null, + "vrf": null + } + ], + "label": "", + "lag": null, + "mac_address": null, + "mgmt_only": false, + "mode": null, + "mtu": null, + "name": "GigabitEthernet2", + "tagged_vlans": [], + "tags": [], + "type": { + "label": "1000BASE-T (1GE)", + "value": "1000base-t" + }, + "untagged_vlan": null + } + ], + "is_virtual": false, + "local_context_data": { + "ntp_servers": [ + "pool.ntp.org" + ] + }, + "manufacturer": "cisco", + "regions": [ + "test-region", + "parent-region" + ], + "role": "core-switch", + "services": [ + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 1, + "ipaddresses": [], + "name": "ssh", + "port": 22, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + }, + { + "custom_fields": {}, + "description": "", + "device": { + "display_name": "test100", + "id": 1, + "name": "test100" + }, + "id": 2, + "ipaddresses": [ + { + "address": "172.16.180.1/24", + "family": 4, + "id": 1 + }, + { + "address": "2001::1:1/64", + "family": 6, + "id": 2 + } + ], + "name": "http", + "port": 80, + "protocol": { + "label": "TCP", + "value": "tcp" + }, + "tags": [], + "virtual_machine": null + } + ], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test100-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 1, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 2, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 3, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 4, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 5, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 1, + "name": "test100-vm" + } + } + ], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test101-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [ + { + "description": "", + "enabled": true, + "id": 6, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth0", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 7, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth1", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 8, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth2", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 9, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth3", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + }, + { + "description": "", + "enabled": true, + "id": 10, + "ip_addresses": [], + "mac_address": null, + "mode": null, + "mtu": null, + "name": "Eth4", + "tagged_vlans": [], + "tags": [], + "untagged_vlan": null, + "virtual_machine": { + "id": 2, + "name": "test101-vm" + } + } + ], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test102-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test103-vm": { + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "regions": [ + "test-region", + "parent-region" + ], + "services": [], + "site": "test-site", + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + }, + "test104-vm": { + "cluster": "Test Cluster 2", + "cluster_type": "test-cluster-type", + "config_context": {}, + "custom_fields": {}, + "interfaces": [], + "is_virtual": true, + "regions": [], + "services": [], + "status": { + "label": "Active", + "value": "active" + }, + "tags": [] + } + } + }, + "all": { + "children": [ + "cluster_Test_Cluster", + "cluster_Test_Cluster_2", + "cluster_group_test_cluster_group", + "cluster_type_test_cluster_type", + "device_type_cisco_test", + "device_type_nexus_parent", + "is_virtual", + "manufacturer_cisco", + "rack_Test_Rack", + "rack_Test_Rack_Site_2", + "rack_group_parent_rack_group", + "rack_group_test_rack_group", + "rack_role_test_rack_role", + "region_other_region", + "region_parent_region", + "role_core_switch", + "service_http", + "service_ssh", + "service_telnet", + "site_test_site2", + "ungrouped" + ] + }, + "cluster_Test_Cluster": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "cluster_Test_Cluster_2": { + "hosts": [ + "Test VM With Spaces", + "test104-vm" + ] + }, + "cluster_group_test_cluster_group": { + "hosts": [ + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "cluster_type_test_cluster_type": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "device_type_cisco_test": { + "hosts": [ + "R1-Device", + "TestDeviceR1", + "test100" + ] + }, + "device_type_nexus_parent": { + "hosts": [ + "Test Nexus One" + ] + }, + "is_virtual": { + "hosts": [ + "Test VM With Spaces", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm", + "test104-vm" + ] + }, + "manufacturer_cisco": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "rack_Test_Rack": { + "hosts": [ + "TestDeviceR1" + ] + }, + "rack_Test_Rack_Site_2": { + "hosts": [ + "R1-Device" + ] + }, + "rack_group_parent_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "rack_group_test_rack_group": { + "hosts": [ + "TestDeviceR1" + ] + }, + "rack_role_test_rack_role": { + "hosts": [ + "R1-Device" + ] + }, + "region_parent_region": { + "children": [ + "region_test_region" + ] + }, + "region_test_region": { + "children": [ + "site_test_site" + ] + }, + "role_core_switch": { + "hosts": [ + "R1-Device", + "Test Nexus One", + "TestDeviceR1", + "test100" + ] + }, + "service_http": { + "hosts": [ + "test100" + ] + }, + "service_ssh": { + "hosts": [ + "Test VM With Spaces", + "test100" + ] + }, + "service_telnet": { + "hosts": [ + "Test Nexus One" + ] + }, + "site_test_site": { + "hosts": [ + "Test Nexus One", + "TestDeviceR1", + "test100", + "test100-vm", + "test101-vm", + "test102-vm", + "test103-vm" + ] + }, + "site_test_site2": { + "hosts": [ + "R1-Device" + ] + } +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory.yml new file mode 100644 index 00000000..53aa13aa --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/files/test-inventory.yml @@ -0,0 +1,27 @@ +plugin: netbox.netbox.nb_inventory +api_endpoint: "http://localhost:32768" +token: "0123456789abcdef0123456789abcdef01234567" +validate_certs: False + +config_context: True +plurals: False +interfaces: True +services: True + +group_by: + - site + - tenant + - rack + - rack_group + - rack_role + - tag + - role + - device_type + - manufacturer + - platform + - region + - cluster + - cluster_group + - cluster_type + - is_virtual + - services diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/runme.sh b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/runme.sh new file mode 100755 index 00000000..0850539f --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/runme.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +set -o xtrace # Print commands as they're run +set -o errexit # abort on nonzero exitstatus +set -o nounset # abort on unbound variable +set -o pipefail # don't hide errors within pipes + +# Directory of this script +SCRIPT_DIR="$( dirname "${BASH_SOURCE[0]}" )" +RUNME_CONFIG="$SCRIPT_DIR/runme_config" +INVENTORIES_DIR="$SCRIPT_DIR/files" + +# Load runme_config, if exists - the only way to pass environment when run through ansible-test +if [[ -f "$RUNME_CONFIG" ]] +then + source "$RUNME_CONFIG" +fi + +declare -a COMPARE_OPTIONS # empty array + +# Check if NETBOX_VERSION has been set by runme_config, and if so, pass to compare_inventory_json.py +if [[ "${NETBOX_VERSION:-}" == "v2.7" ]] +then + COMPARE_OPTIONS+=(--netbox-version "${NETBOX_VERSION}") +fi + +# OUTPUT_DIR is set by ansible-test +# OUTPUT_INVENTORY_JSON is only set if running hacking/update_test_inventories.sh to update the test diff data +if [[ -n "${OUTPUT_INVENTORY_JSON:-}" ]] +then + OUTPUT_DIR="$OUTPUT_INVENTORY_JSON" + + # Clean up JSON fields we don't want to store and compare against in tests (creation times, etc.) + COMPARE_OPTIONS+=(--write) +fi + +echo OUTPUT_DIR="$OUTPUT_DIR" + +inventory () { + if [[ -n "${OUTPUT_INVENTORY_JSON:-}" ]] + then + # Running for the purpose of updating test data + ansible-inventory "$@" + else + # Running inside ansible-test + # Run through python.py just to make sure we've definitely got the coverage environment set up + # Just running ansible-inventory directly may not actually find the right one in PATH + python.py "$(command -v ansible-inventory)" "$@" + fi +} + + +RESULT=0 + +for INVENTORY in "$INVENTORIES_DIR"/*.yml +do + NAME="$(basename "$INVENTORY")" + NAME_WITHOUT_EXTENSION="${NAME%.yml}" + + OUTPUT_JSON="$OUTPUT_DIR/$NAME_WITHOUT_EXTENSION.json" + inventory -vvvv --list --inventory "$INVENTORY" --output="$OUTPUT_JSON" + + # Compare the output + if ! "$SCRIPT_DIR/compare_inventory_json.py" "${COMPARE_OPTIONS[@]}" "$INVENTORIES_DIR/$NAME_WITHOUT_EXTENSION.json" "$OUTPUT_JSON" + then + # Returned non-zero status + RESULT=1 + fi + +done + +exit $RESULT diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/runme_config.template b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/runme_config.template new file mode 100644 index 00000000..80b42a32 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/inventory-v2.9/runme_config.template @@ -0,0 +1,6 @@ +# runme_config is source'd by runme.sh to set environment variables used to modify the test against different versions of NetBox. +# .travis.yml uses render_config.sh to generate it from runme_config.template +# There is no other way to pass environment variables to a runme.sh integration test. +# (integration_config.yml files are only helpful to ansible yaml-based tests) + +export NETBOX_VERSION=${VERSION} diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/main.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/main.yml new file mode 100644 index 00000000..58829cb0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/main.yml @@ -0,0 +1,159 @@ +--- +- name: "NETBOX_DEVICE TESTS" + include_tasks: "netbox_device.yml" + +- name: "NETBOX_DEVICE_INTERFACE TESTS" + include_tasks: "netbox_device_interface.yml" + +- name: "NETBOX_DEVICE_INTERFACE_TEMPLATE TESTS" + include_tasks: "netbox_device_interface_template.yml" + +- name: "NETBOX_IP_ADDRESS TESTS" + include_tasks: "netbox_ip_address.yml" + +- name: "NETBOX_PREFIX TESTS" + include_tasks: "netbox_prefix.yml" + +- name: "NETBOX_SITE TESTS" + include_tasks: "netbox_site.yml" + +- name: "NETBOX_TENTANT TESTS" + include_tasks: "netbox_tenant.yml" + +- name: "NETBOX_TENTANT_GROUP TESTS" + include_tasks: "netbox_tenant_group.yml" + +- name: "NETBOX_RACK TESTS" + include_tasks: "netbox_rack.yml" + +- name: "NETBOX_RACK_ROLE TESTS" + include_tasks: "netbox_rack_role.yml" + +- name: "NETBOX_RACK_GROUP TESTS" + include_tasks: "netbox_rack_group.yml" + +- name: "NETBOX_MANUFACTURER TESTS" + include_tasks: "netbox_manufacturer.yml" + +- name: "NETBOX_PLATFORM TESTS" + include_tasks: "netbox_platform.yml" + +- name: "NETBOX_DEVICE_TYPE TESTS" + include_tasks: "netbox_device_type.yml" + +- name: "NETBOX_DEVICE_ROLE TESTS" + include_tasks: "netbox_device_role.yml" + +- name: "NETBOX_IPAM_ROLE TESTS" + include_tasks: "netbox_ipam_role.yml" + +- name: "NETBOX_VLAN_GROUP TESTS" + include_tasks: "netbox_vlan_group.yml" + +- name: "NETBOX_VLAN TESTS" + include_tasks: "netbox_vlan.yml" + +- name: "NETBOX_VRF TESTS" + include_tasks: "netbox_vrf.yml" + +- name: "NETBOX_RIR TESTS" + include_tasks: "netbox_rir.yml" + +- name: "NETBOX_AGGREGATE TESTS" + include_tasks: "netbox_aggregate.yml" + +- name: "NETBOX_REGION TESTS" + include_tasks: "netbox_region.yml" + +- name: "NETBOX_DEVICE_BAY TESTS" + include_tasks: "netbox_device_bay.yml" + +- name: "NETBOX_DEVICE_BAY_TEMPLATE TESTS" + include_tasks: "netbox_device_bay_template.yml" + +- name: "NETBOX_INVENTORY_ITEM TESTS" + include_tasks: "netbox_inventory_item.yml" + +- name: "NETBOX_VIRTUAL_MACHINE TESTS" + include_tasks: "netbox_virtual_machine.yml" + +- name: "NETBOX_CLUSTER TESTS" + include_tasks: "netbox_cluster.yml" + +- name: "NETBOX_CLUSTER_GROUP TESTS" + include_tasks: "netbox_cluster_group.yml" + +- name: "NETBOX_CLUSTER_TYPE TESTS" + include_tasks: "netbox_cluster_type.yml" + +- name: "NETBOX_VM_INTERFACE TESTS" + include_tasks: "netbox_vm_interface.yml" + +- name: "NETBOX_PROVIDER TESTS" + include_tasks: "netbox_provider.yml" + +- name: "NETBOX_CIRCUIT_TYPE TESTS" + include_tasks: "netbox_circuit_type.yml" + +- name: "NETBOX_CIRCUIT TESTS" + include_tasks: "netbox_circuit.yml" + +- name: "NETBOX_CIRCUIT_TERMINATION TESTS" + include_tasks: "netbox_circuit_termination.yml" + +- name: "NETBOX_REAR_PORT TESTS" + include_tasks: "netbox_rear_port.yml" + +- name: "NETBOX_REAR_PORT_TEMPLATE TESTS" + include_tasks: "netbox_rear_port_template.yml" + +- name: "NETBOX_FRONT_PORT TESTS" + include_tasks: "netbox_front_port.yml" + +- name: "NETBOX_FRONT_PORT_TEMPLATE TESTS" + include_tasks: "netbox_front_port_template.yml" + +- name: "NETBOX_CONSOLE_PORT TESTS" + include_tasks: "netbox_console_port.yml" + +- name: "NETBOX_CONSOLE_PORT_TEMPLATE TESTS" + include_tasks: "netbox_console_port_template.yml" + +- name: "NETBOX_CONSOLE_SERVER_PORT TESTS" + include_tasks: "netbox_console_server_port.yml" + +- name: "NETBOX_CONSOLE_SERVER_PORT_TEMPLATE TESTS" + include_tasks: "netbox_console_server_port_template.yml" + +- name: "NETBOX_POWER_PANEL TESTS" + include_tasks: "netbox_power_panel.yml" + +- name: "NETBOX_POWER_FEED TESTS" + include_tasks: "netbox_power_feed.yml" + +- name: "NETBOX_POWER_PORT TESTS" + include_tasks: "netbox_power_port.yml" + +- name: "NETBOX_POWER_PORT_TEMPLATE TESTS" + include_tasks: "netbox_power_port_template.yml" + +- name: "NETBOX_POWER_OUTLET TESTS" + include_tasks: "netbox_power_outlet.yml" + +- name: "NETBOX_POWER_OUTLET_TEMPLATE TESTS" + include_tasks: "netbox_power_outlet_template.yml" + +- name: "NETBOX_VIRTUAL_CHASSIS TESTS" + include_tasks: "netbox_virtual_chassis.yml" + +- name: "NETBOX_CABLE TESTS" + include_tasks: "netbox_cable.yml" + +- name: "NETBOX_SERVICE TESTS" + include_tasks: "netbox_service.yml" + +- name: "NETBOX_LOOKUP TESTS" + include_tasks: "netbox_lookup.yml" + +- name: "NETBOX_TAG_TESTS" + include_tasks: "netbox_tag.yml" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_aggregate.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_aggregate.yml new file mode 100644 index 00000000..8fbd2b7d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_aggregate.yml @@ -0,0 +1,115 @@ +--- +## +## +### NETBOX_AGGEGATE +## +## +- name: "AGGREGATE 1: Necessary info creation" + netbox.netbox.netbox_aggregate: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: "10.0.0.0/8" + rir: "Example RIR" + state: present + register: test_one + +- name: "AGGREGATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['aggregate']['prefix'] == "10.0.0.0/8" + - test_one['aggregate']['family'] == 4 + - test_one['aggregate']['rir'] == 1 + - test_one['msg'] == "aggregate 10.0.0.0/8 created" + +- name: "AGGREGATE 2: Create duplicate" + netbox.netbox.netbox_aggregate: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: "10.0.0.0/8" + state: present + register: test_two + +- name: "AGGREGATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['aggregate']['prefix'] == "10.0.0.0/8" + - test_two['aggregate']['family'] == 4 + - test_two['aggregate']['rir'] == 1 + - test_two['msg'] == "aggregate 10.0.0.0/8 already exists" + +- name: "AGGREGATE 3: ASSERT - Update" + netbox.netbox.netbox_aggregate: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: "10.0.0.0/8" + rir: "Example RIR" + date_added: "1989-01-18" + description: "Test Description" + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "AGGREGATE 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['date_added'] == "1989-01-18" + - test_three['diff']['after']['description'] == "Test Description" + - test_three['diff']['after']['tags'][0] == 4 + - test_three['aggregate']['prefix'] == "10.0.0.0/8" + - test_three['aggregate']['family'] == 4 + - test_three['aggregate']['rir'] == 1 + - test_three['aggregate']['date_added'] == "1989-01-18" + - test_three['aggregate']['description'] == "Test Description" + - test_three['aggregate']['tags'][0] == 4 + - test_three['msg'] == "aggregate 10.0.0.0/8 updated" + +- name: "AGGREGATE 4: ASSERT - Delete" + netbox.netbox.netbox_aggregate: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: "10.0.0.0/8" + state: absent + register: test_four + +- name: "AGGREGATE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['aggregate']['prefix'] == "10.0.0.0/8" + - test_four['aggregate']['family'] == 4 + - test_four['aggregate']['rir'] == 1 + - test_four['aggregate']['date_added'] == "1989-01-18" + - test_four['aggregate']['description'] == "Test Description" + - test_four['aggregate']['tags'][0] == 4 + - test_four['msg'] == "aggregate 10.0.0.0/8 deleted" + +- name: "AGGREGATE 5: Necessary info creation" + netbox.netbox.netbox_aggregate: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: "2001::/32" + rir: "Example RIR" + state: present + register: test_five + +- name: "AGGREGATE 5: ASSERT - Necessary info creation" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['aggregate']['prefix'] == "2001::/32" + - test_five['aggregate']['family'] == 6 + - test_five['aggregate']['rir'] == 1 + - test_five['msg'] == "aggregate 2001::/32 created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cable.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cable.yml new file mode 100644 index 00000000..c1af3759 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cable.yml @@ -0,0 +1,186 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_CABLE +## +## +- name: "CABLE 1: Necessary info creation" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + state: present + register: test_one + +- name: "CABLE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['cable']['termination_a_type'] == "dcim.interface" + - test_one['cable']['termination_a_id'] == 13 + - test_one['cable']['termination_b_type'] == "dcim.interface" + - test_one['cable']['termination_b_id'] == 2 + - test_one['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 created" + +- name: "CABLE 2: Create duplicate" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + state: present + register: test_two + +- name: "CABLE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['cable']['termination_a_type'] == "dcim.interface" + - test_two['cable']['termination_a_id'] == 13 + - test_two['cable']['termination_b_type'] == "dcim.interface" + - test_two['cable']['termination_b_id'] == 2 + - test_two['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 already exists" + +- name: "CABLE 3: Update Cable with other fields" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + type: mmf-om4 + status: planned + label: label123 + color: abcdef + length: 30 + length_unit: m + state: present + register: test_three + +- name: "CABLE 3: ASSERT - Update Cable with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "mmf-om4" + - test_three['diff']['after']['status'] == "planned" + - test_three['diff']['after']['label'] == "label123" + - test_three['diff']['after']['color'] == "abcdef" + - test_three['diff']['after']['length'] == 30 + - test_three['diff']['after']['length_unit'] == "m" + - test_three['cable']['termination_a_type'] == "dcim.interface" + - test_three['cable']['termination_a_id'] == 13 + - test_three['cable']['termination_b_type'] == "dcim.interface" + - test_three['cable']['termination_b_id'] == 2 + - test_three['cable']['type'] == "mmf-om4" + - test_three['cable']['status'] == "planned" + - test_three['cable']['label'] == "label123" + - test_three['cable']['color'] == "abcdef" + - test_three['cable']['length'] == 30 + - test_three['cable']['length_unit'] == "m" + - test_three['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 updated" + +- name: "CABLE 4: ASSERT - Delete" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + state: absent + register: test_four + +- name: "CABLE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 deleted" + +- name: "CABLE 5: Connect Console Port and Console Server Port" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: dcim.consoleserverport + termination_a: + name: Console Server Port + device: test100 + termination_b_type: dcim.consoleport + termination_b: + name: Console Port + device: test100 + state: present + register: test_five + +- name: "CABLE 5: ASSERT - Connect Console Port and Console Server Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['cable']['termination_a_type'] == "dcim.consoleserverport" + - test_five['cable']['termination_a_id'] == 1 + - test_five['cable']['termination_b_type'] == "dcim.consoleport" + - test_five['cable']['termination_b_id'] == 1 + - test_five['msg'] == "cable dcim.consoleserverport Console Server Port <> dcim.consoleport Console Port created" + +- name: "CABLE 6: Circuits Termination as side A" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: circuits.circuittermination + termination_a: + circuit: "Test Circuit Two" + term_side: "A" + termination_b_type: dcim.interface + termination_b: + device: "test100" + name: "GigabitEthernet2" + state: present + register: test_six + +- name: "CABLE 6: ASSERT - Circuits Termination as side A" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "absent" + - test_six['diff']['after']['state'] == "present" + - test_six['cable']['termination_a_type'] == "circuits.circuittermination" + - test_six['cable']['termination_a_id'] == 1 + - test_six['cable']['termination_b_type'] == "dcim.interface" + - test_six['cable']['termination_b_id'] == 4 + - test_six['msg'] == "cable circuits.circuittermination 1 <> dcim.interface GigabitEthernet2 created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_circuit.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_circuit.yml new file mode 100644 index 00000000..33d1230c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_circuit.yml @@ -0,0 +1,109 @@ +--- +## +## +### NETBOX_CIRCUIT +## +## +- name: "NETBOX_CIRCUIT 1: Create provider within Netbox with only required information" + netbox.netbox.netbox_circuit: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + cid: Test Circuit One + provider: Test Provider + circuit_type: Test Circuit Type + state: present + register: test_one + +- name: "NETBOX_CIRCUIT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['circuit']['cid'] == "Test Circuit One" + - test_one['circuit']['provider'] == 1 + - test_one['circuit']['type'] == 1 + - test_one['msg'] == "circuit Test Circuit One created" + +- name: "NETBOX_CIRCUIT 2: Duplicate" + netbox.netbox.netbox_circuit: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + cid: Test Circuit One + provider: Test Provider + circuit_type: Test Circuit Type + state: present + register: test_two + +- name: "NETBOX_CIRCUIT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['circuit']['cid'] == "Test Circuit One" + - test_two['circuit']['provider'] == 1 + - test_two['circuit']['type'] == 1 + - test_two['msg'] == "circuit Test Circuit One already exists" + +- name: "NETBOX_CIRCUIT 3: Update provider with other fields" + netbox.netbox.netbox_circuit: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + cid: Test Circuit One + provider: Test Provider + circuit_type: Test Circuit Type + status: Planned + tenant: Test Tenant + install_date: "2018-12-25" + commit_rate: 10000 + description: "Test circuit " + comments: "FAST CIRCUIT" + state: present + register: test_three + +- name: "NETBOX_CIRCUIT 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['status'] == "planned" + - test_three['diff']['after']['tenant'] == 1 + - test_three['diff']['after']['install_date'] == "2018-12-25" + - test_three['diff']['after']['commit_rate'] == 10000 + - test_three['diff']['after']['description'] == "Test circuit" + - test_three['diff']['after']['comments'] == "FAST CIRCUIT" + - test_three['circuit']['cid'] == "Test Circuit One" + - test_three['circuit']['provider'] == 1 + - test_three['circuit']['type'] == 1 + - test_three['circuit']['status'] == "planned" + - test_three['circuit']['tenant'] == 1 + - test_three['circuit']['install_date'] == "2018-12-25" + - test_three['circuit']['commit_rate'] == 10000 + - test_three['circuit']['description'] == "Test circuit" + - test_three['circuit']['comments'] == "FAST CIRCUIT" + - test_three['msg'] == "circuit Test Circuit One updated" + +- name: "NETBOX_CIRCUIT 4: Delete provider within netbox" + netbox.netbox.netbox_circuit: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + cid: Test Circuit One + state: absent + register: test_four + +- name: "NETBOX_CIRCUIT 4 : ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['circuit']['cid'] == "Test Circuit One" + - test_four['circuit']['provider'] == 1 + - test_four['circuit']['type'] == 1 + - test_four['circuit']['status'] == "planned" + - test_four['circuit']['tenant'] == 1 + - test_four['circuit']['install_date'] == "2018-12-25" + - test_four['circuit']['commit_rate'] == 10000 + - test_four['circuit']['description'] == "Test circuit" + - test_four['circuit']['comments'] == "FAST CIRCUIT" + - test_four['msg'] == "circuit Test Circuit One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_circuit_termination.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_circuit_termination.yml new file mode 100644 index 00000000..6851b510 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_circuit_termination.yml @@ -0,0 +1,129 @@ +--- +## +## +### NETBOX_CIRCUIT_TERMINATION +## +## +- name: "NETBOX_CIRCUIT_TERMINATION 1: Create provider within Netbox with only required information" + netbox.netbox.netbox_circuit_termination: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + circuit: Test Circuit + term_side: A + site: "Test Site" + port_speed: 10000 + state: present + register: test_one + +- name: "NETBOX_CIRCUIT_TERMINATION 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['circuit_termination']['circuit'] == 1 + - test_one['circuit_termination']['term_side'] == "A" + - test_one['circuit_termination']['site'] == 1 + - test_one['circuit_termination']['port_speed'] == 10000 + - test_one['msg'] == "circuit_termination test_circuit_a created" + +- name: "NETBOX_CIRCUIT_TERMINATION 2: Duplicate" + netbox.netbox.netbox_circuit_termination: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + circuit: Test Circuit + term_side: A + state: present + register: test_two + +- name: "NETBOX_CIRCUIT_TERMINATION 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['circuit_termination']['circuit'] == 1 + - test_two['circuit_termination']['term_side'] == "A" + - test_two['circuit_termination']['site'] == 1 + - test_two['circuit_termination']['port_speed'] == 10000 + - test_two['msg'] == "circuit_termination test_circuit_a already exists" + +- name: "NETBOX_CIRCUIT_TERMINATION 3: Update provider with other fields" + netbox.netbox.netbox_circuit_termination: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + circuit: Test Circuit + term_side: A + upstream_speed: 1000 + xconnect_id: 10X100 + pp_info: PP10-24 + description: "Test description" + state: present + register: test_three + +- name: "NETBOX_CIRCUIT_TERMINATION 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['upstream_speed'] == 1000 + - test_three['diff']['after']['xconnect_id'] == "10X100" + - test_three['diff']['after']['pp_info'] == "PP10-24" + - test_three['diff']['after']['description'] == "Test description" + - test_three['circuit_termination']['circuit'] == 1 + - test_three['circuit_termination']['term_side'] == "A" + - test_three['circuit_termination']['site'] == 1 + - test_three['circuit_termination']['port_speed'] == 10000 + - test_three['circuit_termination']['upstream_speed'] == 1000 + - test_three['circuit_termination']['xconnect_id'] == "10X100" + - test_three['circuit_termination']['pp_info'] == "PP10-24" + - test_three['circuit_termination']['description'] == "Test description" + - test_three['msg'] == "circuit_termination test_circuit_a updated" + +- name: "NETBOX_CIRCUIT_TERMINATION 4: Create Z Side" + netbox.netbox.netbox_circuit_termination: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + circuit: Test Circuit + term_side: Z + site: "Test Site" + port_speed: 10000 + state: present + register: test_four + +- name: "NETBOX_CIRCUIT_TERMINATION 4: ASSERT - Create Z Side" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['circuit_termination']['circuit'] == 1 + - test_four['circuit_termination']['term_side'] == "Z" + - test_four['circuit_termination']['site'] == 1 + - test_four['circuit_termination']['port_speed'] == 10000 + - test_four['msg'] == "circuit_termination test_circuit_z created" + +- name: "NETBOX_CIRCUIT_TERMINATION 5: Delete provider within netbox" + netbox.netbox.netbox_circuit_termination: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + circuit: Test Circuit + term_side: A + state: absent + register: test_five + +- name: "NETBOX_CIRCUIT_TERMINATION 5: ASSERT - Delete" + assert: + that: + - test_five is changed + - test_five['circuit_termination']['circuit'] == 1 + - test_five['circuit_termination']['term_side'] == "A" + - test_five['circuit_termination']['site'] == 1 + - test_five['circuit_termination']['port_speed'] == 10000 + - test_five['circuit_termination']['upstream_speed'] == 1000 + - test_five['circuit_termination']['xconnect_id'] == "10X100" + - test_five['circuit_termination']['pp_info'] == "PP10-24" + - test_five['circuit_termination']['description'] == "Test description" + - test_five['msg'] == "circuit_termination test_circuit_a deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_circuit_type.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_circuit_type.yml new file mode 100644 index 00000000..45f956e3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_circuit_type.yml @@ -0,0 +1,96 @@ +--- +## +## +### NETBOX_CIRCUIT_TYPE +## +## +- name: "CIRCUIT_TYPE 1: Necessary info creation" + netbox.netbox.netbox_circuit_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Circuit Type One" + state: present + register: test_one + +- name: "CIRCUIT_TYPE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['circuit_type']['name'] == "Test Circuit Type One" + - test_one['circuit_type']['slug'] == "test-circuit-type-one" + - test_one['msg'] == "circuit_type Test Circuit Type One created" + +- name: "CIRCUIT_TYPE 2: Create duplicate" + netbox.netbox.netbox_circuit_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Circuit Type One" + state: present + register: test_two + +- name: "CIRCUIT_TYPE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['circuit_type']['name'] == "Test Circuit Type One" + - test_two['circuit_type']['slug'] == "test-circuit-type-one" + - test_two['msg'] == "circuit_type Test Circuit Type One already exists" + +- name: "CIRCUIT_TYPE 3: User specified slug" + netbox.netbox.netbox_circuit_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Circuit Type Two" + slug: "test-circuit-type-2" + state: present + register: test_three + +- name: "CIRCUIT_TYPE 3: ASSERT - User specified slug" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['circuit_type']['name'] == "Test Circuit Type Two" + - test_three['circuit_type']['slug'] == "test-circuit-type-2" + - test_three['msg'] == "circuit_type Test Circuit Type Two created" + +- name: "CIRCUIT_TYPE 4: ASSERT - Delete" + netbox.netbox.netbox_circuit_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Circuit Type One" + state: absent + register: test_four + +- name: "CIRCUIT_TYPE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['circuit_type']['name'] == "Test Circuit Type One" + - test_four['circuit_type']['slug'] == "test-circuit-type-one" + - test_four['msg'] == "circuit_type Test Circuit Type One deleted" + +- name: "CIRCUIT_TYPE 5: ASSERT - Delete" + netbox.netbox.netbox_circuit_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Circuit Type Two" + slug: "test-circuit-type-2" + state: absent + register: test_five + +- name: "CIRCUIT_TYPE 5: ASSERT - Delete" + assert: + that: + - test_five is changed + - test_five['circuit_type']['name'] == "Test Circuit Type Two" + - test_five['circuit_type']['slug'] == "test-circuit-type-2" + - test_five['msg'] == "circuit_type Test Circuit Type Two deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cluster.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cluster.yml new file mode 100644 index 00000000..11ba5ef8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cluster.yml @@ -0,0 +1,98 @@ +--- +## +## +### NETBOX_CLUSTER +## +## +- name: "CLUSTER 1: Necessary info creation" + netbox.netbox.netbox_cluster: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster One" + cluster_type: "Test Cluster Type" + state: present + register: test_one + +- name: "CLUSTER 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['cluster']['name'] == "Test Cluster One" + - test_one['cluster']['type'] == 1 + - test_one['msg'] == "cluster Test Cluster One created" + +- name: "CLUSTER 2: Create duplicate" + netbox.netbox.netbox_cluster: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster One" + cluster_type: "Test Cluster Type" + state: present + register: test_two + +- name: "CLUSTER 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['cluster']['name'] == "Test Cluster One" + - test_two['cluster']['type'] == 1 + - test_two['msg'] == "cluster Test Cluster One already exists" + +- name: "CLUSTER 3: Update" + netbox.netbox.netbox_cluster: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster One" + cluster_type: "Test Cluster Type" + cluster_group: "Test Cluster Group" + site: "Test Site" + comments: "Updated cluster" + tenant: "Test Tenant" + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "CLUSTER 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['group'] == 1 + - test_three['diff']['after']['site'] == 1 + - test_three['diff']['after']['comments'] == "Updated cluster" + - test_three['diff']['after']['tags'][0] == 4 + - test_three['diff']['after']['tenant'] == 1 + - test_three['cluster']['name'] == "Test Cluster One" + - test_three['cluster']['type'] == 1 + - test_three['cluster']['group'] == 1 + - test_three['cluster']['site'] == 1 + - test_three['cluster']['comments'] == "Updated cluster" + - test_three['cluster']['tags'][0] == 4 + - test_three['cluster']['tenant'] == 1 + - test_three['msg'] == "cluster Test Cluster One updated" + +- name: "CLUSTER 4: ASSERT - Delete" + netbox.netbox.netbox_cluster: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster One" + state: absent + register: test_four + +- name: "CLUSTER 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['cluster']['name'] == "Test Cluster One" + - test_four['cluster']['type'] == 1 + - test_four['cluster']['group'] == 1 + - test_four['cluster']['site'] == 1 + - test_four['cluster']['comments'] == "Updated cluster" + - test_four['cluster']['tags'][0] == 4 + - test_four['msg'] == "cluster Test Cluster One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cluster_group.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cluster_group.yml new file mode 100644 index 00000000..9f84518c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cluster_group.yml @@ -0,0 +1,96 @@ +--- +## +## +### NETBOX_CLUSTER_GROUP +## +## +- name: "CLUSTER_GROUP 1: Necessary info creation" + netbox.netbox.netbox_cluster_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Group One" + state: present + register: test_one + +- name: "CLUSTER_GROUP 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['cluster_group']['name'] == "Test Cluster Group One" + - test_one['cluster_group']['slug'] == "test-cluster-group-one" + - test_one['msg'] == "cluster_group Test Cluster Group One created" + +- name: "CLUSTER_GROUP 2: Create duplicate" + netbox.netbox.netbox_cluster_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Group One" + state: present + register: test_two + +- name: "CLUSTER_GROUP 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['cluster_group']['name'] == "Test Cluster Group One" + - test_two['cluster_group']['slug'] == "test-cluster-group-one" + - test_two['msg'] == "cluster_group Test Cluster Group One already exists" + +- name: "CLUSTER_GROUP 3: User specified slug" + netbox.netbox.netbox_cluster_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Group Two" + slug: "test-cluster-group-2" + state: present + register: test_three + +- name: "CLUSTER_GROUP 3: ASSERT - User specified slug" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['cluster_group']['name'] == "Test Cluster Group Two" + - test_three['cluster_group']['slug'] == "test-cluster-group-2" + - test_three['msg'] == "cluster_group Test Cluster Group Two created" + +- name: "CLUSTER_GROUP 4: ASSERT - Delete" + netbox.netbox.netbox_cluster_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Group One" + state: absent + register: test_four + +- name: "CLUSTER_GROUP 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['cluster_group']['name'] == "Test Cluster Group One" + - test_four['cluster_group']['slug'] == "test-cluster-group-one" + - test_four['msg'] == "cluster_group Test Cluster Group One deleted" + +- name: "CLUSTER_GROUP 5: ASSERT - Delete" + netbox.netbox.netbox_cluster_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Group Two" + slug: "test-cluster-group-2" + state: absent + register: test_five + +- name: "CLUSTER_GROUP 5: ASSERT - Delete" + assert: + that: + - test_five is changed + - test_five['cluster_group']['name'] == "Test Cluster Group Two" + - test_five['cluster_group']['slug'] == "test-cluster-group-2" + - test_five['msg'] == "cluster_group Test Cluster Group Two deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cluster_type.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cluster_type.yml new file mode 100644 index 00000000..abcaed09 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_cluster_type.yml @@ -0,0 +1,95 @@ +## +## +### NETBOX_CLUSTER_TYPE +## +## +- name: "CLUSTER_TYPE 1: Necessary info creation" + netbox.netbox.netbox_cluster_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Type One" + state: present + register: test_one + +- name: "CLUSTER_TYPE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['cluster_type']['name'] == "Test Cluster Type One" + - test_one['cluster_type']['slug'] == "test-cluster-type-one" + - test_one['msg'] == "cluster_type Test Cluster Type One created" + +- name: "CLUSTER_TYPE 2: Create duplicate" + netbox.netbox.netbox_cluster_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Type One" + state: present + register: test_two + +- name: "CLUSTER_TYPE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['cluster_type']['name'] == "Test Cluster Type One" + - test_two['cluster_type']['slug'] == "test-cluster-type-one" + - test_two['msg'] == "cluster_type Test Cluster Type One already exists" + +- name: "CLUSTER_TYPE 3: User specified slug" + netbox.netbox.netbox_cluster_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Type Two" + slug: "test-cluster-type-2" + state: present + register: test_three + +- name: "CLUSTER_TYPE 3: ASSERT - User specified slug" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['cluster_type']['name'] == "Test Cluster Type Two" + - test_three['cluster_type']['slug'] == "test-cluster-type-2" + - test_three['msg'] == "cluster_type Test Cluster Type Two created" + +- name: "CLUSTER_TYPE 4: ASSERT - Delete" + netbox.netbox.netbox_cluster_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Type One" + state: absent + register: test_four + +- name: "CLUSTER_TYPE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['cluster_type']['name'] == "Test Cluster Type One" + - test_four['cluster_type']['slug'] == "test-cluster-type-one" + - test_four['msg'] == "cluster_type Test Cluster Type One deleted" + +- name: "CLUSTER_TYPE 5: ASSERT - Delete" + netbox.netbox.netbox_cluster_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Type Two" + slug: "test-cluster-type-2" + state: absent + register: test_five + +- name: "CLUSTER_TYPE 5: ASSERT - Delete" + assert: + that: + - test_five is changed + - test_five['cluster_type']['name'] == "Test Cluster Type Two" + - test_five['cluster_type']['slug'] == "test-cluster-type-2" + - test_five['msg'] == "cluster_type Test Cluster Type Two deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_port.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_port.yml new file mode 100644 index 00000000..1c97cb8a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_port.yml @@ -0,0 +1,108 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_CONSOLE_PORT +## +## +- name: "CONSOLE_PORT 1: Necessary info creation" + netbox.netbox.netbox_console_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port + device: test100 + state: present + register: test_one + +- name: "CONSOLE_PORT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['console_port']['name'] == "Console Port" + - test_one['console_port']['device'] == 1 + - test_one['msg'] == "console_port Console Port created" + +- name: "CONSOLE_PORT 2: Create duplicate" + netbox.netbox.netbox_console_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port + device: test100 + state: present + register: test_two + +- name: "CONSOLE_PORT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['console_port']['name'] == "Console Port" + - test_two['console_port']['device'] == 1 + - test_two['msg'] == "console_port Console Port already exists" + +- name: "CONSOLE_PORT 3: Update Console Port with other fields" + netbox.netbox.netbox_console_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port + device: test100 + type: usb-a + description: test description + state: present + register: test_three + +- name: "CONSOLE_PORT 3: ASSERT - Update Console Port with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "usb-a" + - test_three['diff']['after']['description'] == "test description" + - test_three['console_port']['name'] == "Console Port" + - test_three['console_port']['device'] == 1 + - test_three['console_port']['type'] == "usb-a" + - test_three['console_port']['description'] == "test description" + - test_three['msg'] == "console_port Console Port updated" + +- name: "CONSOLE_PORT 4: Create Console Port for Delete Test" + netbox.netbox.netbox_console_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port 2 + device: test100 + state: present + register: test_four + +- name: "CONSOLE_PORT 4: ASSERT - Create Console Port for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['console_port']['name'] == "Console Port 2" + - test_four['console_port']['device'] == 1 + - test_four['msg'] == "console_port Console Port 2 created" + +- name: "CONSOLE_PORT 5: Delete Console Port" + netbox.netbox.netbox_console_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port 2 + device: test100 + state: absent + register: test_five + +- name: "CONSOLE_PORT 5: ASSERT - Delete Console Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "console_port Console Port 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_port_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_port_template.yml new file mode 100644 index 00000000..b1bd1d1e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_port_template.yml @@ -0,0 +1,105 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_CONSOLE_PORT_TEMPLATE +## +## +- name: "CONSOLE_PORT_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_console_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port Template + device_type: Cisco Test + state: present + register: test_one + +- name: "CONSOLE_PORT_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['console_port_template']['name'] == "Console Port Template" + - test_one['console_port_template']['device_type'] == 1 + - test_one['msg'] == "console_port_template Console Port Template created" + +- name: "CONSOLE_PORT_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_console_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port Template + device_type: Cisco Test + state: present + register: test_two + +- name: "CONSOLE_PORT_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['console_port_template']['name'] == "Console Port Template" + - test_two['console_port_template']['device_type'] == 1 + - test_two['msg'] == "console_port_template Console Port Template already exists" + +- name: "CONSOLE_PORT_TEMPLATE 3: Update Console Port Template with other fields" + netbox.netbox.netbox_console_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port Template + device_type: Cisco Test + type: usb-a + state: present + register: test_three + +- name: "CONSOLE_PORT_TEMPLATE 3: ASSERT - Update Console Port Template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "usb-a" + - test_three['console_port_template']['name'] == "Console Port Template" + - test_three['console_port_template']['device_type'] == 1 + - test_three['console_port_template']['type'] == "usb-a" + - test_three['msg'] == "console_port_template Console Port Template updated" + +- name: "CONSOLE_PORT_TEMPLATE 4: Create Console Port Template for Delete Test" + netbox.netbox.netbox_console_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port Template 2 + device_type: Cisco Test + state: present + register: test_four + +- name: "CONSOLE_PORT_TEMPLATE 4: ASSERT - Create Console Port Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['console_port_template']['name'] == "Console Port Template 2" + - test_four['console_port_template']['device_type'] == 1 + - test_four['msg'] == "console_port_template Console Port Template 2 created" + +- name: "CONSOLE_PORT_TEMPLATE 5: Delete Console Port Template" + netbox.netbox.netbox_console_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port Template 2 + device_type: Cisco Test + state: absent + register: test_five + +- name: "CONSOLE_PORT_TEMPLATE 5: ASSERT - Delete Console Port Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "console_port_template Console Port Template 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_server_port.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_server_port.yml new file mode 100644 index 00000000..f7034532 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_server_port.yml @@ -0,0 +1,108 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_CONSOLE_SERVER_PORT +## +## +- name: "CONSOLE_SERVER_PORT 1: Necessary info creation" + netbox.netbox.netbox_console_server_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port + device: test100 + state: present + register: test_one + +- name: "CONSOLE_SERVER_PORT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['console_server_port']['name'] == "Console Server Port" + - test_one['console_server_port']['device'] == 1 + - test_one['msg'] == "console_server_port Console Server Port created" + +- name: "CONSOLE_SERVER_PORT 2: Create duplicate" + netbox.netbox.netbox_console_server_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port + device: test100 + state: present + register: test_two + +- name: "CONSOLE_SERVER_PORT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['console_server_port']['name'] == "Console Server Port" + - test_two['console_server_port']['device'] == 1 + - test_two['msg'] == "console_server_port Console Server Port already exists" + +- name: "CONSOLE_SERVER_PORT 3: Update Console Server Port with other fields" + netbox.netbox.netbox_console_server_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port + device: test100 + type: usb-a + description: test description + state: present + register: test_three + +- name: "CONSOLE_SERVER_PORT 3: ASSERT - Update Console Server Port with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "usb-a" + - test_three['diff']['after']['description'] == "test description" + - test_three['console_server_port']['name'] == "Console Server Port" + - test_three['console_server_port']['device'] == 1 + - test_three['console_server_port']['type'] == "usb-a" + - test_three['console_server_port']['description'] == "test description" + - test_three['msg'] == "console_server_port Console Server Port updated" + +- name: "CONSOLE_SERVER_PORT 4: Create Console Server Port for Delete Test" + netbox.netbox.netbox_console_server_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port 2 + device: test100 + state: present + register: test_four + +- name: "CONSOLE_SERVER_PORT 4: ASSERT - Create Console Server Port for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['console_server_port']['name'] == "Console Server Port 2" + - test_four['console_server_port']['device'] == 1 + - test_four['msg'] == "console_server_port Console Server Port 2 created" + +- name: "CONSOLE_SERVER_PORT 5: Delete Console Server Port" + netbox.netbox.netbox_console_server_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port 2 + device: test100 + state: absent + register: test_five + +- name: "CONSOLE_SERVER_PORT 5: ASSERT - Delete Console Server Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "console_server_port Console Server Port 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_server_port_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_server_port_template.yml new file mode 100644 index 00000000..4ad47d40 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_console_server_port_template.yml @@ -0,0 +1,105 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_CONSOLE_SERVER_PORT_TEMPLATE +## +## +- name: "CONSOLE_SERVER_PORT_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_console_server_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port Template + device_type: Cisco Test + state: present + register: test_one + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['console_server_port_template']['name'] == "Console Server Port Template" + - test_one['console_server_port_template']['device_type'] == 1 + - test_one['msg'] == "console_server_port_template Console Server Port Template created" + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_console_server_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port Template + device_type: Cisco Test + state: present + register: test_two + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['console_server_port_template']['name'] == "Console Server Port Template" + - test_two['console_server_port_template']['device_type'] == 1 + - test_two['msg'] == "console_server_port_template Console Server Port Template already exists" + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 3: Update Console Server Port Template with other fields" + netbox.netbox.netbox_console_server_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port Template + device_type: Cisco Test + type: usb-a + state: present + register: test_three + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 3: ASSERT - Update Console Server Port Template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "usb-a" + - test_three['console_server_port_template']['name'] == "Console Server Port Template" + - test_three['console_server_port_template']['device_type'] == 1 + - test_three['console_server_port_template']['type'] == "usb-a" + - test_three['msg'] == "console_server_port_template Console Server Port Template updated" + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 4: Create Console Server Port Template for Delete Test" + netbox.netbox.netbox_console_server_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port Template 2 + device_type: Cisco Test + state: present + register: test_four + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 4: ASSERT - Create Console Server Port Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['console_server_port_template']['name'] == "Console Server Port Template 2" + - test_four['console_server_port_template']['device_type'] == 1 + - test_four['msg'] == "console_server_port_template Console Server Port Template 2 created" + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 5: Delete Console Server Port Template" + netbox.netbox.netbox_console_server_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port Template 2 + device_type: Cisco Test + state: absent + register: test_five + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 5: ASSERT - Delete Console Server Port Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "console_server_port_template Console Server Port Template 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device.yml new file mode 100644 index 00000000..13cde45b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device.yml @@ -0,0 +1,241 @@ +--- +## +## +### NETBOX_DEVICE +## +## +- name: "1 - Device with required information" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1" + device_type: + id: "1" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + state: present + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == 'absent' + - test_one['diff']['after']['state'] == 'present' + - test_one['device']['name'] == "R1" + - test_one['device']['device_role'] == 1 + - test_one['device']['device_type'] == 1 + - test_one['device']['site'] == 1 + - test_one['device']['status'] == "staged" + - test_one['device']['name'] == "R1" + - test_one['msg'] == "device R1 created" + +- name: "2 - Duplicate device" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + state: present + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['device']['name'] == "R1" + - test_two['device']['device_role'] == 1 + - test_two['device']['device_type'] == 1 + - test_two['device']['site'] == 1 + - test_two['device']['status'] == "staged" + - test_two['msg'] == "device R1 already exists" + +- name: "3 - Update device" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1" + serial: "FXS1001" + local_context_data: + bgp_as: "65412" + virtual_chassis: "Test Nexus One" + vc_position: 3 + vc_priority: 15 + state: present + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['after']['serial'] == "FXS1001" + - test_three['diff']['after']['local_context_data']["bgp_as"] == "65412" + - test_three['diff']['after']['virtual_chassis'] == 1 + - test_three['diff']['after']['vc_position'] == 3 + - test_three['diff']['after']['vc_priority'] == 15 + - test_three['device']['name'] == "R1" + - test_three['device']['device_role'] == 1 + - test_three['device']['device_type'] == 1 + - test_three['device']['site'] == 1 + - test_three['device']['status'] == "staged" + - test_three['device']['serial'] == "FXS1001" + - test_three['device']['local_context_data']["bgp_as"] == "65412" + - test_three['device']['virtual_chassis'] == 1 + - test_three['device']['vc_position'] == 3 + - test_three['device']['vc_priority'] == 15 + - test_three['msg'] == "device R1 updated" + +- name: "3.1 - Update device name using query_params" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1-changed-name" + serial: "FXS1001" + query_params: + - serial + state: present + register: test_three_dot_one + +- name: "3.1 - ASSERT" + assert: + that: + - test_three_dot_one is changed + - test_three_dot_one['diff']['after']['name'] == "R1-changed-name" + - test_three_dot_one['device']['device_role'] == 1 + - test_three_dot_one['device']['device_type'] == 1 + - test_three_dot_one['device']['site'] == 1 + - test_three_dot_one['device']['status'] == "staged" + - test_three_dot_one['device']['serial'] == "FXS1001" + - test_three_dot_one['device']['local_context_data']["bgp_as"] == "65412" + - test_three_dot_one['msg'] == "device R1-changed-name updated" + +- name: "4 - Create device with tags and assign to rack" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "TestR1" + device_type: "1841" + device_role: "Core Switch" + site: "Test Site2" + rack: "Test Rack Site 2" + position: 35 + face: "Front" + tags: + - "schnozzberry" + tenant: "Test Tenant" + asset_tag: "1234" + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['device']['name'] == "TestR1" + - test_four['device']['device_role'] == 1 + - test_four['device']['device_type'] == 5 + - test_four['device']['site'] == 2 + - test_four['device']['status'] == "active" + - test_four['device']['rack'] == 1 + - test_four['device']['tags'][0] == 4 + - test_four['device']['tenant'] == 1 + - test_four['device']['asset_tag'] == '1234' + - test_four['msg'] == "device TestR1 created" + +- name: "5 - Delete previous device" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "TestR1" + state: absent + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "device TestR1 deleted" + +- name: "6 - Delete R1" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1-changed-name" + state: absent + register: test_six + +- name: "6 - ASSERT" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "present" + - test_six['diff']['after']['state'] == "absent" + - test_six['msg'] == "device R1-changed-name deleted" + +- name: "7 - Add primary_ip4/6 to test100" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "test100" + primary_ip4: "172.16.180.1/24" + primary_ip6: "2001::1:1/64" + state: present + register: test_seven + +- name: "7 - ASSERT" + assert: + that: + - test_seven is changed + - test_seven['diff']['after']['primary_ip4'] == 1 + - test_seven['diff']['after']['primary_ip6'] == 2 + - test_seven['device']['name'] == "test100" + - test_seven['device']['device_role'] == 1 + - test_seven['device']['device_type'] == 1 + - test_seven['device']['site'] == 1 + - test_seven['device']['status'] == "active" + - test_seven['device']['primary_ip4'] == 1 + - test_seven['device']['primary_ip6'] == 2 + - test_seven['msg'] == "device test100 updated" + +- name: "8 - Device with empty string name" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "" + device_type: + id: 1 + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + state: present + register: test_eight + +- name: "8 - ASSERT" + assert: + that: + - test_eight is changed + - test_eight['diff']['before']['state'] == 'absent' + - test_eight['diff']['after']['state'] == 'present' + - test_eight['device']['device_role'] == 1 + - test_eight['device']['device_type'] == 1 + - test_eight['device']['site'] == 1 + - test_eight['device']['status'] == "staged" + - "'-' in test_eight['device']['name']" + - "test_eight['device']['name'] | length == 36" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_bay.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_bay.yml new file mode 100644 index 00000000..18a80435 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_bay.yml @@ -0,0 +1,87 @@ +--- +## +## +### NETBOX_DEVICE_BAY +## +## +- name: "DEVICE_BAY 1: Necessary info creation" + netbox.netbox.netbox_device_bay: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "Test Nexus One" + name: "Device Bay One" + state: present + register: test_one + +- name: "DEVICE_BAY 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['device_bay']['name'] == "Device Bay One" + - test_one['device_bay']['device'] == 4 + - test_one['msg'] == "device_bay Device Bay One created" + +- name: "DEVICE_BAY 2: Create duplicate" + netbox.netbox.netbox_device_bay: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "Test Nexus One" + name: "Device Bay One" + state: present + register: test_two + +- name: "DEVICE_BAY 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['device_bay']['name'] == "Device Bay One" + - test_two['device_bay']['device'] == 4 + - test_two['msg'] == "device_bay Device Bay One already exists" + +- name: "DEVICE_BAY 3: ASSERT - Update" + netbox.netbox.netbox_device_bay: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "Test Nexus One" + name: "Device Bay One" + installed_device: "Test Nexus Child One" + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "DEVICE_BAY 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['installed_device'] == 5 + - test_three['diff']['after']['tags'][0] == 4 + - test_three['device_bay']['name'] == "Device Bay One" + - test_three['device_bay']['device'] == 4 + - test_three['device_bay']['installed_device'] == 5 + - test_three['device_bay']['tags'][0] == 4 + - test_three['msg'] == "device_bay Device Bay One updated" + +- name: "DEVICE_BAY 4: ASSERT - Delete" + netbox.netbox.netbox_device_bay: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Device Bay One" + state: absent + register: test_four + +- name: "DEVICE_BAY 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['device_bay']['name'] == "Device Bay One" + - test_four['device_bay']['device'] == 4 + - test_four['device_bay']['installed_device'] == 5 + - test_four['device_bay']['tags'][0] == 4 + - test_four['msg'] == "device_bay Device Bay One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_bay_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_bay_template.yml new file mode 100644 index 00000000..4b696503 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_bay_template.yml @@ -0,0 +1,81 @@ +--- +## +## +### NETBOX_DEVICE_BAY_TEMPLATE +## +## +- name: "DEVICE_BAY_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_device_bay_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device_type: WS Test 3850 + name: Device Bay Template One + state: present + register: test_one + +- name: "DEVICE_BAY_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['device_bay_template']['name'] == "Device Bay Template One" + - test_one['device_bay_template']['device_type'] == 7 + - test_one['msg'] == "device_bay_template Device Bay Template One created" + +- name: "DEVICE_BAY_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_device_bay_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device_type: WS Test 3850 + name: Device Bay Template One + state: present + register: test_two + +- name: "DEVICE_BAY_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['device_bay_template']['name'] == "Device Bay Template One" + - test_two['device_bay_template']['device_type'] == 7 + - test_two['msg'] == "device_bay_template Device Bay Template One already exists" + +- name: "DEVICE_BAY_TEMPLATE 3: ASSERT - Create Device Bay Template for Delete Test" + netbox.netbox.netbox_device_bay_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device_type: WS Test 3850 + name: Device Bay Template Two + state: present + register: test_three + +- name: "DEVICE_BAY_TEMPLATE 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['device_bay_template']['name'] == "Device Bay Template Two" + - test_three['device_bay_template']['device_type'] == 7 + - test_three['msg'] == "device_bay_template Device Bay Template Two created" + +- name: "DEVICE_BAY_TEMPLATE 4: ASSERT - Delete" + netbox.netbox.netbox_device_bay_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Device Bay Template Two + device_type: WS Test 3850 + state: absent + register: test_four + +- name: "DEVICE_BAY_TEMPLATE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['device_bay_template']['name'] == "Device Bay Template Two" + - test_four['device_bay_template']['device_type'] == 7 + - test_four['msg'] == "device_bay_template Device Bay Template Two deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_interface.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_interface.yml new file mode 100644 index 00000000..ed581f35 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_interface.yml @@ -0,0 +1,291 @@ +--- +## +## +### NETBOX_DEVICE_INTERFACE +## +## +- name: "1 - Interface with required information" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet3 + type: "1000Base-T (1GE)" + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['msg'] == "interface GigabitEthernet3 created" + - test_one['diff']['before']['state'] == 'absent' + - test_one['diff']['after']['state'] == 'present' + - test_one['interface']['name'] == "GigabitEthernet3" + - test_one['interface']['device'] == 1 + +- name: "2 - Update test100 - GigabitEthernet3" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet3 + mtu: 1600 + enabled: false + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - test_two is changed + - test_two['msg'] == "interface GigabitEthernet3 updated" + - test_two['diff']['after']['enabled'] == false + - test_two['diff']['after']['mtu'] == 1600 + - test_two['interface']['name'] == "GigabitEthernet3" + - test_two['interface']['device'] == 1 + - test_two['interface']['enabled'] == false + - test_two['interface']['mtu'] == 1600 + +- name: "3 - Delete interface test100 - GigabitEthernet3" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet3 + state: absent + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['msg'] == "interface GigabitEthernet3 deleted" + - test_three['diff']['before']['state'] == "present" + - test_three['diff']['after']['state'] == "absent" + +- name: "4 - Create LAG with several specified options" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: port-channel1 + type: Link Aggregation Group (LAG) + mtu: 1600 + mgmt_only: false + mode: Access + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['msg'] == "interface port-channel1 created" + - test_four['diff']['before']['state'] == 'absent' + - test_four['diff']['after']['state'] == 'present' + - test_four['interface']['name'] == "port-channel1" + - test_four['interface']['device'] == 1 + - test_four['interface']['enabled'] == true + - test_four['interface']['type'] == "lag" + - test_four['interface']['mgmt_only'] == false + - test_four['interface']['mode'] == "access" + - test_four['interface']['mtu'] == 1600 + +- name: "5 - Create interface and assign it to parent LAG" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet3 + enabled: false + type: 1000Base-T (1GE) + lag: + name: port-channel1 + mtu: 1600 + mgmt_only: false + mode: Access + state: present + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['msg'] == "interface GigabitEthernet3 created" + - test_five['diff']['before']['state'] == 'absent' + - test_five['diff']['after']['state'] == 'present' + - test_five['interface']['name'] == "GigabitEthernet3" + - test_five['interface']['device'] == 1 + - test_five['interface']['enabled'] == false + - test_five['interface']['type'] == "1000base-t" + - test_five['interface']['mgmt_only'] == false + - test_five['interface']['lag'] == 8 + - test_five['interface']['mode'] == "access" + - test_five['interface']['mtu'] == 1600 + +- name: "6 - Create interface as trunk port" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet21 + enabled: false + type: 1000Base-T (1GE) + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + mtu: 1600 + mgmt_only: true + mode: Tagged + state: present + register: test_six + +- name: "6 - ASSERT" + assert: + that: + - test_six is changed + - test_six['msg'] == "interface GigabitEthernet21 created" + - test_six['diff']['before']['state'] == 'absent' + - test_six['diff']['after']['state'] == 'present' + - test_six['interface']['name'] == "GigabitEthernet21" + - test_six['interface']['device'] == 1 + - test_six['interface']['enabled'] == false + - test_six['interface']['type'] == "1000base-t" + - test_six['interface']['mgmt_only'] == true + - test_six['interface']['mode'] == "tagged" + - test_six['interface']['mtu'] == 1600 + - test_six['interface']['tagged_vlans'] == [2, 3] + - test_six['interface']['untagged_vlan'] == 1 + +- name: "7 - Duplicate Interface" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet1 + register: test_seven + +- name: "7 - ASSERT" + assert: + that: + - not test_seven['changed'] + - test_seven['msg'] == "interface GigabitEthernet1 already exists" + - test_seven['interface']['name'] == "GigabitEthernet1" + - test_seven['interface']['device'] == 1 + +- name: "Add port-channel1 to R1 to test finding proper port-channel1" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "R1-Device" + name: "port-channel1" + type: "Link Aggregation Group (LAG)" + +- name: "8 - Create interface and assign it to parent LAG - non dict" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet4 + enabled: false + type: 1000Base-T (1GE) + lag: "port-channel1" + mtu: 1600 + mgmt_only: false + mode: Access + state: present + register: test_eight + +- name: "8 - ASSERT" + assert: + that: + - test_eight is changed + - test_eight['msg'] == "interface GigabitEthernet4 created" + - test_eight['diff']['before']['state'] == 'absent' + - test_eight['diff']['after']['state'] == 'present' + - test_eight['interface']['name'] == "GigabitEthernet4" + - test_eight['interface']['device'] == 1 + - test_eight['interface']['enabled'] == false + - test_eight['interface']['type'] == "1000base-t" + - test_eight['interface']['mgmt_only'] == false + - test_eight['interface']['lag'] == 8 + - test_eight['interface']['mode'] == "access" + - test_eight['interface']['mtu'] == 1600 + +- name: "9 - Create interface on VC child" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: Test Nexus Child One + name: Ethernet2/2 + type: 1000Base-T (1GE) + state: present + register: test_nine + +- name: "9 - ASSERT" + assert: + that: + - test_nine is changed + - test_nine['msg'] == "interface Ethernet2/2 created" + - test_nine['diff']['before']['state'] == 'absent' + - test_nine['diff']['after']['state'] == 'present' + - test_nine['interface']['name'] == "Ethernet2/2" + - test_nine['interface']['device'] == 5 + - test_nine['interface']['enabled'] == true + - test_nine['interface']['type'] == "1000base-t" + +- name: "10 - Update interface on VC child" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: Test Nexus One + name: Ethernet2/2 + description: "Updated child interface from parent device" + update_vc_child: True + state: present + register: test_ten + +- name: "10 - ASSERT" + assert: + that: + - test_ten is changed + - test_ten['msg'] == "interface Ethernet2/2 updated" + - test_ten['diff']['after']['description'] == 'Updated child interface from parent device' + - test_ten['interface']['name'] == "Ethernet2/2" + - test_ten['interface']['device'] == 5 + - test_ten['interface']['enabled'] == true + - test_ten['interface']['type'] == "1000base-t" + - test_ten['interface']['description'] == 'Updated child interface from parent device' + +- name: "11 - Update interface on VC child w/o update_vc_child" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: Test Nexus One + name: Ethernet2/2 + description: "Updated child interface from parent device - test" + state: present + ignore_errors: yes + register: test_eleven + +- name: "11 - ASSERT" + assert: + that: + - test_eleven is failed + - test_eleven['msg'] == "Must set update_vc_child to True to allow child device interface modification" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_interface_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_interface_template.yml new file mode 100644 index 00000000..b6e98914 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_interface_template.yml @@ -0,0 +1,109 @@ +--- +## +## +### NETBOX_DEVICE_INTERFACE_TEMPLATE +## +## +- name: "1 - Interface with required information" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['msg'] == "interface_template 10GBASE-T (10GE) created" + - test_one['diff']['before']['state'] == 'absent' + - test_one['diff']['after']['state'] == 'present' + - test_one['interface_template']['name'] == "10GBASE-T (10GE)" + - test_one['interface_template']['device_type'] == 2 + - test_one['interface_template']['type'] == '10gbase-t' + +- name: "2 - Update 10GBASE-T (10GE)" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + mgmt_only: true + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - test_two is changed + - test_two['msg'] == "interface_template 10GBASE-T (10GE) updated" + - test_two['diff']['after']['mgmt_only'] == true + - test_two['interface_template']['name'] == "10GBASE-T (10GE)" + - test_two['interface_template']['device_type'] == 2 + - test_two['interface_template']['mgmt_only'] == true + +- name: "3 - Delete interface template 10GBASE-T (10GE)" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + state: absent + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['msg'] == "interface_template 10GBASE-T (10GE) deleted" + - test_three['diff']['before']['state'] == "present" + - test_three['diff']['after']['state'] == "absent" + +- name: "4 - Create LAG with several specified options" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device_type: Arista Test + name: port channel template + type: lag + mgmt_only: false + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['msg'] == "interface_template port channel template created" + - test_four['diff']['before']['state'] == 'absent' + - test_four['diff']['after']['state'] == 'present' + - test_four['interface_template']['name'] == "port channel template" + - test_four['interface_template']['device_type'] == 2 + - test_four['interface_template']['type'] == "lag" + - test_four['interface_template']['mgmt_only'] == false + +- name: "5 - Duplicate Interface Template port channel template" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device_type: Arista Test + name: port channel template + type: lag + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - not test_five['changed'] + - test_five['msg'] == "interface_template port channel template already exists" + - test_five['interface_template']['name'] == "port channel template" + - test_five['interface_template']['device_type'] == 2 + - test_five['interface_template']['type'] == "lag" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_role.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_role.yml new file mode 100644 index 00000000..64ec9840 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_role.yml @@ -0,0 +1,101 @@ +--- +## +## +### NETBOX_DEVICE_ROLE +## +## +- name: "DEVICE_ROLE 1: Necessary info creation" + netbox.netbox.netbox_device_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Device Role" + color: "FFFFFF" + state: present + register: test_one + +- name: "DEVICE_ROLE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['device_role']['name'] == "Test Device Role" + - test_one['device_role']['slug'] == "test-device-role" + - test_one['device_role']['color'] == "ffffff" + - test_one['msg'] == "device_role Test Device Role created" + +- name: "DEVICE_ROLE 2: Create duplicate" + netbox.netbox.netbox_device_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Device Role" + color: "FFFFFF" + state: present + register: test_two + +- name: "DEVICE_ROLE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['device_role']['name'] == "Test Device Role" + - test_two['device_role']['slug'] == "test-device-role" + - test_two['device_role']['color'] == "ffffff" + - test_two['msg'] == "device_role Test Device Role already exists" + +- name: "DEVICE_ROLE 3: ASSERT - Update" + netbox.netbox.netbox_device_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Device Role" + color: "003EFF" + vm_role: false + state: present + register: test_three + +- name: "DEVICE_ROLE 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['after']['color'] == "003eff" + - test_three['diff']['after']['vm_role'] == false + - test_three['device_role']['name'] == "Test Device Role" + - test_three['device_role']['slug'] == "test-device-role" + - test_three['device_role']['color'] == "003eff" + - test_three['device_role']['vm_role'] == false + - test_three['msg'] == "device_role Test Device Role updated" + +- name: "DEVICE_ROLE 4: ASSERT - Delete" + netbox.netbox.netbox_device_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Device Role + state: absent + register: test_four + +- name: "DEVICE_ROLE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "device_role Test Device Role deleted" + +- name: "DEVICE_ROLE 5: ASSERT - Delete non existing" + netbox.netbox.netbox_device_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Device Role + state: absent + register: test_five + +- name: "DEVICE_ROLE 5: ASSERT - Delete non existing`" + assert: + that: + - not test_five['changed'] + - test_five['device_role'] == None + - test_five['msg'] == "device_role Test Device Role already absent" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_type.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_type.yml new file mode 100644 index 00000000..6fd2c36a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_device_type.yml @@ -0,0 +1,131 @@ +--- +## +## +### NETBOX_DEVICE_TYPE +## +## +- name: "DEVICE_TYPE 1: Necessary info creation" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + slug: test-device-type + model: ws-test-3750 + manufacturer: Test Manufacturer + state: present + register: test_one + +- name: "DEVICE_TYPE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['device_type']['slug'] == "test-device-type" + - test_one['device_type']['model'] == "ws-test-3750" + - test_one['device_type']['manufacturer'] == 3 + - test_one['msg'] == "device_type test-device-type created" + +- name: "DEVICE_TYPE 2: Create duplicate" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + slug: test-device-type + model: "ws-test-3750" + manufacturer: Test Manufacturer + state: present + register: test_two + +- name: "DEVICE_TYPE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_one['device_type']['slug'] == "test-device-type" + - test_one['device_type']['model'] == "ws-test-3750" + - test_one['device_type']['manufacturer'] == 3 + - test_two['msg'] == "device_type test-device-type already exists" + +- name: "DEVICE_TYPE 3: ASSERT - Update" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + slug: test-device-type + model: ws-test-3750 + manufacturer: Test Manufacturer + part_number: ws-3750g-v2 + u_height: 1 + is_full_depth: false + subdevice_role: parent + state: present + register: test_three + +- name: "DEVICE_TYPE 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['after']['is_full_depth'] == false + - test_three['diff']['after']['part_number'] == "ws-3750g-v2" + - test_three['diff']['after']['subdevice_role'] == "parent" + - test_three['device_type']['slug'] == "test-device-type" + - test_three['device_type']['model'] == "ws-test-3750" + - test_three['device_type']['manufacturer'] == 3 + - test_three['device_type']['is_full_depth'] == false + - test_three['device_type']['part_number'] == "ws-3750g-v2" + - test_three['device_type']['subdevice_role'] == "parent" + - test_three['msg'] == "device_type test-device-type updated" + +- name: "DEVICE_TYPE 4: ASSERT - Delete" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + model: test-device-type + state: absent + register: test_four + +- name: "DEVICE_TYPE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "device_type test-device-type deleted" + +- name: "DEVICE_TYPE 5: ASSERT - Delete non existing" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + model: "Test Device Type" + state: absent + register: test_five + +- name: "DEVICE_TYPE 5: ASSERT - Delete non existing`" + assert: + that: + - not test_five['changed'] + - test_five['device_type'] == None + - test_five['msg'] == "device_type Test Device Type already absent" + +- name: "DEVICE_TYPE 6: Without Slug" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + model: "WS Test 3850" + manufacturer: Test Manufacturer + state: present + register: test_six + +- name: "DEVICE_TYPE 6: ASSERT - Without Slug" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "absent" + - test_six['diff']['after']['state'] == "present" + - test_six['device_type']['slug'] == "ws-test-3850" + - test_six['device_type']['model'] == "WS Test 3850" + - test_six['device_type']['manufacturer'] == 3 + - test_six['msg'] == "device_type WS Test 3850 created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_front_port.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_front_port.yml new file mode 100644 index 00000000..1f4c60a4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_front_port.yml @@ -0,0 +1,150 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_FRONT_PORT +## +## +- name: "FRONT_PORT 1: Necessary info creation" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port + device: test100 + type: bnc + rear_port: Rear Port + state: present + register: test_one + +- name: "FRONT_PORT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['front_port']['name'] == "Front Port" + - test_one['front_port']['device'] == 1 + - test_one['front_port']['type'] == "bnc" + - test_one['front_port']['rear_port'] == 1 + - test_one['msg'] == "front_port Front Port created" + +- name: "FRONT_PORT 2: Create duplicate" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port + device: test100 + type: bnc + rear_port: Rear Port + state: present + register: test_two + +- name: "FRONT_PORT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['front_port']['name'] == "Front Port" + - test_two['front_port']['device'] == 1 + - test_two['front_port']['type'] == "bnc" + - test_two['front_port']['rear_port'] == 1 + - test_two['msg'] == "front_port Front Port already exists" + +- name: "FRONT_PORT 3: Update Front Port with other fields" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port + device: test100 + type: bnc + rear_port: Rear Port + rear_port_position: 5 + description: test description + state: present + register: test_three + +- name: "FRONT_PORT 3: ASSERT - Update Front Port with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['rear_port_position'] == 5 + - test_three['diff']['after']['description'] == "test description" + - test_three['front_port']['name'] == "Front Port" + - test_three['front_port']['device'] == 1 + - test_three['front_port']['type'] == "bnc" + - test_three['front_port']['rear_port'] == 1 + - test_three['front_port']['rear_port_position'] == 5 + - test_three['front_port']['description'] == "test description" + - test_three['msg'] == "front_port Front Port updated" + +- name: "FRONT_PORT 4: Create Front Port for Delete Test" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port 2 + device: test100 + type: bnc + rear_port: Rear Port + state: present + register: test_four + +- name: "FRONT_PORT 4: ASSERT - Create Front Port for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['front_port']['name'] == "Front Port 2" + - test_four['front_port']['device'] == 1 + - test_four['front_port']['type'] == "bnc" + - test_four['front_port']['rear_port'] == 1 + - test_four['msg'] == "front_port Front Port 2 created" + +- name: "FRONT_PORT 5: Delete Front Port" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port 2 + device: test100 + type: bnc + rear_port: Rear Port + state: absent + register: test_five + +- name: "FRONT_PORT 5: ASSERT - Delete Front Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "front_port Front Port 2 deleted" + +- name: "FRONT_PORT 6: Create duplicate with rear_port dictionary" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port + device: test100 + type: bnc + rear_port: + device: test100 + name: Rear Port + state: present + register: test_six + +- name: "FRONT_PORT 6: ASSERT - Create duplicate with rear_port dictionary" + assert: + that: + - not test_six['changed'] + - test_six['front_port']['name'] == "Front Port" + - test_six['front_port']['device'] == 1 + - test_six['front_port']['type'] == "bnc" + - test_six['front_port']['rear_port'] == 1 + - test_six['msg'] == "front_port Front Port already exists" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_front_port_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_front_port_template.yml new file mode 100644 index 00000000..30e90710 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_front_port_template.yml @@ -0,0 +1,147 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_FRONT_PORT_TEMPLATE +## +## +- name: "FRONT_PORT_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: Rear Port Template + state: present + register: test_one + +- name: "FRONT_PORT_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['front_port_template']['name'] == "Front Port Template" + - test_one['front_port_template']['device_type'] == 1 + - test_one['front_port_template']['type'] == "bnc" + - test_one['front_port_template']['rear_port'] == 1 + - test_one['msg'] == "front_port_template Front Port Template created" + +- name: "FRONT_PORT_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: Rear Port Template + state: present + register: test_two + +- name: "FRONT_PORT_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['front_port_template']['name'] == "Front Port Template" + - test_two['front_port_template']['device_type'] == 1 + - test_two['front_port_template']['type'] == "bnc" + - test_two['front_port_template']['rear_port'] == 1 + - test_two['msg'] == "front_port_template Front Port Template already exists" + +- name: "FRONT_PORT_TEMPLATE 3: Update Front Port Template with other fields" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: Rear Port Template + rear_port_template_position: 5 + state: present + register: test_three + +- name: "FRONT_PORT_TEMPLATE 3: ASSERT - Update Front Port Template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['rear_port_position'] == 5 + - test_three['front_port_template']['name'] == "Front Port Template" + - test_three['front_port_template']['device_type'] == 1 + - test_three['front_port_template']['type'] == "bnc" + - test_three['front_port_template']['rear_port_position'] == 5 + - test_three['front_port_template']['rear_port'] == 1 + - test_three['msg'] == "front_port_template Front Port Template updated" + +- name: "FRONT_PORT_TEMPLATE 4: Create Front Port Template for Delete Test" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template 2 + device_type: Cisco Test + type: bnc + rear_port_template: Rear Port Template + state: present + register: test_four + +- name: "FRONT_PORT_TEMPLATE 4: ASSERT - Create Front Port Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['front_port_template']['name'] == "Front Port Template 2" + - test_four['front_port_template']['device_type'] == 1 + - test_four['front_port_template']['type'] == "bnc" + - test_four['front_port_template']['rear_port'] == 1 + - test_four['msg'] == "front_port_template Front Port Template 2 created" + +- name: "FRONT_PORT_TEMPLATE 5: Delete Front Port Template" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template 2 + device_type: Cisco Test + type: bnc + rear_port_template: Rear Port Template + state: absent + register: test_five + +- name: "FRONT_PORT_TEMPLATE 5: ASSERT - Delete Front Port Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "front_port_template Front Port Template 2 deleted" + +- name: "FRONT_PORT 6: Create duplicate with rear_port_template dictionary" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: + device: Cisco Test + name: Rear Port Template + state: present + register: test_six + +- name: "FRONT_PORT 6: ASSERT - Create duplicate with rear_port_template dictionary" + assert: + that: + - not test_six['changed'] + - test_six['front_port_template']['name'] == "Front Port Template" + - test_six['front_port_template']['device_type'] == 1 + - test_six['front_port_template']['type'] == "bnc" + - test_six['front_port_template']['rear_port'] == 1 + - test_six['msg'] == "front_port_template Front Port Template already exists" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_inventory_item.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_inventory_item.yml new file mode 100644 index 00000000..d551b2fa --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_inventory_item.yml @@ -0,0 +1,107 @@ +--- +## +## +### NETBOX_INVENTORY_ITEM +## +## +- name: "INVENTORY_ITEM 1: Necessary info creation" + netbox.netbox.netbox_inventory_item: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "test100" + name: "10G-SFP+" + state: present + register: test_one + +- name: "INVENTORY_ITEM 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['inventory_item']['name'] == "10G-SFP+" + - test_one['inventory_item']['device'] == 1 + - test_one['msg'] == "inventory_item 10G-SFP+ created" + +- name: "INVENTORY_ITEM 2: Create duplicate" + netbox.netbox.netbox_inventory_item: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "test100" + name: "10G-SFP+" + state: present + register: test_two + +- name: "INVENTORY_ITEM 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['inventory_item']['name'] == "10G-SFP+" + - test_two['inventory_item']['device'] == 1 + - test_two['msg'] == "inventory_item 10G-SFP+ already exists" + +- name: "INVENTORY_ITEM 3: ASSERT - Update" + netbox.netbox.netbox_inventory_item: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "test100" + name: "10G-SFP+" + manufacturer: "Cisco" + part_id: "10G-SFP+" + serial: "1234" + asset_tag: "1234" + description: "New SFP" + discovered: True + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "INVENTORY_ITEM 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['asset_tag'] == "1234" + - test_three['diff']['after']['serial'] == "1234" + - test_three['diff']['after']['description'] == "New SFP" + - test_three['diff']['after']['manufacturer'] == 1 + - test_three['diff']['after']['part_id'] == "10G-SFP+" + - test_three['diff']['after']['tags'][0] == 4 + - test_three['diff']['after']['discovered'] == True + - test_three['inventory_item']['name'] == "10G-SFP+" + - test_three['inventory_item']['device'] == 1 + - test_three['inventory_item']['asset_tag'] == "1234" + - test_three['inventory_item']['serial'] == "1234" + - test_three['inventory_item']['description'] == "New SFP" + - test_three['inventory_item']['manufacturer'] == 1 + - test_three['inventory_item']['part_id'] == "10G-SFP+" + - test_three['inventory_item']['tags'][0] == 4 + - test_three['inventory_item']['discovered'] == True + - test_three['msg'] == "inventory_item 10G-SFP+ updated" + +- name: "INVENTORY_ITEM 4: ASSERT - Delete" + netbox.netbox.netbox_inventory_item: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "test100" + name: "10G-SFP+" + state: absent + register: test_four + +- name: "INVENTORY_ITEM 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['inventory_item']['name'] == "10G-SFP+" + - test_four['inventory_item']['device'] == 1 + - test_four['inventory_item']['asset_tag'] == "1234" + - test_four['inventory_item']['serial'] == "1234" + - test_four['inventory_item']['description'] == "New SFP" + - test_four['inventory_item']['manufacturer'] == 1 + - test_four['inventory_item']['part_id'] == "10G-SFP+" + - test_four['inventory_item']['tags'][0] == 4 + - test_four['msg'] == "inventory_item 10G-SFP+ deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_ip_address.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_ip_address.yml new file mode 100644 index 00000000..fcee6961 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_ip_address.yml @@ -0,0 +1,350 @@ +--- +## +## +### NETBOX_IP_ADDRESS +## +## +- name: "1 - Create IP address within Netbox with only required information - State: Present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.1.10/30 + state: present + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['msg'] == "ip_address 192.168.1.10/30 created" + - test_one['ip_address']['address'] == "192.168.1.10/30" + +- name: "2 - Update 192.168.1.10/30" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.1.10/30 + description: "Updated ip address" + tags: + - "Updated" + state: present + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - test_two is changed + - test_two['diff']['after']['description'] == "Updated ip address" + - test_two['diff']['after']['tags'][0] == 10 + - test_two['msg'] == "ip_address 192.168.1.10/30 updated" + - test_two['ip_address']['address'] == "192.168.1.10/30" + - test_two['ip_address']['tags'][0] == 10 + - test_two['ip_address']['description'] == "Updated ip address" + +- name: "3 - Delete IP - 192.168.1.10 - State: Absent" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.1.10/30 + state: absent + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "present" + - test_three['diff']['after']['state'] == "absent" + - test_three['msg'] == "ip_address 192.168.1.10/30 deleted" + +- name: "4 - Create IP in global VRF - 192.168.1.20/30 - State: Present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.1.20/30 + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['msg'] == "ip_address 192.168.1.20/30 created" + - test_four['ip_address']['address'] == "192.168.1.20/30" + +- name: "5 - Create IP in global VRF - 192.168.1.20/30 - State: New" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.1.20/30 + state: new + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['msg'] == "ip_address 192.168.1.20/30 created" + - test_five['ip_address']['address'] == "192.168.1.20/30" + +- name: "6 - Create new address with only prefix specified - State: new" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 192.168.100.0/24 + state: new + register: test_six + +- name: "6 - ASSERT" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "absent" + - test_six['diff']['after']['state'] == "present" + - test_six['msg'] == "ip_address 192.168.100.1/24 created" + - test_six['ip_address']['address'] == "192.168.100.1/24" + +- name: "7 - Create IP address with several specified" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + address: 172.16.1.20/24 + vrf: Test VRF + tenant: Test Tenant + status: Reserved + role: Loopback + description: Test description + tags: + - "Schnozzberry" + state: present + register: test_seven + +- name: "7 - ASSERT" + assert: + that: + - test_seven is changed + - test_seven['diff']['before']['state'] == "absent" + - test_seven['diff']['after']['state'] == "present" + - test_seven['msg'] == "ip_address 172.16.1.20/24 created" + - test_seven['ip_address']['address'] == "172.16.1.20/24" + - test_seven['ip_address']['description'] == "Test description" + - test_seven['ip_address']['family'] == 4 + - test_seven['ip_address']['role'] == "loopback" + - test_seven['ip_address']['status'] == "reserved" + - test_seven['ip_address']['tags'][0] == 4 + - test_seven['ip_address']['tenant'] == 1 + - test_seven['ip_address']['vrf'] == 1 + +- name: "8 - Create IP address and assign a nat_inside IP" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + address: 10.10.1.30/16 + vrf: Test VRF + nat_inside: + address: 172.16.1.20 + vrf: Test VRF + register: test_eight + +- name: "8 - ASSERT" + assert: + that: + - test_eight is changed + - test_eight['diff']['before']['state'] == "absent" + - test_eight['diff']['after']['state'] == "present" + - test_eight['msg'] == "ip_address 10.10.1.30/16 created" + - test_eight['ip_address']['address'] == "10.10.1.30/16" + - test_eight['ip_address']['family'] == 4 + - test_eight['ip_address']['nat_inside'] == 11 + - test_eight['ip_address']['vrf'] == 1 + +- name: "9 - Create IP address on GigabitEthernet2 - test100 - State: present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + address: 10.10.200.30/16 + assigned_object: + name: GigabitEthernet2 + device: test100 + register: test_nine + +- name: "9 - ASSERT" + assert: + that: + - test_nine is changed + - test_nine['diff']['before']['state'] == "absent" + - test_nine['diff']['after']['state'] == "present" + - test_nine['msg'] == "ip_address 10.10.200.30/16 created" + - test_nine['ip_address']['address'] == "10.10.200.30/16" + - test_nine['ip_address']['family'] == 4 + - test_nine['ip_address']['assigned_object_type'] == "dcim.interface" + - test_nine['ip_address']['assigned_object_id'] == 4 + +- name: "10 - Create IP address on GigabitEthernet2 - test100 - State: new" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + prefix: 10.10.0.0/16 + assigned_object: + name: GigabitEthernet2 + device: test100 + state: new + register: test_ten + +- name: "10 - ASSERT" + assert: + that: + - test_ten is changed + - test_ten['diff']['before']['state'] == "absent" + - test_ten['diff']['after']['state'] == "present" + - test_ten['msg'] == "ip_address 10.10.0.1/16 created" + - test_ten['ip_address']['address'] == "10.10.0.1/16" + - test_ten['ip_address']['family'] == 4 + - test_ten['ip_address']['assigned_object_type'] == "dcim.interface" + - test_ten['ip_address']['assigned_object_id'] == 4 + +- name: "11 - Create IP address on GigabitEthernet2 - test100 - State: present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + prefix: 192.168.100.0/24 + assigned_object: + name: GigabitEthernet2 + device: test100 + state: present + register: test_eleven + +- name: "11 - ASSERT" + assert: + that: + - test_eleven is changed + - test_eleven['diff']['before']['state'] == "absent" + - test_eleven['diff']['after']['state'] == "present" + - test_eleven['msg'] == "ip_address 192.168.100.2/24 created" + - test_eleven['ip_address']['address'] == "192.168.100.2/24" + +- name: "12 - Duplicate - 192.168.100.2/24 on interface" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.100.2/24 + assigned_object: + name: GigabitEthernet2 + device: test100 + state: present + register: test_twelve + +- name: "12 - ASSERT" + assert: + that: + - not test_twelve['changed'] + - test_twelve['msg'] == "ip_address 192.168.100.2/24 already exists" + - test_twelve['ip_address']['address'] == "192.168.100.2/24" + - test_twelve['ip_address']['assigned_object_type'] == "dcim.interface" + - test_twelve['ip_address']['assigned_object_id'] == 4 + +- name: "13 - Duplicate - 192.168.100.2/24" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.100.2/24 + state: present + register: test_thirteen + +- name: "13 - ASSERT" + assert: + that: + - not test_thirteen['changed'] + - test_thirteen['msg'] == "ip_address 192.168.100.2/24 already exists" + - test_thirteen['ip_address']['address'] == "192.168.100.2/24" + +- name: "14 - Create IP address on Eth0 - test100-vm - State: present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + address: 10.188.1.100/24 + assigned_object: + name: Eth0 + virtual_machine: test100-vm + register: test_fourteen + +- name: "14 - ASSERT" + assert: + that: + - test_fourteen is changed + - test_fourteen['diff']['before']['state'] == "absent" + - test_fourteen['diff']['after']['state'] == "present" + - test_fourteen['msg'] == "ip_address 10.188.1.100/24 created" + - test_fourteen['ip_address']['address'] == "10.188.1.100/24" + - test_fourteen['ip_address']['family'] == 4 + - test_fourteen['ip_address']['assigned_object_type'] == "virtualization.vminterface" + - test_fourteen['ip_address']['assigned_object_id'] == 1 + +- name: "15 - Create same IP address on Eth0 - test101-vm - State: present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + address: 10.188.1.100/24 + assigned_object: + name: Eth0 + virtual_machine: test101-vm + state: "present" + register: test_fifteen + +- name: "15 - ASSERT" + assert: + that: + - test_fifteen is changed + - test_fifteen['diff']['before']['state'] == "absent" + - test_fifteen['diff']['after']['state'] == "present" + - test_fifteen['msg'] == "ip_address 10.188.1.100/24 created" + - test_fifteen['ip_address']['address'] == "10.188.1.100/24" + - test_fifteen['ip_address']['family'] == 4 + - test_fifteen['ip_address']['assigned_object_type'] == "virtualization.vminterface" + - test_fifteen['ip_address']['assigned_object_id'] == 6 + +- name: "16 - Create IP address with no mask - State: Present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 10.120.10.1 + state: present + register: test_sixteen + +- name: "16 - ASSERT" + assert: + that: + - test_sixteen is changed + - test_sixteen['diff']['before']['state'] == "absent" + - test_sixteen['diff']['after']['state'] == "present" + - test_sixteen['msg'] == "ip_address 10.120.10.1/32 created" + - test_sixteen['ip_address']['address'] == "10.120.10.1/32" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_ipam_role.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_ipam_role.yml new file mode 100644 index 00000000..1f1ff0f3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_ipam_role.yml @@ -0,0 +1,94 @@ +--- +## +## +### NETBOX_IPAM_ROLE +## +## +- name: "IPAM_ROLE 1: Necessary info creation" + netbox.netbox.netbox_ipam_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test IPAM Role" + state: present + register: test_one + +- name: "IPAM_ROLE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['role']['name'] == "Test IPAM Role" + - test_one['role']['slug'] == "test-ipam-role" + - test_one['msg'] == "role Test IPAM Role created" + +- name: "IPAM_ROLE 2: Create duplicate" + netbox.netbox.netbox_ipam_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test IPAM Role" + state: present + register: test_two + +- name: "IPAM_ROLE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['role']['name'] == "Test IPAM Role" + - test_two['role']['slug'] == "test-ipam-role" + - test_two['msg'] == "role Test IPAM Role already exists" + +- name: "IPAM_ROLE 3: ASSERT - Update" + netbox.netbox.netbox_ipam_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test IPAM Role" + weight: 4096 + state: present + register: test_three + +- name: "IPAM_ROLE 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['after']['weight'] == 4096 + - test_three['role']['name'] == "Test IPAM Role" + - test_three['role']['slug'] == "test-ipam-role" + - test_three['role']['weight'] == 4096 + - test_three['msg'] == "role Test IPAM Role updated" + +- name: "IPAM_ROLE 4: ASSERT - Delete" + netbox.netbox.netbox_ipam_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test IPAM Role + state: absent + register: test_four + +- name: "IPAM_ROLE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "role Test IPAM Role deleted" + +- name: "IPAM_ROLE 5: ASSERT - Delete non existing" + netbox.netbox.netbox_ipam_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test IPAM Role + state: absent + register: test_five + +- name: "IPAM_ROLE 5: ASSERT - Delete non existing`" + assert: + that: + - not test_five['changed'] + - test_five['role'] == None + - test_five['msg'] == "role Test IPAM Role already absent" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_lookup.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_lookup.yml new file mode 100644 index 00000000..3217f1c7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_lookup.yml @@ -0,0 +1,82 @@ +--- +## +## +### NETBOX_LOOKUP +## +## +- name: "NETBOX_LOOKUP 1: Lookup returns exactly two sites" + assert: + that: "{{ query_result|count }} == 3" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'sites', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + +- name: "NETBOX_LOOKUP 2: Query doesn't return Wibble (sanity check json_query)" + assert: + that: "{{ query_result|json_query('[?value.display_name==`Wibble`]')|count }} == 0" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'devices', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + +- name: "NETBOX_LOOKUP 3: Device query returns exactly one TestDeviceR1" + assert: + that: "{{ query_result|json_query('[?value.display_name==`TestDeviceR1`]')|count }} == 1" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'devices', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + +- name: "NETBOX_LOOKUP 4: VLAN ID 400 can be queried and is named 'Test VLAN'" + assert: + that: "{{ (query_result|json_query('[?value.vid==`400`].value.name'))[0] == 'Test VLAN' }}" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'vlans', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + +- name: "NETBOX_LOOKUP 5: Add one of two devices for lookup filter test." + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "L1" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + tags: + - "nolookup" + state: present + +- name: "NETBOX_LOOKUP 6: Add two of two devices for lookup filter test." + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "L2" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site2" + status: "Staged" + tags: + - "lookup" + state: present + +- name: "NETBOX_LOOKUP 7: Device query returns exactly the L2 device" + assert: + that: "{{ query_result|json_query('[?value.display_name==`L2`]')|count }} == 1" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'devices', api_filter='role=core-switch tag=lookup', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + +- name: "NETBOX_LOOKUP 8: Device query specifying raw data returns payload without key/value dict" + assert: + that: "{{ query_result|json_query('[?display_name==`L2`]')|count }} == 1" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'devices', api_filter='role=core-switch tag=lookup', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567', raw_data=True) }}" + +- name: "NETBOX_LOOKUP 9: Device query specifying multiple sites, Make sure L1 and L2 are in the results" + assert: + that: + - "'L1' in {{ query_result |json_query('[*].display_name') }}" + - "'L2' in {{ query_result |json_query('[*].display_name') }}" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'devices', api_filter='role=core-switch site=test-site site=test-site2', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567', raw_data=True) }}" + +- name: "NETBOX_LOOKUP 10: Device query by ID" + assert: + that: + - "{{ query('netbox.netbox.nb_lookup', 'devices', api_filter='id=1', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_manufacturer.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_manufacturer.yml new file mode 100644 index 00000000..4dd1907e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_manufacturer.yml @@ -0,0 +1,91 @@ +--- +## +## +### NETBOX_MANUFACTURER +## +## +- name: "MANUFACTURER 1: Necessary info creation" + netbox.netbox.netbox_manufacturer: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Manufacturer Two + state: present + register: test_one + +- name: "MANUFACTURER 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['manufacturer']['name'] == "Test Manufacturer Two" + - test_one['manufacturer']['slug'] == "test-manufacturer-two" + - test_one['msg'] == "manufacturer Test Manufacturer Two created" + +- name: "MANUFACTURER 2: Create duplicate" + netbox.netbox.netbox_manufacturer: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Manufacturer Two + state: present + register: test_two + +- name: "MANUFACTURER 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['manufacturer']['name'] == "Test Manufacturer Two" + - test_two['manufacturer']['slug'] == "test-manufacturer-two" + - test_two['msg'] == "manufacturer Test Manufacturer Two already exists" + +- name: "MANUFACTURER 3: Update" + netbox.netbox.netbox_manufacturer: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: test manufacturer two + state: present + register: test_three + +- name: "MANUFACTURER 3: ASSERT - Update" + assert: + that: + - test_three['changed'] + - test_three['manufacturer']['name'] == "test manufacturer two" + - test_three['manufacturer']['slug'] == "test-manufacturer-two" + - test_three['msg'] == "manufacturer test manufacturer two updated" + +- name: "MANUFACTURER 4: ASSERT - Delete" + netbox.netbox.netbox_manufacturer: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: test manufacturer two + state: absent + register: test_four + +- name: "MANUFACTURER 3: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "manufacturer test manufacturer two deleted" + +- name: "MANUFACTURER 5: ASSERT - Delete non existing" + netbox.netbox.netbox_manufacturer: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Manufacturer Two + state: absent + register: test_five + +- name: "MANUFACTURER 5: ASSERT - Delete non existing" + assert: + that: + - not test_five['changed'] + - test_five['manufacturer'] == None + - test_five['msg'] == "manufacturer Test Manufacturer Two already absent" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_platform.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_platform.yml new file mode 100644 index 00000000..95ccdb4c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_platform.yml @@ -0,0 +1,99 @@ +--- +## +## +### NETBOX_PLATFORM +## +## +- name: "PLATFORM 1: Necessary info creation" + netbox.netbox.netbox_platform: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Platform + state: present + register: test_one + +- name: "PLATFORM 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['platform']['name'] == "Test Platform" + - test_one['platform']['slug'] == "test-platform" + - test_one['msg'] == "platform Test Platform created" + +- name: "PLATFORM 2: Create duplicate" + netbox.netbox.netbox_platform: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Platform + state: present + register: test_two + +- name: "PLATFORM 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['platform']['name'] == "Test Platform" + - test_two['platform']['slug'] == "test-platform" + - test_two['msg'] == "platform Test Platform already exists" + +- name: "PLATFORM 3: ASSERT - Update" + netbox.netbox.netbox_platform: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Platform + manufacturer: Test Manufacturer + napalm_driver: ios + napalm_args: + global_delay_factor: 2 + state: present + register: test_three + +- name: "PLATFORM 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['after']['manufacturer'] == 3 + - test_three['diff']['after']['napalm_args']['global_delay_factor'] == 2 + - test_three['diff']['after']['napalm_driver'] == "ios" + - test_three['platform']['manufacturer'] == 3 + - test_three['platform']['napalm_args']['global_delay_factor'] == 2 + - test_three['platform']['napalm_driver'] == "ios" + - test_three['msg'] == "platform Test Platform updated" + +- name: "PLATFORM 4: ASSERT - Delete" + netbox.netbox.netbox_platform: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Platform + state: absent + register: test_four + +- name: "PLATFORM 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "platform Test Platform deleted" + +- name: "PLATFORM 5: ASSERT - Delete non existing" + netbox.netbox.netbox_platform: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Platform + state: absent + register: test_five + +- name: "PLATFORM 5: ASSERT - Delete non existing`" + assert: + that: + - not test_five['changed'] + - test_five['platform'] == None + - test_five['msg'] == "platform Test Platform already absent" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_feed.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_feed.yml new file mode 100644 index 00000000..a02fd912 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_feed.yml @@ -0,0 +1,127 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_FEED +## +## +- name: "POWER_FEED 1: Necessary info creation" + netbox.netbox.netbox_power_feed: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Feed + power_panel: Power Panel + state: present + register: test_one + +- name: "POWER_FEED 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_feed']['name'] == "Power Feed" + - test_one['power_feed']['power_panel'] == 1 + - test_one['msg'] == "power_feed Power Feed created" + +- name: "POWER_FEED 2: Create duplicate" + netbox.netbox.netbox_power_feed: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Feed + power_panel: Power Panel + state: present + register: test_two + +- name: "POWER_FEED 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_feed']['name'] == "Power Feed" + - test_two['power_feed']['power_panel'] == 1 + - test_two['msg'] == "power_feed Power Feed already exists" + +- name: "POWER_FEED 3: Update power_feed with other fields" + netbox.netbox.netbox_power_feed: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Feed + power_panel: Power Panel + status: offline + type: redundant + supply: dc + phase: three-phase + voltage: 400 + amperage: 32 + max_utilization: 25 + comments: totally normal power feed + state: present + register: test_three + +- name: "POWER_FEED 3: ASSERT - Update power_feed with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['status'] == "offline" + - test_three['diff']['after']['type'] == "redundant" + - test_three['diff']['after']['supply'] == "dc" + - test_three['diff']['after']['phase'] == "three-phase" + - test_three['diff']['after']['voltage'] == 400 + - test_three['diff']['after']['amperage'] == 32 + - test_three['diff']['after']['max_utilization'] == 25 + - test_three['diff']['after']['comments'] == "totally normal power feed" + - test_three['power_feed']['name'] == "Power Feed" + - test_three['power_feed']['power_panel'] == 1 + - test_three['power_feed']['status'] == "offline" + - test_three['power_feed']['type'] == "redundant" + - test_three['power_feed']['supply'] == "dc" + - test_three['power_feed']['phase'] == "three-phase" + - test_three['power_feed']['voltage'] == 400 + - test_three['power_feed']['amperage'] == 32 + - test_three['power_feed']['max_utilization'] == 25 + - test_three['power_feed']['comments'] == "totally normal power feed" + - test_three['msg'] == "power_feed Power Feed updated" + +- name: "POWER_FEED 4: Create Power Feed for Delete Test" + netbox.netbox.netbox_power_feed: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Feed 2 + power_panel: Power Panel + state: present + register: test_four + +- name: "POWER_FEED 4: ASSERT - Create Power Feed for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_feed']['name'] == "Power Feed 2" + - test_four['power_feed']['power_panel'] == 1 + - test_four['msg'] == "power_feed Power Feed 2 created" + + +- name: "POWER_FEED 5: Delete Power Feed" + netbox.netbox.netbox_power_feed: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Feed 2 + power_panel: Power Panel + state: absent + register: test_five + +- name: "POWER_FEED 5: ASSERT - Delete Power Feed" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_feed Power Feed 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_outlet.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_outlet.yml new file mode 100644 index 00000000..c7b5f7d3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_outlet.yml @@ -0,0 +1,114 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_OUTLET +## +## +- name: "POWER_OUTLET 1: Necessary info creation" + netbox.netbox.netbox_power_outlet: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet + device: Device Power Tests + state: present + register: test_one + +- name: "POWER_OUTLET 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_outlet']['name'] == "Power Outlet" + - test_one['power_outlet']['device'] == 10 + - test_one['msg'] == "power_outlet Power Outlet created" + +- name: "POWER_OUTLET 2: Create duplicate" + netbox.netbox.netbox_power_outlet: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet + device: Device Power Tests + state: present + register: test_two + +- name: "POWER_OUTLET 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_outlet']['name'] == "Power Outlet" + - test_two['power_outlet']['device'] == 10 + - test_two['msg'] == "power_outlet Power Outlet already exists" + +- name: "POWER_OUTLET 3: Update power_outlet with other fields" + netbox.netbox.netbox_power_outlet: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet + device: Device Power Tests + type: ita-e + power_port: Power Port + feed_leg: B + description: test description + state: present + register: test_three + +- name: "POWER_OUTLET 3: ASSERT - Update power_outlet with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "ita-e" + - test_three['diff']['after']['power_port'] == 1 + - test_three['diff']['after']['feed_leg'] == "B" + - test_three['diff']['after']['description'] == "test description" + - test_three['power_outlet']['name'] == "Power Outlet" + - test_three['power_outlet']['device'] == 10 + - test_three['power_outlet']['type'] == "ita-e" + - test_three['power_outlet']['power_port'] == 1 + - test_three['power_outlet']['feed_leg'] == "B" + - test_three['power_outlet']['description'] == "test description" + - test_three['msg'] == "power_outlet Power Outlet updated" + +- name: "POWER_OUTLET 4: Create Power Outlet for Delete Test" + netbox.netbox.netbox_power_outlet: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet 2 + device: Device Power Tests + state: present + register: test_four + +- name: "POWER_OUTLET 4: ASSERT - Create Power Outlet for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_outlet']['name'] == "Power Outlet 2" + - test_four['power_outlet']['device'] == 10 + - test_four['msg'] == "power_outlet Power Outlet 2 created" + +- name: "POWER_OUTLET 5: Delete Power Outlet" + netbox.netbox.netbox_power_outlet: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet 2 + device: Device Power Tests + state: absent + register: test_five + +- name: "POWER_OUTLET 5: ASSERT - Delete Power Outlet" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_outlet Power Outlet 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_outlet_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_outlet_template.yml new file mode 100644 index 00000000..654830c1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_outlet_template.yml @@ -0,0 +1,111 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_OUTLET_TEMPLATE +## +## +- name: "POWER_OUTLET_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_power_outlet_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet Template + device_type: Device Type Power Tests + state: present + register: test_one + +- name: "POWER_OUTLET_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_outlet_template']['name'] == "Power Outlet Template" + - test_one['power_outlet_template']['device_type'] == 8 + - test_one['msg'] == "power_outlet_template Power Outlet Template created" + +- name: "POWER_OUTLET_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_power_outlet_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet Template + device_type: Device Type Power Tests + state: present + register: test_two + +- name: "POWER_OUTLET_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_outlet_template']['name'] == "Power Outlet Template" + - test_two['power_outlet_template']['device_type'] == 8 + - test_two['msg'] == "power_outlet_template Power Outlet Template already exists" + +- name: "POWER_OUTLET_TEMPLATE 3: Update power_outlet_template with other fields" + netbox.netbox.netbox_power_outlet_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet Template + device_type: Device Type Power Tests + type: ita-e + power_port: Power Port + feed_leg: B + state: present + register: test_three + +- name: "POWER_OUTLET_TEMPLATE 3: ASSERT - Update power_outlet_template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "ita-e" + - test_three['diff']['after']['power_port'] == 1 + - test_three['diff']['after']['feed_leg'] == "B" + - test_three['power_outlet_template']['name'] == "Power Outlet Template" + - test_three['power_outlet_template']['device_type'] == 8 + - test_three['power_outlet_template']['type'] == "ita-e" + - test_three['power_outlet_template']['power_port'] == 1 + - test_three['power_outlet_template']['feed_leg'] == "B" + - test_three['msg'] == "power_outlet_template Power Outlet Template updated" + +- name: "POWER_OUTLET_TEMPLATE 4: Create Power Outlet Template for Delete Test" + netbox.netbox.netbox_power_outlet_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet Template 2 + device_type: Device Type Power Tests + state: present + register: test_four + +- name: "POWER_OUTLET_TEMPLATE 4: ASSERT - Create Power Outlet Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_outlet_template']['name'] == "Power Outlet Template 2" + - test_four['power_outlet_template']['device_type'] == 8 + - test_four['msg'] == "power_outlet_template Power Outlet Template 2 created" + +- name: "POWER_OUTLET_TEMPLATE 5: Delete Power Outlet Template" + netbox.netbox.netbox_power_outlet_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet Template 2 + device_type: Device Type Power Tests + state: absent + register: test_five + +- name: "POWER_OUTLET_TEMPLATE 5: ASSERT - Delete Power Outlet Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_outlet_template Power Outlet Template 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_panel.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_panel.yml new file mode 100644 index 00000000..6083a1c4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_panel.yml @@ -0,0 +1,106 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_PANEL +## +## +- name: "POWER_PANEL 1: Necessary info creation" + netbox.netbox.netbox_power_panel: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Panel + site: Test Site + state: present + register: test_one + +- name: "POWER_PANEL 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_panel']['name'] == "Power Panel" + - test_one['power_panel']['site'] == 1 + - test_one['msg'] == "power_panel Power Panel created" + +- name: "POWER_PANEL 2: Create duplicate" + netbox.netbox.netbox_power_panel: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Panel + site: Test Site + state: present + register: test_two + +- name: "POWER_PANEL 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_panel']['name'] == "Power Panel" + - test_two['power_panel']['site'] == 1 + - test_two['msg'] == "power_panel Power Panel already exists" + +- name: "POWER_PANEL 3: Update power_panel with other fields" + netbox.netbox.netbox_power_panel: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Panel + site: Test Site + rack_group: Test Rack Group + state: present + register: test_three + +- name: "POWER_PANEL 3: ASSERT - Update power_panel with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['rack_group'] == 1 + - test_three['power_panel']['name'] == "Power Panel" + - test_three['power_panel']['site'] == 1 + - test_three['power_panel']['rack_group'] == 1 + - test_three['msg'] == "power_panel Power Panel updated" + +- name: "POWER_PANEL 4: Create Power Panel for Delete Test" + netbox.netbox.netbox_power_panel: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Panel 2 + site: Test Site + state: present + register: test_four + +- name: "POWER_PANEL 4: ASSERT - Create Power Panel for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_panel']['name'] == "Power Panel 2" + - test_four['power_panel']['site'] == 1 + - test_four['msg'] == "power_panel Power Panel 2 created" + + +- name: "POWER_PANEL 5: Delete Power Panel" + netbox.netbox.netbox_power_panel: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Panel 2 + site: Test Site + state: absent + register: test_five + +- name: "POWER_PANEL 5: ASSERT - Delete Power Panel" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_panel Power Panel 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_port.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_port.yml new file mode 100644 index 00000000..b6368bd9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_port.yml @@ -0,0 +1,125 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_PORT +## +## +- name: "POWER_PORT 0: Create device for testing power ports" + netbox.netbox.netbox_device: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Device Power Tests + device_type: Cisco Test + device_role: Core Switch + site: Test Site + state: present + +- name: "POWER_PORT 1: Necessary info creation" + netbox.netbox.netbox_power_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port + device: Device Power Tests + state: present + register: test_one + +- name: "POWER_PORT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_port']['name'] == "Power Port" + - test_one['power_port']['device'] == 10 + - test_one['msg'] == "power_port Power Port created" + +- name: "POWER_PORT 2: Create duplicate" + netbox.netbox.netbox_power_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port + device: Device Power Tests + state: present + register: test_two + +- name: "POWER_PORT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_port']['name'] == "Power Port" + - test_two['power_port']['device'] == 10 + - test_two['msg'] == "power_port Power Port already exists" + +- name: "POWER_FEED 3: Update power_port with other fields" + netbox.netbox.netbox_power_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port + device: Device Power Tests + type: ita-e + allocated_draw: 10 + maximum_draw: 20 + description: test description + state: present + register: test_three + +- name: "POWER_FEED 3: ASSERT - Update power_port with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "ita-e" + - test_three['diff']['after']['allocated_draw'] == 10 + - test_three['diff']['after']['maximum_draw'] == 20 + - test_three['diff']['after']['description'] == "test description" + - test_three['power_port']['name'] == "Power Port" + - test_three['power_port']['device'] == 10 + - test_three['power_port']['type'] == "ita-e" + - test_three['power_port']['allocated_draw'] == 10 + - test_three['power_port']['maximum_draw'] == 20 + - test_three['power_port']['description'] == "test description" + - test_three['msg'] == "power_port Power Port updated" + +- name: "POWER_PORT 4: Create Power Port for Delete Test" + netbox.netbox.netbox_power_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port 2 + device: Device Power Tests + state: present + register: test_four + +- name: "POWER_PORT 4: ASSERT - Create Power Port for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_port']['name'] == "Power Port 2" + - test_four['power_port']['device'] == 10 + - test_four['msg'] == "power_port Power Port 2 created" + +- name: "POWER_PORT 5: Delete Power Port" + netbox.netbox.netbox_power_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port 2 + device: Device Power Tests + state: absent + register: test_five + +- name: "POWER_PORT 5: ASSERT - Delete Power Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_port Power Port 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_port_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_port_template.yml new file mode 100644 index 00000000..9e7547fd --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_power_port_template.yml @@ -0,0 +1,120 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_PORT_TEMPLATE +## +## +- name: "POWER_PORT_TEMPLATE 0: Create device type for testing power ports" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + model: Device Type Power Tests + manufacturer: Test Manufacturer + state: present + +- name: "POWER_PORT_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_power_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port Template + device_type: Device Type Power Tests + state: present + register: test_one + +- name: "POWER_PORT_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_port_template']['name'] == "Power Port Template" + - test_one['power_port_template']['device_type'] == 8 + - test_one['msg'] == "power_port_template Power Port Template created" + +- name: "POWER_PORT_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_power_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port Template + device_type: Device Type Power Tests + state: present + register: test_two + +- name: "POWER_PORT_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_port_template']['name'] == "Power Port Template" + - test_two['power_port_template']['device_type'] == 8 + - test_two['msg'] == "power_port_template Power Port Template already exists" + +- name: "POWER_PORT_TEMPLATE 3: Update power_port_template with other fields" + netbox.netbox.netbox_power_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port Template + device_type: Device Type Power Tests + type: ita-e + allocated_draw: 10 + maximum_draw: 20 + state: present + register: test_three + +- name: "POWER_PORT_TEMPLATE 3: ASSERT - Update power_port_template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "ita-e" + - test_three['diff']['after']['allocated_draw'] == 10 + - test_three['diff']['after']['maximum_draw'] == 20 + - test_three['power_port_template']['name'] == "Power Port Template" + - test_three['power_port_template']['device_type'] == 8 + - test_three['power_port_template']['type'] == "ita-e" + - test_three['power_port_template']['allocated_draw'] == 10 + - test_three['power_port_template']['maximum_draw'] == 20 + - test_three['msg'] == "power_port_template Power Port Template updated" + +- name: "POWER_PORT_TEMPLATE 4: Create Power Port Template for Delete Test" + netbox.netbox.netbox_power_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port Template 2 + device_type: Device Type Power Tests + state: present + register: test_four + +- name: "POWER_PORT_TEMPLATE 4: ASSERT - Create Power Port Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_port_template']['name'] == "Power Port Template 2" + - test_four['power_port_template']['device_type'] == 8 + - test_four['msg'] == "power_port_template Power Port Template 2 created" + +- name: "POWER_PORT_TEMPLATE 5: Delete Power Port Template" + netbox.netbox.netbox_power_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port Template 2 + device_type: Device Type Power Tests + state: absent + register: test_five + +- name: "POWER_PORT_TEMPLATE 5: ASSERT - Delete Power Port Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_port_template Power Port Template 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_prefix.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_prefix.yml new file mode 100644 index 00000000..7a465548 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_prefix.yml @@ -0,0 +1,245 @@ +--- +## +## +### NETBOX_PREFIX +## +## +- name: "1 - Create prefix within Netbox with only required information" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.156.0.0/19 + state: present + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['msg'] == "prefix 10.156.0.0/19 created" + - test_one['prefix']['prefix'] == "10.156.0.0/19" + +- name: "2 - Duplicate" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.156.0.0/19 + state: present + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['msg'] == "prefix 10.156.0.0/19 already exists" + - test_two['prefix']['prefix'] == "10.156.0.0/19" + +- name: "3 - Update 10.156.0.0/19" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.156.0.0/19 + site: Test Site + status: Reserved + description: "This prefix has been updated" + state: present + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['after']['site'] == 1 + - test_three['diff']['after']['status'] == "reserved" + - test_three['diff']['after']['description'] == "This prefix has been updated" + - test_three['msg'] == "prefix 10.156.0.0/19 updated" + - test_three['prefix']['prefix'] == "10.156.0.0/19" + - test_three['prefix']['site'] == 1 + - test_three['prefix']['status'] == "reserved" + - test_three['prefix']['description'] == "This prefix has been updated" + +- name: "4 - Delete prefix within netbox" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.156.0.0/19 + state: absent + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "prefix 10.156.0.0/19 deleted" + +- name: "5 - Create prefix with several specified options" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + prefix: 10.156.32.0/19 + site: Test Site + vrf: Test VRF + tenant: Test Tenant + vlan: + name: Test VLAN + site: Test Site + tenant: Test Tenant + vlan_group: Test Vlan Group + status: Reserved + prefix_role: Network of care + description: Test description + is_pool: true + tags: + - "Schnozzberry" + state: present + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['msg'] == "prefix 10.156.32.0/19 created" + - test_five['prefix']['prefix'] == "10.156.32.0/19" + - test_five['prefix']['family'] == 4 + - test_five['prefix']['site'] == 1 + - test_five['prefix']['vrf'] == 1 + - test_five['prefix']['tenant'] == 1 + - test_five['prefix']['vlan'] == 4 + - test_five['prefix']['status'] == "reserved" + - test_five['prefix']['role'] == 1 + - test_five['prefix']['description'] == "Test description" + - test_five['prefix']['is_pool'] == true + - test_five['prefix']['tags'][0] == 4 + +- name: "6 - Get a new /24 inside 10.156.0.0/19 within Netbox - Parent doesn't exist" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + parent: 10.156.0.0/19 + prefix_length: 24 + state: present + first_available: yes + register: test_six + +- name: "6 - ASSERT" + assert: + that: + - not test_six['changed'] + - test_six['msg'] == "Parent prefix does not exist - 10.156.0.0/19" + +- name: "7 - Create prefix within Netbox with only required information" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.156.0.0/19 + state: present + register: test_seven + +- name: "7 - ASSERT" + assert: + that: + - test_seven is changed + - test_seven['diff']['before']['state'] == "absent" + - test_seven['diff']['after']['state'] == "present" + - test_seven['msg'] == "prefix 10.156.0.0/19 created" + - test_seven['prefix']['prefix'] == "10.156.0.0/19" + +- name: "8 - Get a new /24 inside 10.156.0.0/19 within Netbox" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + parent: 10.156.0.0/19 + prefix_length: 24 + state: present + first_available: yes + register: test_eight + +- name: "8 - ASSERT" + assert: + that: + - test_eight is changed + - test_eight['diff']['before']['state'] == "absent" + - test_eight['diff']['after']['state'] == "present" + - test_eight['msg'] == "prefix 10.156.0.0/24 created" + - test_eight['prefix']['prefix'] == "10.156.0.0/24" + +- name: "9 - Create 10.157.0.0/19" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.157.0.0/19 + vrf: Test VRF + site: Test Site + state: present + register: test_nine + +- name: "9 - ASSERT" + assert: + that: + - test_nine is changed + - test_nine['diff']['before']['state'] == "absent" + - test_nine['diff']['after']['state'] == "present" + - test_nine['msg'] == "prefix 10.157.0.0/19 created" + - test_nine['prefix']['prefix'] == "10.157.0.0/19" + - test_nine['prefix']['site'] == 1 + - test_nine['prefix']['vrf'] == 1 + +- name: "10 - Get a new /24 inside 10.157.0.0/19 within Netbox with additional values" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + parent: 10.157.0.0/19 + prefix_length: 24 + vrf: Test VRF + site: Test Site + state: present + first_available: yes + register: test_ten + +- name: "10 - ASSERT" + assert: + that: + - test_ten is changed + - test_ten['diff']['before']['state'] == "absent" + - test_ten['diff']['after']['state'] == "present" + - test_ten['msg'] == "prefix 10.157.0.0/24 created" + - test_ten['prefix']['prefix'] == "10.157.0.0/24" + - test_ten['prefix']['site'] == 1 + - test_ten['prefix']['vrf'] == 1 + +- name: "11 - Get a new /24 inside 10.156.0.0/19 within Netbox" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + parent: 10.156.0.0/19 + prefix_length: 24 + state: present + first_available: yes + register: test_eleven + +- name: "11 - ASSERT" + assert: + that: + - test_eleven is changed + - test_eleven['diff']['before']['state'] == "absent" + - test_eleven['diff']['after']['state'] == "present" + - test_eleven['msg'] == "prefix 10.156.1.0/24 created" + - test_eleven['prefix']['prefix'] == "10.156.1.0/24" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_provider.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_provider.yml new file mode 100644 index 00000000..782df16f --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_provider.yml @@ -0,0 +1,99 @@ +--- +## +## +### NETBOX_PROVIDER +## +## +- name: "NETBOX_PROVIDER 1: Create provider within Netbox with only required information" + netbox.netbox.netbox_provider: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Provider One + state: present + register: test_one + +- name: "NETBOX_PROVIDER 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['provider']['name'] == "Test Provider One" + - test_one['provider']['slug'] == "test-provider-one" + - test_one['msg'] == "provider Test Provider One created" + +- name: "NETBOX_PROVIDER 2: Duplicate" + netbox.netbox.netbox_provider: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Provider One + state: present + register: test_two + +- name: "NETBOX_PROVIDER 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['provider']['name'] == "Test Provider One" + - test_two['provider']['slug'] == "test-provider-one" + - test_two['msg'] == "provider Test Provider One already exists" + +- name: "NETBOX_PROVIDER 3: Update provider with other fields" + netbox.netbox.netbox_provider: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Provider One + asn: 65001 + account: "200129104" + portal_url: http://provider.net + noc_contact: noc@provider.net + admin_contact: admin@provider.net + comments: "BAD PROVIDER" + state: present + register: test_three + +- name: "NETBOX_PROVIDER 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['asn'] == 65001 + - test_three['diff']['after']['account'] == "200129104" + - test_three['diff']['after']['portal_url'] == "http://provider.net" + - test_three['diff']['after']['noc_contact'] == "noc@provider.net" + - test_three['diff']['after']['admin_contact'] == "admin@provider.net" + - test_three['diff']['after']['comments'] == "BAD PROVIDER" + - test_three['provider']['name'] == "Test Provider One" + - test_three['provider']['slug'] == "test-provider-one" + - test_three['provider']['asn'] == 65001 + - test_three['provider']['account'] == "200129104" + - test_three['provider']['portal_url'] == "http://provider.net" + - test_three['provider']['noc_contact'] == "noc@provider.net" + - test_three['provider']['admin_contact'] == "admin@provider.net" + - test_three['provider']['comments'] == "BAD PROVIDER" + - test_three['msg'] == "provider Test Provider One updated" + +- name: "NETBOX_PROVIDER 4: Delete provider within netbox" + netbox.netbox.netbox_provider: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Provider One + state: absent + register: test_four + +- name: "NETBOX_PROVIDER 4 : ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['provider']['name'] == "Test Provider One" + - test_four['provider']['slug'] == "test-provider-one" + - test_four['provider']['asn'] == 65001 + - test_four['provider']['account'] == "200129104" + - test_four['provider']['portal_url'] == "http://provider.net" + - test_four['provider']['noc_contact'] == "noc@provider.net" + - test_four['provider']['admin_contact'] == "admin@provider.net" + - test_four['provider']['comments'] == "BAD PROVIDER" + - test_four['msg'] == "provider Test Provider One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rack.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rack.yml new file mode 100644 index 00000000..a65cb66e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rack.yml @@ -0,0 +1,225 @@ +--- +## +## +### NETBOX_RACK +## +## +- name: "1 - Test rack creation" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test rack one" + site: "Test Site" + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rack']['name'] == "Test rack one" + - test_one['rack']['site'] == 1 + +- name: "Test duplicate rack" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test rack one" + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['rack']['name'] == "Test rack one" + - test_two['rack']['site'] == 1 + - test_two['msg'] == "rack Test rack one already exists" + +- name: "3 - Create new rack with similar name" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test rack - Test Site + site: Test Site + state: present + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['rack']['name'] == "Test rack - Test Site" + - test_three['rack']['site'] == 1 + - test_three['msg'] == "rack Test rack - Test Site created" + +- name: "4 - Attempt to create Test rack one again" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test rack one + site: Test Site + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - not test_four['changed'] + - test_four['rack']['name'] == "Test rack one" + - test_four['rack']['site'] == 1 + - test_four['msg'] == "rack Test rack one already exists" + +- name: "5 - Update Test rack one with more options" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test rack one + site: Test Site + rack_role: "Test Rack Role" + rack_group: "Test Rack Group" + facility_id: "EQUI10291" + tenant: "Test Tenant" + status: Available + serial: "FXS10001" + asset_tag: "1234" + width: 23 + u_height: 48 + type: "2-post frame" + outer_width: 32 + outer_depth: 24 + outer_unit: "Inches" + comments: "Just testing rack module" + tags: + - "Schnozzberry" + state: present + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['after']['asset_tag'] == "1234" + - test_five['diff']['after']['comments'] == "Just testing rack module" + - test_five['diff']['after']['facility_id'] == "EQUI10291" + - test_five['diff']['after']['group'] == 1 + - test_five['diff']['after']['outer_depth'] == 24 + - test_five['diff']['after']['outer_unit'] == "in" + - test_five['diff']['after']['outer_width'] == 32 + - test_five['diff']['after']['role'] == 1 + - test_five['diff']['after']['serial'] == "FXS10001" + - test_five['diff']['after']['status'] == "available" + - test_five['diff']['after']['tenant'] == 1 + - test_five['diff']['after']['tags'][0] == 4 + - test_five['diff']['after']['type'] == "2-post-frame" + - test_five['diff']['after']['u_height'] == 48 + - test_five['diff']['after']['width'] == 23 + - test_five['rack']['name'] == "Test rack one" + - test_five['rack']['site'] == 1 + - test_five['rack']['asset_tag'] == "1234" + - test_five['rack']['comments'] == "Just testing rack module" + - test_five['rack']['facility_id'] == "EQUI10291" + - test_five['rack']['group'] == 1 + - test_five['rack']['outer_depth'] == 24 + - test_five['rack']['outer_unit'] == "in" + - test_five['rack']['outer_width'] == 32 + - test_five['rack']['role'] == 1 + - test_five['rack']['serial'] == "FXS10001" + - test_five['rack']['status'] == "available" + - test_five['rack']['tenant'] == 1 + - test_five['rack']['tags'][0] == 4 + - test_five['rack']['type'] == "2-post-frame" + - test_five['rack']['u_height'] == 48 + - test_five['rack']['width'] == 23 + - test_five['msg'] == "rack Test rack one updated" + +- name: "6 - Update Test rack one with same options" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test rack one + site: Test Site + rack_role: "Test Rack Role" + rack_group: "Test Rack Group" + facility_id: "EQUI10291" + tenant: "Test Tenant" + status: Available + serial: "FXS10001" + asset_tag: "1234" + width: 23 + u_height: 48 + type: "2-post frame" + outer_width: 32 + outer_depth: 24 + outer_unit: "Inches" + comments: "Just testing rack module" + tags: + - "Schnozzberry" + state: present + register: test_six + +- name: "6 - ASSERT" + assert: + that: + - test_six is not changed + - test_six['rack']['name'] == "Test rack one" + - test_six['rack']['site'] == 1 + - test_six['rack']['asset_tag'] == "1234" + - test_six['rack']['comments'] == "Just testing rack module" + - test_six['rack']['facility_id'] == "EQUI10291" + - test_six['rack']['group'] == 1 + - test_six['rack']['outer_depth'] == 24 + - test_six['rack']['outer_unit'] == "in" + - test_six['rack']['outer_width'] == 32 + - test_six['rack']['role'] == 1 + - test_six['rack']['serial'] == "FXS10001" + - test_six['rack']['status'] == "available" + - test_six['rack']['tenant'] == 1 + - test_six['rack']['tags'][0] == 4 + - test_six['rack']['type'] == "2-post-frame" + - test_six['rack']['u_height'] == 48 + - test_six['rack']['width'] == 23 + +- name: "7 - Create rack with same asset tag and serial number" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test rack two + site: Test Site + serial: "FXS10001" + asset_tag: "1234" + state: present + ignore_errors: yes + register: test_seven + +- name: "7 - ASSERT" + assert: + that: + - test_seven is failed + - "'Asset tag already exists' in test_seven['msg']" + +- name: "8 - Test delete" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test rack one" + state: "absent" + register: test_eight + +- name: "8 - ASSERT" + assert: + that: + - test_eight is changed + - test_eight['diff']['before']['state'] == "present" + - test_eight['diff']['after']['state'] == "absent" + - test_eight['msg'] == "rack Test rack one deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rack_group.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rack_group.yml new file mode 100644 index 00000000..6a10cbf9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rack_group.yml @@ -0,0 +1,62 @@ +--- +## +## +### NETBOX_RACK_GROUP +## +## +- name: "RACK_GROUP 1: Necessary info creation" + netbox.netbox.netbox_rack_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Group + site: Test Site + state: present + register: test_one + +- name: "RACK_GROUP 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rack_group']['name'] == "Rack Group" + - test_one['rack_group']['slug'] == "rack-group" + - test_one['rack_group']['site'] == 1 + - test_one['msg'] == "rack_group Rack Group created" + +- name: "RACK_GROUP 2: Create duplicate" + netbox.netbox.netbox_rack_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Group + site: Test Site + state: present + register: test_two + +- name: "RACK_GROUP 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['rack_group']['name'] == "Rack Group" + - test_two['rack_group']['slug'] == "rack-group" + - test_two['rack_group']['site'] == 1 + - test_two['msg'] == "rack_group Rack Group already exists" + +- name: "RACK_GROUP 3: ASSERT - Delete" + netbox.netbox.netbox_rack_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Group + state: absent + register: test_three + +- name: "RACK_GROUP 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "present" + - test_three['diff']['after']['state'] == "absent" + - test_three['msg'] == "rack_group Rack Group deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rack_role.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rack_role.yml new file mode 100644 index 00000000..5ca9e44e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rack_role.yml @@ -0,0 +1,81 @@ +--- +## +## +### NETBOX_RACK_ROLE +## +## +- name: "RACK_ROLE 1: Necessary info creation" + netbox.netbox.netbox_rack_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Role + color: "ffffff" + state: present + register: test_one + +- name: "RACK_ROLE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rack_role']['name'] == "Rack Role" + - test_one['rack_role']['slug'] == "rack-role" + - test_one['rack_role']['color'] == "ffffff" + - test_one['msg'] == "rack_role Rack Role created" + +- name: "RACK_ROLE 2: Create duplicate" + netbox.netbox.netbox_rack_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Role + state: present + register: test_two + +- name: "RACK_ROLE 1: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['rack_role']['name'] == "Rack Role" + - test_two['rack_role']['slug'] == "rack-role" + - test_two['rack_role']['color'] == "ffffff" + - test_two['msg'] == "rack_role Rack Role already exists" + +- name: "RACK_ROLE 3: Update" + netbox.netbox.netbox_rack_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Role + color: "003EFF" + state: present + register: test_three + +- name: "RACK_ROLE 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['after']['color'] == "003eff" + - test_three['rack_role']['name'] == "Rack Role" + - test_three['rack_role']['slug'] == "rack-role" + - test_three['rack_role']['color'] == "003eff" + - test_three['msg'] == "rack_role Rack Role updated" + +- name: "RACK_ROLE 4: Delete" + netbox.netbox.netbox_rack_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Role + state: absent + register: test_four + +- name: "RACK_ROLE 4: ASSERT - Update" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "rack_role Rack Role deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rear_port.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rear_port.yml new file mode 100644 index 00000000..10eb2309 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rear_port.yml @@ -0,0 +1,139 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_REAR_PORT +## +## +- name: "REAR_PORT 1: Necessary info creation" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port + device: test100 + type: bnc + state: present + register: test_one + +- name: "REAR_PORT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rear_port']['name'] == "Rear Port" + - test_one['rear_port']['device'] == 1 + - test_one['rear_port']['type'] == "bnc" + - test_one['msg'] == "rear_port Rear Port created" + +- name: "REAR_PORT 2: Create duplicate" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port + device: test100 + type: bnc + state: present + register: test_two + +- name: "REAR_PORT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['rear_port']['name'] == "Rear Port" + - test_two['rear_port']['device'] == 1 + - test_two['rear_port']['type'] == "bnc" + - test_two['msg'] == "rear_port Rear Port already exists" + +- name: "REAR_PORT 3: Update Rear Port with other fields" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port + device: test100 + type: bnc + positions: 5 + description: test description + state: present + register: test_three + +- name: "REAR_PORT 3: ASSERT - Update Rear Port with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['positions'] == 5 + - test_three['diff']['after']['description'] == "test description" + - test_three['rear_port']['name'] == "Rear Port" + - test_three['rear_port']['device'] == 1 + - test_three['rear_port']['type'] == "bnc" + - test_three['rear_port']['positions'] == 5 + - test_three['rear_port']['description'] == "test description" + - test_three['msg'] == "rear_port Rear Port updated" + +- name: "REAR_PORT 4: Create Rear Port for Delete Test" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port 2 + device: test100 + type: bnc + state: present + register: test_four + +- name: "REAR_PORT 4: ASSERT - Create Rear Port for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['rear_port']['name'] == "Rear Port 2" + - test_four['rear_port']['device'] == 1 + - test_four['rear_port']['type'] == "bnc" + - test_four['msg'] == "rear_port Rear Port 2 created" + +- name: "REAR_PORT 5: Delete Rear Port" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port 2 + device: test100 + type: bnc + state: absent + register: test_five + +- name: "REAR_PORT 5: ASSERT - Delete Rear Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "rear_port Rear Port 2 deleted" + +- name: "REAR_PORT 6: Create second Rear Port" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port + device: Test Nexus One + type: bnc + state: present + register: test_six + +- name: "REAR_PORT 6: ASSERT - Create second Rear Port" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "absent" + - test_six['diff']['after']['state'] == "present" + - test_six['rear_port']['name'] == "Rear Port" + - test_six['rear_port']['device'] == 4 + - test_six['rear_port']['type'] == "bnc" + - test_six['msg'] == "rear_port Rear Port created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rear_port_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rear_port_template.yml new file mode 100644 index 00000000..ca867619 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rear_port_template.yml @@ -0,0 +1,136 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_REAR_PORT_TEMPLATE +## +## +- name: "REAR_PORT_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template + device_type: Cisco Test + type: bnc + state: present + register: test_one + +- name: "REAR_PORT_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rear_port_template']['name'] == "Rear Port Template" + - test_one['rear_port_template']['device_type'] == 1 + - test_one['rear_port_template']['type'] == "bnc" + - test_one['msg'] == "rear_port_template Rear Port Template created" + +- name: "REAR_PORT_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template + device_type: Cisco Test + type: bnc + state: present + register: test_two + +- name: "REAR_PORT_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['rear_port_template']['name'] == "Rear Port Template" + - test_two['rear_port_template']['device_type'] == 1 + - test_two['rear_port_template']['type'] == "bnc" + - test_two['msg'] == "rear_port_template Rear Port Template already exists" + +- name: "REAR_PORT_TEMPLATE 3: Update Rear Port Template with other fields" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template + device_type: Cisco Test + type: bnc + positions: 5 + state: present + register: test_three + +- name: "REAR_PORT_TEMPLATE 3: ASSERT - Update Rear Port Template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['positions'] == 5 + - test_three['rear_port_template']['name'] == "Rear Port Template" + - test_three['rear_port_template']['device_type'] == 1 + - test_three['rear_port_template']['type'] == "bnc" + - test_three['rear_port_template']['positions'] == 5 + - test_three['msg'] == "rear_port_template Rear Port Template updated" + +- name: "REAR_PORT_TEMPLATE 4: Create Rear Port Template for Delete Test" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template 2 + device_type: Cisco Test + type: bnc + state: present + register: test_four + +- name: "REAR_PORT_TEMPLATE 4: ASSERT - Create Rear Port Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['rear_port_template']['name'] == "Rear Port Template 2" + - test_four['rear_port_template']['device_type'] == 1 + - test_four['rear_port_template']['type'] == "bnc" + - test_four['msg'] == "rear_port_template Rear Port Template 2 created" + +- name: "REAR_PORT_TEMPLATE 5: Delete Rear Port Template" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template 2 + device_type: Cisco Test + type: bnc + state: absent + register: test_five + +- name: "REAR_PORT_TEMPLATE 5: ASSERT - Delete Rear Port Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "rear_port_template Rear Port Template 2 deleted" + +- name: "REAR_PORT_TEMPLATE 6: Create second Rear Port Template" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template 2 + device_type: Arista Test + type: bnc + state: present + register: test_six + +- name: "REAR_PORT_TEMPLATE 6: ASSERT - Create second Rear Port Template" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "absent" + - test_six['diff']['after']['state'] == "present" + - test_six['rear_port_template']['name'] == "Rear Port Template 2" + - test_six['rear_port_template']['device_type'] == 2 + - test_six['rear_port_template']['type'] == "bnc" + - test_six['msg'] == "rear_port_template Rear Port Template 2 created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_region.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_region.yml new file mode 100644 index 00000000..1359598a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_region.yml @@ -0,0 +1,79 @@ +--- +## +## +### NETBOX_REGION +## +## +- name: "REGION 1: Necessary info creation" + netbox.netbox.netbox_region: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Region One" + state: present + register: test_one + +- name: "REGION 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['region']['name'] == "Test Region One" + - test_one['region']['slug'] == "test-region-one" + - test_one['msg'] == "region Test Region One created" + +- name: "REGION 2: Create duplicate" + netbox.netbox.netbox_region: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Region One" + state: present + register: test_two + +- name: "REGION 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['region']['name'] == "Test Region One" + - test_two['region']['slug'] == "test-region-one" + - test_two['msg'] == "region Test Region One already exists" + +- name: "REGION 3: ASSERT - Update" + netbox.netbox.netbox_region: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Region One" + parent_region: "Test Region" + state: present + register: test_three + +- name: "REGION 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['parent'] == 1 + - test_three['region']['name'] == "Test Region One" + - test_three['region']['slug'] == "test-region-one" + - test_three['region']['parent'] == 1 + - test_three['msg'] == "region Test Region One updated" + +- name: "REGION 4: ASSERT - Delete" + netbox.netbox.netbox_region: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Region One" + state: absent + register: test_four + +- name: "REGION 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['region']['name'] == "Test Region One" + - test_four['region']['slug'] == "test-region-one" + - test_four['region']['parent'] == 1 + - test_four['msg'] == "region Test Region One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rir.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rir.yml new file mode 100644 index 00000000..cc493593 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_rir.yml @@ -0,0 +1,79 @@ +--- +## +## +### NETBOX_RIR +## +## +- name: "RIR 1: Necessary info creation" + netbox.netbox.netbox_rir: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test RIR One + state: present + register: test_one + +- name: "RIR 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rir']['name'] == "Test RIR One" + - test_one['rir']['slug'] == "test-rir-one" + - test_one['msg'] == "rir Test RIR One created" + +- name: "RIR 2: Create duplicate" + netbox.netbox.netbox_rir: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test RIR One + state: present + register: test_two + +- name: "RIR 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['rir']['name'] == "Test RIR One" + - test_two['rir']['slug'] == "test-rir-one" + - test_two['msg'] == "rir Test RIR One already exists" + +- name: "RIR 3: ASSERT - Update" + netbox.netbox.netbox_rir: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test RIR One" + is_private: true + state: present + register: test_three + +- name: "RIR 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['is_private'] == true + - test_three['rir']['name'] == "Test RIR One" + - test_three['rir']['slug'] == "test-rir-one" + - test_three['rir']['is_private'] == true + - test_three['msg'] == "rir Test RIR One updated" + +- name: "RIR 4: ASSERT - Delete" + netbox.netbox.netbox_rir: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test RIR One" + state: absent + register: test_four + +- name: "RIR 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['rir']['name'] == "Test RIR One" + - test_four['rir']['slug'] == "test-rir-one" + - test_four['rir']['is_private'] == true + - test_four['msg'] == "rir Test RIR One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_service.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_service.yml new file mode 100644 index 00000000..09a993c3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_service.yml @@ -0,0 +1,196 @@ +--- +## +## +### NETBOX_SERVICE +## +## +- name: "1 - Device with required information needs to add new service" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "FOR_SERVICE" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + state: present + +- name: "NETBOX_SERVICE: Create new service" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "FOR_SERVICE" + name: "node-exporter" + port: 9100 + protocol: TCP + state: present + register: test_service_create + +- name: "NETBOX_SERVICE ASSERT - Create" + assert: + that: + - test_service_create is changed + - test_service_create['services']['name'] == "node-exporter" + - test_service_create['services']['ports'] == [9100] + - test_service_create['services']['protocol'] == "tcp" + - test_service_create['diff']['after']['state'] == "present" + - test_service_create['diff']['before']['state'] == "absent" + - test_service_create['msg'] == "services node-exporter created" + +- name: "NETBOX_SERVICE: Test idempotence" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "FOR_SERVICE" + name: "node-exporter" + port: 9100 + protocol: TCP + state: present + register: test_service_idempotence + +- name: "NETBOX_SERVICE ASSERT - Not changed" + assert: + that: + - test_service_idempotence['services']['name'] == "node-exporter" + - test_service_idempotence['services']['ports'] == [9100] + - test_service_idempotence['services']['protocol'] == "tcp" + - test_service_idempotence['msg'] == "services node-exporter already exists" + +- name: "NETBOX_SERVICE: Test update" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "FOR_SERVICE" + name: "node-exporter" + ports: + - 9100 + - 9200 + protocol: TCP + tags: + - "Schnozzberry" + state: present + register: test_service_update + +- name: "NETBOX_SERVICE ASSERT - Service has been updated" + assert: + that: + - test_service_update is changed + - test_service_update['diff']['after']['tags'][0] == 4 + - test_service_update['diff']['after']['ports'] == [9100, 9200] + - test_service_update['msg'] == "services node-exporter updated" + +- name: "NETBOX_SERVICE: Test same details, but different protocol - Create" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "FOR_SERVICE" + name: "node-exporter" + port: 9100 + protocol: UDP + state: present + register: test_service_protocol + +- name: "NETBOX_SERVICE ASSERT - Different protocol - Create" + assert: + that: + - test_service_protocol is changed + - test_service_protocol['diff']['after']['state'] == "present" + - test_service_protocol['diff']['before']['state'] == "absent" + - test_service_protocol['services']['name'] == "node-exporter" + - test_service_protocol['services']['ports'] == [9100] + - test_service_protocol['services']['protocol'] == "udp" + - test_service_protocol['msg'] == "services node-exporter created" + +- name: "NETBOX_SERVICE: Test service deletion" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "FOR_SERVICE" + name: "node-exporter" + port: 9100 + protocol: UDP + state: absent + register: test_service_delete + +- name: "NETBOX_SERVICE ASSERT - Service has been deleted" + assert: + that: + - test_service_delete is changed + - test_service_delete['diff']['after']['state'] == "absent" + - test_service_delete['diff']['before']['state'] == "present" + - test_service_delete['msg'] == "services node-exporter deleted" + +- name: "NETBOX_SERVICE: Test service IP addresses" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "test100" + name: "node-exporter" + port: 9100 + protocol: UDP + ipaddresses: + - address: "172.16.180.1/24" + state: present + register: test_service_ip_addresses + +- name: "NETBOX_SERVICE ASSERT - Service has been created with IP address" + assert: + that: + - test_service_ip_addresses is changed + - test_service_ip_addresses['diff']['after']['state'] == "present" + - test_service_ip_addresses['diff']['before']['state'] == "absent" + - test_service_ip_addresses['services']['name'] == "node-exporter" + - test_service_ip_addresses['services']['ports'] == [9100] + - test_service_ip_addresses['services']['protocol'] == "udp" + - test_service_ip_addresses['services']['ipaddresses'] is defined + - test_service_ip_addresses['msg'] == "services node-exporter created" + +- name: "NETBOX_SERVICE: Missing both device & virtual_machine options - Tests required_one_of" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "node-exporter" + port: 9100 + protocol: UDP + ipaddresses: + - address: "172.16.180.1/24" + state: present + ignore_errors: yes + register: test_service_required_one_of + +- name: "NETBOX_SERVICE ASSERT - Failed due to missing arguments" + assert: + that: + - test_service_required_one_of is failed + - 'test_service_required_one_of["msg"] == "one of the following is required: device, virtual_machine"' + +- name: "NETBOX_SERVICE: Create new service on virtual_machine" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + virtual_machine: "test100-vm" + name: "node-exporter" + port: 9100 + protocol: TCP + state: present + register: test_service_create_vm + +- name: "NETBOX_SERVICE ASSERT - Create" + assert: + that: + - test_service_create_vm is changed + - test_service_create_vm['services']['name'] == "node-exporter" + - test_service_create_vm['services']['ports'] == [9100] + - test_service_create_vm['services']['protocol'] == "tcp" + - test_service_create_vm['diff']['after']['state'] == "present" + - test_service_create_vm['diff']['before']['state'] == "absent" + - test_service_create_vm['msg'] == "services node-exporter created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_site.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_site.yml new file mode 100644 index 00000000..dd7f9ffc --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_site.yml @@ -0,0 +1,132 @@ +--- +## +## +### NETBOX_SITE +## +## +- name: "1 - Create site within Netbox with only required information" + netbox.netbox.netbox_site: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test - Colorado + state: present + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['site']['name'] == "Test - Colorado" + - test_one['msg'] == "site Test - Colorado created" + +- name: "2 - Duplicate" + netbox.netbox.netbox_site: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test - Colorado + state: present + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['msg'] == "site Test - Colorado already exists" + - test_two['site']['name'] == "Test - Colorado" + +- name: "3 - Update Test - Colorado" + netbox.netbox.netbox_site: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test - Colorado + status: Planned + region: Test Region + contact_name: Mikhail + state: present + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['after']['status'] == "planned" + - test_three['diff']['after']['contact_name'] == "Mikhail" + - test_three['diff']['after']['region'] == 1 + - test_three['msg'] == "site Test - Colorado updated" + - test_three['site']['name'] == "Test - Colorado" + - test_three['site']['status'] == "planned" + - test_three['site']['contact_name'] == "Mikhail" + - test_three['site']['region'] == 1 + +- name: "4 - Create site with all parameters" + netbox.netbox.netbox_site: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test - California + status: Planned + region: Test Region + tenant: Test Tenant + facility: EquinoxCA7 + asn: 65001 + time_zone: America/Los Angeles + description: This is a test description + physical_address: Hollywood, CA, 90210 + shipping_address: Hollywood, CA, 90210 + latitude: 10.1 + longitude: 12.2 + contact_name: Jenny + contact_phone: 867-5309 + contact_email: jenny@changednumber.com + comments: "### Placeholder" + slug: "test_california" + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['site']['name'] == "Test - California" + - test_four['msg'] == "site Test - California created" + - test_four['site']['status'] == "planned" + - test_four['site']['region'] == 1 + - test_four['site']['tenant'] == 1 + - test_four['site']['facility'] == "EquinoxCA7" + - test_four['site']['asn'] == 65001 + - test_four['site']['time_zone'] == "America/Los_Angeles" + - test_four['site']['description'] == "This is a test description" + - test_four['site']['physical_address'] == "Hollywood, CA, 90210" + - test_four['site']['shipping_address'] == "Hollywood, CA, 90210" + - test_four['site']['latitude'] == "10.100000" + - test_four['site']['longitude'] == "12.200000" + - test_four['site']['contact_name'] == "Jenny" + - test_four['site']['contact_phone'] == "867-5309" + - test_four['site']['contact_email'] == "jenny@changednumber.com" + - test_four['site']['comments'] == "### Placeholder" + - test_four['site']['slug'] == "test_california" + +- name: "5 - Delete site within netbox" + netbox.netbox.netbox_site: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test - Colorado + state: absent + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['site']['name'] == "Test - Colorado" + - test_five['msg'] == "site Test - Colorado deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_tag.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_tag.yml new file mode 100644 index 00000000..38c4157c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_tag.yml @@ -0,0 +1,110 @@ +--- +## +## +### NETBOX_TAGS +## +## +- name: "TAG 1: ASSERT - Necessary info creation" + netbox.netbox.netbox_tag: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tag 1" + description: "Tag 1 test" + color: "0000ff" + state: present + register: test_one + +- name: "TAG 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['tags']['color'] == "0000ff" + - test_one['tags']['description'] == "Tag 1 test" + - test_one['tags']['name'] == "Test Tag 1" + - test_one['tags']['slug'] == "test-tag-1" + - test_one['msg'] == "tags Test Tag 1 created" + +- name: "TAG 2: Create duplicate" + netbox.netbox.netbox_tag: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tag 1" + description: "Tag 1 test" + color: "0000ff" + state: present + register: test_two + +- name: "TAG 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['tags']['name'] == "Test Tag 1" + - test_two['msg'] == "tags Test Tag 1 already exists" + +- name: "TAG 3: ASSERT - Update" + netbox.netbox.netbox_tag: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tag 1" + description: "Tag 1 update test" + color: "00ff00" + state: present + register: test_three + +- name: "TAG 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['color'] == "00ff00" + - test_three['diff']['after']['description'] == "Tag 1 update test" + - test_three['tags']['name'] == "Test Tag 1" + - test_three['tags']['description'] == "Tag 1 update test" + - test_three['tags']['color'] == "00ff00" + - test_three['msg'] == "tags Test Tag 1 updated" + +- name: "TAG 4: ASSERT - Delete" + netbox.netbox.netbox_tag: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tag 1" + state: absent + register: test_four + +- name: "TAG 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['after']['state'] == "absent" + - test_four['tags']['name'] == "Test Tag 1" + - test_four['tags']['slug'] == "test-tag-1" + - test_four['msg'] == "tags Test Tag 1 deleted" + +- name: "TAG 5: ASSERT - Necessary info creation" + netbox.netbox.netbox_tag: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tag 5" + slug: "test-tag-five" + description: "Tag 5 test" + color: "0000ff" + state: present + register: test_five + +- name: "TAG 5: ASSERT - Necessary info creation" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['tags']['color'] == "0000ff" + - test_five['tags']['description'] == "Tag 5 test" + - test_five['tags']['name'] == "Test Tag 5" + - test_five['tags']['slug'] == "test-tag-five" + - test_five['msg'] == "tags Test Tag 5 created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_tenant.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_tenant.yml new file mode 100644 index 00000000..7c9af8b9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_tenant.yml @@ -0,0 +1,106 @@ +--- +## +## +### NETBOX_TENANT +## +## +- name: "1 - Test tenant creation" + netbox.netbox.netbox_tenant: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Tenant ABC" + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['tenant']['name'] == "Tenant ABC" + - test_one['tenant']['slug'] == "tenant-abc" + - test_one['msg'] == "tenant Tenant ABC created" + +- name: "Test duplicate tenant" + netbox.netbox.netbox_tenant: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Tenant ABC" + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['tenant']['name'] == "Tenant ABC" + - test_two['tenant']['slug'] == "tenant-abc" + - test_two['msg'] == "tenant Tenant ABC already exists" + +- name: "3 - Test update" + netbox.netbox.netbox_tenant: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Tenant ABC" + description: "Updated description" + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['after']['description'] == "Updated description" + - test_three['tenant']['name'] == "Tenant ABC" + - test_three['tenant']['slug'] == "tenant-abc" + - test_three['tenant']['description'] == "Updated description" + - test_three['msg'] == "tenant Tenant ABC updated" + +- name: "4 - Test delete" + netbox.netbox.netbox_tenant: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Tenant ABC" + state: "absent" + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "tenant Tenant ABC deleted" + +- name: "5 - Create tenant with all parameters" + netbox.netbox.netbox_tenant: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Tenant ABC" + description: "ABC Incorporated" + comments: "### This tenant is super cool" + tenant_group: "Test Tenant Group" + slug: "tenant_abc" + tags: + - "tagA" + - "tagB" + - "tagC" + state: present + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['tenant']['name'] == "Tenant ABC" + - test_five['tenant']['slug'] == "tenant_abc" + - test_five['tenant']['description'] == "ABC Incorporated" + - test_five['tenant']['comments'] == "### This tenant is super cool" + - test_five['tenant']['group'] == 1 + - test_five['tenant']['tags'] | length == 3 + - test_five['msg'] == "tenant Tenant ABC created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_tenant_group.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_tenant_group.yml new file mode 100644 index 00000000..2ee81464 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_tenant_group.yml @@ -0,0 +1,75 @@ +--- +## +## +### NETBOX_TENANT_GROUP +## +## +- name: "1 - Test tenant group creation" + netbox.netbox.netbox_tenant_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tenant Group Two" + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['tenant_group']['name'] == "Test Tenant Group Two" + - test_one['tenant_group']['slug'] == "test-tenant-group-two" + - test_one['msg'] == "tenant_group Test Tenant Group Two created" + +- name: "Test duplicate tenant group" + netbox.netbox.netbox_tenant_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tenant Group Two" + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['tenant_group']['name'] == "Test Tenant Group Two" + - test_two['tenant_group']['slug'] == "test-tenant-group-two" + - test_two['msg'] == "tenant_group Test Tenant Group Two already exists" + +- name: "3 - Test delete" + netbox.netbox.netbox_tenant_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tenant Group Two" + state: "absent" + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "present" + - test_three['diff']['after']['state'] == "absent" + - test_three['msg'] == "tenant_group Test Tenant Group Two deleted" + +- name: "4 - Test another tenant group creation" + netbox.netbox.netbox_tenant_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tenant Group ABC" + slug: "test_tenant_group_four" + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['tenant_group']['name'] == "Test Tenant Group ABC" + - test_four['tenant_group']['slug'] == "test_tenant_group_four" + - test_four['msg'] == "tenant_group Test Tenant Group ABC created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_virtual_chassis.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_virtual_chassis.yml new file mode 100644 index 00000000..04ada841 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_virtual_chassis.yml @@ -0,0 +1,131 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_VIRTUAL_CHASSIS +## +## +- name: "VIRTUAL_CHASSIS 0: Create device for testing virtual chassis" + netbox.netbox.netbox_device: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Device Virtual Chassis Tests + device_type: Cisco Test + device_role: Core Switch + site: Test Site + vc_position: 1 + vc_priority: 1 + state: present + +- name: "VIRTUAL_CHASSIS 1: Necessary info creation" + netbox.netbox.netbox_virtual_chassis: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "First VC" + master: Device Virtual Chassis Tests + state: present + register: test_one + +- name: "VIRTUAL_CHASSIS 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['virtual_chassis']['master'] == 11 + - test_one['virtual_chassis']['name'] == "First VC" + - test_one['msg'] == "virtual_chassis First VC created" + +- name: "VIRTUAL_CHASSIS 2: Create duplicate" + netbox.netbox.netbox_virtual_chassis: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "First VC" + master: Device Virtual Chassis Tests + state: present + register: test_two + +- name: "VIRTUAL_CHASSIS 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['virtual_chassis']['master'] == 11 + - test_two['virtual_chassis']['name'] == "First VC" + - test_two['msg'] == "virtual_chassis First VC already exists" + +- name: "POWER_FEED 3: Update virtual_chassis with other fields" + netbox.netbox.netbox_virtual_chassis: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "First VC" + master: Device Virtual Chassis Tests + domain: Domain Text + state: present + register: test_three + +- name: "POWER_FEED 3: ASSERT - Update virtual_chassis with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['domain'] == "Domain Text" + - test_three['virtual_chassis']['master'] == 11 + - test_three['virtual_chassis']['domain'] == "Domain Text" + - test_three['virtual_chassis']['name'] == "First VC" + - test_three['msg'] == "virtual_chassis First VC updated" + +- name: "VIRTUAL_CHASSIS 4: Create device for testing virtual chassis deletion" + netbox.netbox.netbox_device: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Device Virtual Chassis Tests 2 + device_type: Cisco Test + device_role: Core Switch + site: Test Site + vc_position: 1 + vc_priority: 15 + state: present + +- name: "VIRTUAL_CHASSIS 4: Create Virtual Chassis for Delete Test" + netbox.netbox.netbox_virtual_chassis: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Second VC" + master: Device Virtual Chassis Tests 2 + state: present + register: test_four + +- name: "VIRTUAL_CHASSIS 4: ASSERT - Create Virtual Chassis for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['virtual_chassis']['master'] == 12 + - test_four['virtual_chassis']['name'] == "Second VC" + - test_four['msg'] == "virtual_chassis Second VC created" + +- name: "VIRTUAL_CHASSIS 5: Delete Virtual Chassis" + netbox.netbox.netbox_virtual_chassis: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Second VC" + master: Device Virtual Chassis Tests 2 + state: absent + register: test_five + +- name: "VIRTUAL_CHASSIS 5: ASSERT - Delete Virtual Chassis" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "virtual_chassis Second VC deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_virtual_machine.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_virtual_machine.yml new file mode 100644 index 00000000..05e88bf6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_virtual_machine.yml @@ -0,0 +1,99 @@ +--- +## +## +### NETBOX_VIRTUAL_MACHINES +## +## +- name: "VIRTUAL_MACHINE 1: Necessary info creation" + netbox.netbox.netbox_virtual_machine: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VM One" + cluster: "Test Cluster" + state: present + register: test_one + +- name: "VIRTUAL_MACHINE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['virtual_machine']['name'] == "Test VM One" + - test_one['virtual_machine']['cluster'] == 1 + - test_one['msg'] == "virtual_machine Test VM One created" + +- name: "VIRTUAL_MACHINE 2: Create duplicate" + netbox.netbox.netbox_virtual_machine: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VM One" + cluster: "Test Cluster" + state: present + register: test_two + +- name: "VIRTUAL_MACHINE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['virtual_machine']['name'] == "Test VM One" + - test_two['virtual_machine']['cluster'] == 1 + - test_two['msg'] == "virtual_machine Test VM One already exists" + +- name: "VIRTUAL_MACHINE 3: Update" + netbox.netbox.netbox_virtual_machine: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VM One" + cluster: "Test Cluster" + vcpus: 8 + memory: 8 + status: "Planned" + virtual_machine_role: "Test VM Role" + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "VIRTUAL_MACHINE 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['vcpus'] == 8 + - test_three['diff']['after']['memory'] == 8 + - test_three['diff']['after']['status'] == "planned" + - test_three['diff']['after']['role'] == 2 + - test_three['diff']['after']['tags'][0] == 4 + - test_three['virtual_machine']['name'] == "Test VM One" + - test_three['virtual_machine']['cluster'] == 1 + - test_three['virtual_machine']['vcpus'] == 8 + - test_three['virtual_machine']['memory'] == 8 + - test_three['virtual_machine']['status'] == "planned" + - test_three['virtual_machine']['role'] == 2 + - test_three['virtual_machine']['tags'][0] == 4 + - test_three['msg'] == "virtual_machine Test VM One updated" + +- name: "VIRTUAL_MACHINE 4: ASSERT - Delete" + netbox.netbox.netbox_virtual_machine: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VM One" + state: absent + register: test_four + +- name: "VIRTUAL_MACHINE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['virtual_machine']['name'] == "Test VM One" + - test_four['virtual_machine']['cluster'] == 1 + - test_four['virtual_machine']['vcpus'] == 8 + - test_four['virtual_machine']['memory'] == 8 + - test_four['virtual_machine']['status'] == "planned" + - test_four['virtual_machine']['role'] == 2 + - test_four['virtual_machine']['tags'][0] == 4 + - test_four['msg'] == "virtual_machine Test VM One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vlan.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vlan.yml new file mode 100644 index 00000000..d95abbec --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vlan.yml @@ -0,0 +1,193 @@ +--- +## +## +### NETBOX_VLAN +## +## +- name: "VLAN 1: Necessary info creation" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VLAN 500 + vid: 500 + state: present + register: test_one + +- name: "VLAN 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['vlan']['name'] == "Test VLAN 500" + - test_one['vlan']['vid'] == 500 + - test_one['msg'] == "vlan Test VLAN 500 created" + +- name: "VLAN 2: Create duplicate" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VLAN 500 + vid: 500 + state: present + register: test_two + +- name: "VLAN 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['vlan']['name'] == "Test VLAN 500" + - test_two['vlan']['vid'] == 500 + - test_two['msg'] == "vlan Test VLAN 500 already exists" + +- name: "VLAN 3: Create VLAN with same name, but different site" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VLAN 500 + vid: 500 + site: Test Site + tenant: Test Tenant + vlan_group: "Test VLAN Group" + state: present + register: test_three + +- name: "VLAN 3: ASSERT - Create VLAN with same name, but different site" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['vlan']['name'] == "Test VLAN 500" + - test_three['vlan']['vid'] == 500 + - test_three['vlan']['site'] == 1 + - test_three['vlan']['group'] == 1 + - test_three['msg'] == "vlan Test VLAN 500 created" + +- name: "VLAN 4: ASSERT - Update" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VLAN 500" + vid: 500 + tenant: "Test Tenant" + vlan_group: "Test VLAN Group" + status: Reserved + vlan_role: Network of care + description: Updated description + site: "Test Site" + tags: + - "Schnozzberry" + state: present + register: test_four + +- name: "VLAN 4: ASSERT - Updated" + assert: + that: + - test_four is changed + - test_four['diff']['after']['status'] == "reserved" + - test_four['diff']['after']['role'] == 1 + - test_four['diff']['after']['description'] == "Updated description" + - test_four['diff']['after']['tags'][0] == 4 + - test_four['vlan']['name'] == "Test VLAN 500" + - test_four['vlan']['tenant'] == 1 + - test_four['vlan']['site'] == 1 + - test_four['vlan']['group'] == 1 + - test_four['vlan']['status'] == "reserved" + - test_four['vlan']['role'] == 1 + - test_four['vlan']['description'] == "Updated description" + - test_four['vlan']['tags'][0] == 4 + - test_four['msg'] == "vlan Test VLAN 500 updated" + +- name: "VLAN: ASSERT - IDEMPOTENT WITH VLAN_GROUP" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VLAN 500" + vid: 500 + tenant: "Test Tenant" + vlan_group: "Test VLAN Group" + status: Reserved + vlan_role: Network of care + description: Updated description + site: "Test Site" + tags: + - "Schnozzberry" + state: present + register: idempotent_vlan_group + +- name: "VLAN: ASSERT - IDEMPOTENT WITH VLAN_GROUP" + assert: + that: + - idempotent_vlan_group is not changed + +- name: "VLAN: Create VLAN with same name, but different vlan_group" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VLAN 500 + vid: 500 + site: Test Site + tenant: Test Tenant + vlan_group: "Test VLAN Group 2" + state: present + register: new_vlan_group + +- name: "VLAN: ASSERT - Create VLAN with same name, but different vlan_group" + assert: + that: + - new_vlan_group is changed + - new_vlan_group['diff']['before']['state'] == "absent" + - new_vlan_group['diff']['after']['state'] == "present" + - new_vlan_group['vlan']['name'] == "Test VLAN 500" + - new_vlan_group['vlan']['vid'] == 500 + - new_vlan_group['vlan']['site'] == 1 + - new_vlan_group['vlan']['group'] == 2 + - new_vlan_group['msg'] == "vlan Test VLAN 500 created" + +- name: "VLAN 5: ASSERT - Delete more than one result" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VLAN 500" + state: absent + ignore_errors: yes + register: test_five + +- name: "VLAN 5: ASSERT - Delete more than one result" + assert: + that: + - test_five is failed + - test_five['msg'] == "More than one result returned for Test VLAN 500" + +- name: "VLAN 6: ASSERT - Delete" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VLAN 500" + site: Test Site + vlan_group: "Test VLAN Group" + state: absent + register: test_six + +- name: "VLAN 6: ASSERT - Delete" + assert: + that: + - test_six is changed + - test_six['vlan']['name'] == "Test VLAN 500" + - test_six['vlan']['tenant'] == 1 + - test_six['vlan']['site'] == 1 + - test_six['vlan']['group'] == 1 + - test_six['vlan']['status'] == "reserved" + - test_six['vlan']['role'] == 1 + - test_six['vlan']['description'] == "Updated description" + - test_six['vlan']['tags'][0] == 4 + - test_six['msg'] == "vlan Test VLAN 500 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vlan_group.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vlan_group.yml new file mode 100644 index 00000000..df59a169 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vlan_group.yml @@ -0,0 +1,118 @@ +--- +## +## +### NETBOX_VLAN_GROUP +## +## +- name: "VLAN_GROUP 1: Necessary info creation" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "VLAN Group One" + site: Test Site + state: present + register: test_one + +- name: "VLAN_GROUP 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['vlan_group']['name'] == "VLAN Group One" + - test_one['vlan_group']['slug'] == "vlan-group-one" + - test_one['vlan_group']['site'] == 1 + - test_one['msg'] == "vlan_group VLAN Group One created" + +- name: "VLAN_GROUP 2: Create duplicate" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "VLAN Group One" + site: Test Site + state: present + register: test_two + +- name: "VLAN_GROUP 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['vlan_group']['name'] == "VLAN Group One" + - test_two['vlan_group']['slug'] == "vlan-group-one" + - test_two['vlan_group']['site'] == 1 + - test_two['msg'] == "vlan_group VLAN Group One already exists" + +- name: "VLAN_GROUP 3: ASSERT - Create with same name, different site" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "VLAN Group One" + site: "Test Site2" + state: present + register: test_three + +- name: "VLAN_GROUP 3: ASSERT - Create with same name, different site" + assert: + that: + - test_three is changed + - test_three['vlan_group']['name'] == "VLAN Group One" + - test_three['vlan_group']['slug'] == "vlan-group-one" + - test_three['vlan_group']['site'] == 2 + - test_three['msg'] == "vlan_group VLAN Group One created" + +- name: "VLAN_GROUP 4: ASSERT - Create vlan group, no site" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "VLAN Group One" + state: present + ignore_errors: yes + register: test_four + +- name: "VLAN_GROUP 4: ASSERT - Create with same name, different site" + assert: + that: + - test_four is failed + - test_four['msg'] == "More than one result returned for VLAN Group One" + +- name: "VLAN_GROUP 5: ASSERT - Delete" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: VLAN Group One + site: Test Site2 + state: absent + register: test_five + +- name: "VLAN_GROUP 5: ASSERT - Delete" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['vlan_group']['name'] == "VLAN Group One" + - test_five['vlan_group']['slug'] == "vlan-group-one" + - test_five['vlan_group']['site'] == 2 + - test_five['msg'] == "vlan_group VLAN Group One deleted" + +- name: "VLAN_GROUP 6: ASSERT - Delete non existing" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: VLAN Group One + site: Test Site2 + state: absent + register: test_six + +- name: "VLAN_GROUP 6: ASSERT - Delete non existing`" + assert: + that: + - not test_six['changed'] + - test_six['vlan_group'] == None + - test_six['msg'] == "vlan_group VLAN Group One already absent" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vm_interface.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vm_interface.yml new file mode 100644 index 00000000..56a60e22 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vm_interface.yml @@ -0,0 +1,159 @@ +--- +## +## +### NETBOX_VM_INTERFACE +## +## +- name: "NETBOX_VM_INTERFACE 1: Necessary info creation" + netbox.netbox.netbox_vm_interface: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + virtual_machine: "test100-vm" + name: "Eth10" + state: present + register: test_one + +- name: "NETBOX_VM_INTERFACE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['interface']['name'] == "Eth10" + - test_one['interface']['virtual_machine'] == 1 + - test_one['msg'] == "interface Eth10 created" + +- name: "NETBOX_VM_INTERFACE 2: Create duplicate" + netbox.netbox.netbox_vm_interface: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + virtual_machine: "test100-vm" + name: "Eth10" + state: present + register: test_two + +- name: "NETBOX_VM_INTERFACE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['interface']['name'] == "Eth10" + - test_two['interface']['virtual_machine'] == 1 + - test_two['msg'] == "interface Eth10 already exists" + +- name: "NETBOX_VM_INTERFACE 3: Updated" + netbox.netbox.netbox_vm_interface: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + virtual_machine: "test100-vm" + name: "Eth10" + enabled: false + mtu: 9000 + mac_address: "00:00:00:AA:AA:01" + description: "Updated test100-vm" + mode: Tagged + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "NETBOX_VM_INTERFACE 4: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['enabled'] == false + - test_three['diff']['after']['mtu'] == 9000 + - test_three['diff']['after']['mac_address'] == "00:00:00:AA:AA:01" + - test_three['diff']['after']['description'] == "Updated test100-vm" + - test_three['diff']['after']['mode'] == "tagged" + - test_three['diff']['after']['untagged_vlan'] == 1 + - test_three['diff']['after']['tagged_vlans'] == [2, 3] + - test_three['diff']['after']['tags'][0] == 4 + - test_three['interface']['name'] == "Eth10" + - test_three['interface']['virtual_machine'] == 1 + - test_three['interface']['enabled'] == false + - test_three['interface']['mtu'] == 9000 + - test_three['interface']['mac_address'] == "00:00:00:AA:AA:01" + - test_three['interface']['description'] == "Updated test100-vm" + - test_three['interface']['mode'] == "tagged" + - test_three['interface']['untagged_vlan'] == 1 + - test_three['interface']['tagged_vlans'] == [2, 3] + - test_three['interface']['tags'][0] == 4 + - test_three['msg'] == "interface Eth10 updated" + +- name: "NETBOX_VM_INTERFACE 4: ASSERT - Delete" + netbox.netbox.netbox_vm_interface: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Eth10" + virtual_machine: "test100-vm" + state: absent + register: test_four + +- name: "NETBOX_VM_INTERFACE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['interface']['name'] == "Eth10" + - test_four['interface']['virtual_machine'] == 1 + - test_four['msg'] == "interface Eth10 deleted" + +- name: "NETBOX_VM_INTERFACE 5: Attempt to update interface with same name on other VMs" + netbox.netbox.netbox_vm_interface: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + virtual_machine: "test100-vm" + name: "Eth0" + enabled: false + mtu: 9000 + mac_address: "00:00:00:AA:AA:01" + description: "Updated test100-vm Eth0 intf" + mode: Tagged + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + tags: + - "Schnozzberry" + state: present + register: test_five + +- name: "NETBOX_VM_INTERFACE 5: ASSERT - Updated" + assert: + that: + - test_five is changed + - test_five['diff']['after']['enabled'] == false + - test_five['diff']['after']['mtu'] == 9000 + - test_five['diff']['after']['mac_address'] == "00:00:00:AA:AA:01" + - test_five['diff']['after']['description'] == "Updated test100-vm Eth0 intf" + - test_five['diff']['after']['mode'] == "tagged" + - test_five['diff']['after']['untagged_vlan'] == 1 + - test_five['diff']['after']['tagged_vlans'] == [2, 3] + - test_five['diff']['after']['tags'][0] == 4 + - test_five['interface']['name'] == "Eth0" + - test_five['interface']['virtual_machine'] == 1 + - test_five['interface']['enabled'] == false + - test_five['interface']['mtu'] == 9000 + - test_five['interface']['mac_address'] == "00:00:00:AA:AA:01" + - test_five['interface']['description'] == "Updated test100-vm Eth0 intf" + - test_five['interface']['mode'] == "tagged" + - test_five['interface']['untagged_vlan'] == 1 + - test_five['interface']['tagged_vlans'] == [2, 3] + - test_five['interface']['tags'][0] == 4 + - test_five['msg'] == "interface Eth0 updated" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vrf.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vrf.yml new file mode 100644 index 00000000..093e4446 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/latest/tasks/netbox_vrf.yml @@ -0,0 +1,128 @@ +--- +## +## +### NETBOX_VRF +## +## +- name: "VRF 1: Necessary info creation" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VRF One + state: present + register: test_one + +- name: "VRF 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['vrf']['name'] == "Test VRF One" + - test_one['msg'] == "vrf Test VRF One created" + +- name: "VRF 2: Create duplicate" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VRF One + state: present + register: test_two + +- name: "VRF 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['vrf']['name'] == "Test VRF One" + - test_two['msg'] == "vrf Test VRF One already exists" + +- name: "VRF 3: Create VRF with same name, but different tenant" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VRF One + tenant: Test Tenant + state: present + register: test_three + +- name: "VRF 3: ASSERT - Create VRF with same name, but different site" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['vrf']['name'] == "Test VRF One" + - test_three['vrf']['tenant'] == 1 + - test_three['msg'] == "vrf Test VRF One created" + +- name: "VRF 4: ASSERT - Update" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VRF One" + rd: "65001:1" + enforce_unique: False + tenant: "Test Tenant" + description: Updated description + tags: + - "Schnozzberry" + state: present + register: test_four + +- name: "VRF 4: ASSERT - Updated" + assert: + that: + - test_four is changed + - test_four['diff']['after']['rd'] == "65001:1" + - test_four['diff']['after']['enforce_unique'] == false + - test_four['diff']['after']['description'] == "Updated description" + - test_four['diff']['after']['tags'][0] == 4 + - test_four['vrf']['name'] == "Test VRF One" + - test_four['vrf']['tenant'] == 1 + - test_four['vrf']['rd'] == "65001:1" + - test_four['vrf']['enforce_unique'] == false + - test_four['vrf']['description'] == "Updated description" + - test_four['vrf']['tags'][0] == 4 + - test_four['msg'] == "vrf Test VRF One updated" + +- name: "VRF 5: ASSERT - Delete more than one result" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VRF One" + state: absent + ignore_errors: yes + register: test_five + +- name: "VRF 5: ASSERT - Delete more than one result" + assert: + that: + - test_five is failed + - test_five['msg'] == "More than one result returned for Test VRF One" + +- name: "VRF 6: ASSERT - Delete" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VRF One" + tenant: Test Tenant + state: absent + register: test_six + +- name: "VRF 6: ASSERT - Delete" + assert: + that: + - test_six is changed + - test_six['vrf']['name'] == "Test VRF One" + - test_six['vrf']['tenant'] == 1 + - test_six['vrf']['rd'] == "65001:1" + - test_six['vrf']['enforce_unique'] == false + - test_six['vrf']['description'] == "Updated description" + - test_six['vrf']['tags'][0] == 4 + - test_six['msg'] == "vrf Test VRF One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/regression-latest/tasks/main.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/regression-latest/tasks/main.yml new file mode 100644 index 00000000..0f13616b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/regression-latest/tasks/main.yml @@ -0,0 +1,197 @@ +--- +## +## +### TEST NETBOX CONNECTION FAILURE +## +## +- name: "TEST NETBOX CONNECTION FAILURE" + connection: local + block: + - name: "1 - Device with required information" + netbox.netbox.netbox_device: + netbox_url: "http://some-random-invalid-URL" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + state: present + register: test_one + ignore_errors: yes + + - name: "1 - ASSERT" + assert: + that: + - test_one is failed + - test_one['msg'] == "Failed to establish connection to Netbox API" + + - name: "2 - Check to see if netbox_prefix with parent defined will pass via check-mode" + netbox.netbox.netbox_prefix: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + parent: "10.10.0.0/16" + prefix_length: 24 + first_available: yes + state: present + register: test_two + check_mode: yes + + - name: "2 - ASSERT" + assert: + that: + - test_two is changed + - test_two['msg'] == "New prefix created within 10.10.0.0/16" + + - name: "3 - Add device with tags - Setup device to test #242" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + tags: + - slug: first + - slug: second + + - name: "4 - Add device with tags out of order - shouldn't change - Tests #242 is fixed" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + tags: + - slug: second + - slug: first + register: test_four + diff: yes + + - name: "4 - Assert not changed - Tests #242 is fixed" + assert: + that: + - not test_four["changed"] + + - name: "5 - Add device with extra tag - Tests #242 is fixed" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + asset_tag: "1234" + tags: + - slug: second + - slug: third + - slug: first + register: test_five + diff: yes + + - name: "5 - Assert added tag - Tests #242 is fixed" + assert: + that: + - test_five is changed + - test_five["diff"]["after"]["tags"] is defined + - test_five["device"]["tags"] is defined + + - name: "6 - Loop through and add interface templates to different device interface templates - Fixes #282" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "SFP+ (10GE)" + type: "SFP+ (10GE)" + device_type: "{{ item }}" + register: test_six + loop: + - "Cisco Test" + - "Arista Test" + - "Nexus Child" + - "Nexus Parent" + + - name: "6 - Assert device type is correct - Fixes #282" + assert: + that: + - test_six.results[0]["diff"]["before"]["state"] == "absent" + - test_six.results[0]["diff"]["after"]["state"] == "present" + - test_six.results[0]["interface_template"]["device_type"] == 1 + - test_six.results[1]["diff"]["before"]["state"] == "absent" + - test_six.results[1]["diff"]["after"]["state"] == "present" + - test_six.results[1]["interface_template"]["device_type"] == 2 + - test_six.results[2]["diff"]["before"]["state"] == "absent" + - test_six.results[2]["diff"]["after"]["state"] == "present" + - test_six.results[2]["interface_template"]["device_type"] == 4 + - test_six.results[3]["diff"]["before"]["state"] == "absent" + - test_six.results[3]["diff"]["after"]["state"] == "present" + - test_six.results[3]["interface_template"]["device_type"] == 3 + + - name: "7 - Don't prevent updates to other params if tags are specified" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + asset_tag: "Null" + tags: + # Changed these for issue #407 to be IDs + - 2 + - 3 + - 1 + register: test_seven + + - name: "5 - Assert added tag - Tests #242 is fixed" + assert: + that: + - test_seven is changed + - test_seven["diff"]["after"]["asset_tag"] == "Null" + - test_seven["device"]["asset_tag"] == "Null" + + - name: Add ip address to netbox and don't assign it to a device (Issue 372) + netbox.netbox.netbox_ip_address: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + address: 10.255.255.1/24 + query_params: + - address + - vrf + state: present + + - name: Update same ip address to attach to a device interface (Issue 372) + netbox.netbox.netbox_ip_address: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + address: 10.255.255.1/24 + assigned_object: + device: test100 + name: GigabitEthernet1 + query_params: + - address + - vrf + state: present + register: query_params_372 + + - name: Assert ip address was updated and added to device interface + assert: + that: + - query_params_372 is changed + - query_params_372['msg'] == 'ip_address 10.255.255.1/24 updated' + - query_params_372['diff']['after']['assigned_object'] == 3 + - query_params_372['diff']['after']['assigned_object_id'] == 3 + - query_params_372['diff']['after']['assigned_object_type'] == 'dcim.interface' diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/regression-v2.9/tasks/main.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/regression-v2.9/tasks/main.yml new file mode 100644 index 00000000..0f13616b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/regression-v2.9/tasks/main.yml @@ -0,0 +1,197 @@ +--- +## +## +### TEST NETBOX CONNECTION FAILURE +## +## +- name: "TEST NETBOX CONNECTION FAILURE" + connection: local + block: + - name: "1 - Device with required information" + netbox.netbox.netbox_device: + netbox_url: "http://some-random-invalid-URL" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + state: present + register: test_one + ignore_errors: yes + + - name: "1 - ASSERT" + assert: + that: + - test_one is failed + - test_one['msg'] == "Failed to establish connection to Netbox API" + + - name: "2 - Check to see if netbox_prefix with parent defined will pass via check-mode" + netbox.netbox.netbox_prefix: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + parent: "10.10.0.0/16" + prefix_length: 24 + first_available: yes + state: present + register: test_two + check_mode: yes + + - name: "2 - ASSERT" + assert: + that: + - test_two is changed + - test_two['msg'] == "New prefix created within 10.10.0.0/16" + + - name: "3 - Add device with tags - Setup device to test #242" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + tags: + - slug: first + - slug: second + + - name: "4 - Add device with tags out of order - shouldn't change - Tests #242 is fixed" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + tags: + - slug: second + - slug: first + register: test_four + diff: yes + + - name: "4 - Assert not changed - Tests #242 is fixed" + assert: + that: + - not test_four["changed"] + + - name: "5 - Add device with extra tag - Tests #242 is fixed" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + asset_tag: "1234" + tags: + - slug: second + - slug: third + - slug: first + register: test_five + diff: yes + + - name: "5 - Assert added tag - Tests #242 is fixed" + assert: + that: + - test_five is changed + - test_five["diff"]["after"]["tags"] is defined + - test_five["device"]["tags"] is defined + + - name: "6 - Loop through and add interface templates to different device interface templates - Fixes #282" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "SFP+ (10GE)" + type: "SFP+ (10GE)" + device_type: "{{ item }}" + register: test_six + loop: + - "Cisco Test" + - "Arista Test" + - "Nexus Child" + - "Nexus Parent" + + - name: "6 - Assert device type is correct - Fixes #282" + assert: + that: + - test_six.results[0]["diff"]["before"]["state"] == "absent" + - test_six.results[0]["diff"]["after"]["state"] == "present" + - test_six.results[0]["interface_template"]["device_type"] == 1 + - test_six.results[1]["diff"]["before"]["state"] == "absent" + - test_six.results[1]["diff"]["after"]["state"] == "present" + - test_six.results[1]["interface_template"]["device_type"] == 2 + - test_six.results[2]["diff"]["before"]["state"] == "absent" + - test_six.results[2]["diff"]["after"]["state"] == "present" + - test_six.results[2]["interface_template"]["device_type"] == 4 + - test_six.results[3]["diff"]["before"]["state"] == "absent" + - test_six.results[3]["diff"]["after"]["state"] == "present" + - test_six.results[3]["interface_template"]["device_type"] == 3 + + - name: "7 - Don't prevent updates to other params if tags are specified" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + asset_tag: "Null" + tags: + # Changed these for issue #407 to be IDs + - 2 + - 3 + - 1 + register: test_seven + + - name: "5 - Assert added tag - Tests #242 is fixed" + assert: + that: + - test_seven is changed + - test_seven["diff"]["after"]["asset_tag"] == "Null" + - test_seven["device"]["asset_tag"] == "Null" + + - name: Add ip address to netbox and don't assign it to a device (Issue 372) + netbox.netbox.netbox_ip_address: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + address: 10.255.255.1/24 + query_params: + - address + - vrf + state: present + + - name: Update same ip address to attach to a device interface (Issue 372) + netbox.netbox.netbox_ip_address: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + address: 10.255.255.1/24 + assigned_object: + device: test100 + name: GigabitEthernet1 + query_params: + - address + - vrf + state: present + register: query_params_372 + + - name: Assert ip address was updated and added to device interface + assert: + that: + - query_params_372 is changed + - query_params_372['msg'] == 'ip_address 10.255.255.1/24 updated' + - query_params_372['diff']['after']['assigned_object'] == 3 + - query_params_372['diff']['after']['assigned_object_id'] == 3 + - query_params_372['diff']['after']['assigned_object_type'] == 'dcim.interface' diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/main.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/main.yml new file mode 100644 index 00000000..58829cb0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/main.yml @@ -0,0 +1,159 @@ +--- +- name: "NETBOX_DEVICE TESTS" + include_tasks: "netbox_device.yml" + +- name: "NETBOX_DEVICE_INTERFACE TESTS" + include_tasks: "netbox_device_interface.yml" + +- name: "NETBOX_DEVICE_INTERFACE_TEMPLATE TESTS" + include_tasks: "netbox_device_interface_template.yml" + +- name: "NETBOX_IP_ADDRESS TESTS" + include_tasks: "netbox_ip_address.yml" + +- name: "NETBOX_PREFIX TESTS" + include_tasks: "netbox_prefix.yml" + +- name: "NETBOX_SITE TESTS" + include_tasks: "netbox_site.yml" + +- name: "NETBOX_TENTANT TESTS" + include_tasks: "netbox_tenant.yml" + +- name: "NETBOX_TENTANT_GROUP TESTS" + include_tasks: "netbox_tenant_group.yml" + +- name: "NETBOX_RACK TESTS" + include_tasks: "netbox_rack.yml" + +- name: "NETBOX_RACK_ROLE TESTS" + include_tasks: "netbox_rack_role.yml" + +- name: "NETBOX_RACK_GROUP TESTS" + include_tasks: "netbox_rack_group.yml" + +- name: "NETBOX_MANUFACTURER TESTS" + include_tasks: "netbox_manufacturer.yml" + +- name: "NETBOX_PLATFORM TESTS" + include_tasks: "netbox_platform.yml" + +- name: "NETBOX_DEVICE_TYPE TESTS" + include_tasks: "netbox_device_type.yml" + +- name: "NETBOX_DEVICE_ROLE TESTS" + include_tasks: "netbox_device_role.yml" + +- name: "NETBOX_IPAM_ROLE TESTS" + include_tasks: "netbox_ipam_role.yml" + +- name: "NETBOX_VLAN_GROUP TESTS" + include_tasks: "netbox_vlan_group.yml" + +- name: "NETBOX_VLAN TESTS" + include_tasks: "netbox_vlan.yml" + +- name: "NETBOX_VRF TESTS" + include_tasks: "netbox_vrf.yml" + +- name: "NETBOX_RIR TESTS" + include_tasks: "netbox_rir.yml" + +- name: "NETBOX_AGGREGATE TESTS" + include_tasks: "netbox_aggregate.yml" + +- name: "NETBOX_REGION TESTS" + include_tasks: "netbox_region.yml" + +- name: "NETBOX_DEVICE_BAY TESTS" + include_tasks: "netbox_device_bay.yml" + +- name: "NETBOX_DEVICE_BAY_TEMPLATE TESTS" + include_tasks: "netbox_device_bay_template.yml" + +- name: "NETBOX_INVENTORY_ITEM TESTS" + include_tasks: "netbox_inventory_item.yml" + +- name: "NETBOX_VIRTUAL_MACHINE TESTS" + include_tasks: "netbox_virtual_machine.yml" + +- name: "NETBOX_CLUSTER TESTS" + include_tasks: "netbox_cluster.yml" + +- name: "NETBOX_CLUSTER_GROUP TESTS" + include_tasks: "netbox_cluster_group.yml" + +- name: "NETBOX_CLUSTER_TYPE TESTS" + include_tasks: "netbox_cluster_type.yml" + +- name: "NETBOX_VM_INTERFACE TESTS" + include_tasks: "netbox_vm_interface.yml" + +- name: "NETBOX_PROVIDER TESTS" + include_tasks: "netbox_provider.yml" + +- name: "NETBOX_CIRCUIT_TYPE TESTS" + include_tasks: "netbox_circuit_type.yml" + +- name: "NETBOX_CIRCUIT TESTS" + include_tasks: "netbox_circuit.yml" + +- name: "NETBOX_CIRCUIT_TERMINATION TESTS" + include_tasks: "netbox_circuit_termination.yml" + +- name: "NETBOX_REAR_PORT TESTS" + include_tasks: "netbox_rear_port.yml" + +- name: "NETBOX_REAR_PORT_TEMPLATE TESTS" + include_tasks: "netbox_rear_port_template.yml" + +- name: "NETBOX_FRONT_PORT TESTS" + include_tasks: "netbox_front_port.yml" + +- name: "NETBOX_FRONT_PORT_TEMPLATE TESTS" + include_tasks: "netbox_front_port_template.yml" + +- name: "NETBOX_CONSOLE_PORT TESTS" + include_tasks: "netbox_console_port.yml" + +- name: "NETBOX_CONSOLE_PORT_TEMPLATE TESTS" + include_tasks: "netbox_console_port_template.yml" + +- name: "NETBOX_CONSOLE_SERVER_PORT TESTS" + include_tasks: "netbox_console_server_port.yml" + +- name: "NETBOX_CONSOLE_SERVER_PORT_TEMPLATE TESTS" + include_tasks: "netbox_console_server_port_template.yml" + +- name: "NETBOX_POWER_PANEL TESTS" + include_tasks: "netbox_power_panel.yml" + +- name: "NETBOX_POWER_FEED TESTS" + include_tasks: "netbox_power_feed.yml" + +- name: "NETBOX_POWER_PORT TESTS" + include_tasks: "netbox_power_port.yml" + +- name: "NETBOX_POWER_PORT_TEMPLATE TESTS" + include_tasks: "netbox_power_port_template.yml" + +- name: "NETBOX_POWER_OUTLET TESTS" + include_tasks: "netbox_power_outlet.yml" + +- name: "NETBOX_POWER_OUTLET_TEMPLATE TESTS" + include_tasks: "netbox_power_outlet_template.yml" + +- name: "NETBOX_VIRTUAL_CHASSIS TESTS" + include_tasks: "netbox_virtual_chassis.yml" + +- name: "NETBOX_CABLE TESTS" + include_tasks: "netbox_cable.yml" + +- name: "NETBOX_SERVICE TESTS" + include_tasks: "netbox_service.yml" + +- name: "NETBOX_LOOKUP TESTS" + include_tasks: "netbox_lookup.yml" + +- name: "NETBOX_TAG_TESTS" + include_tasks: "netbox_tag.yml" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_aggregate.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_aggregate.yml new file mode 100644 index 00000000..8fbd2b7d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_aggregate.yml @@ -0,0 +1,115 @@ +--- +## +## +### NETBOX_AGGEGATE +## +## +- name: "AGGREGATE 1: Necessary info creation" + netbox.netbox.netbox_aggregate: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: "10.0.0.0/8" + rir: "Example RIR" + state: present + register: test_one + +- name: "AGGREGATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['aggregate']['prefix'] == "10.0.0.0/8" + - test_one['aggregate']['family'] == 4 + - test_one['aggregate']['rir'] == 1 + - test_one['msg'] == "aggregate 10.0.0.0/8 created" + +- name: "AGGREGATE 2: Create duplicate" + netbox.netbox.netbox_aggregate: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: "10.0.0.0/8" + state: present + register: test_two + +- name: "AGGREGATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['aggregate']['prefix'] == "10.0.0.0/8" + - test_two['aggregate']['family'] == 4 + - test_two['aggregate']['rir'] == 1 + - test_two['msg'] == "aggregate 10.0.0.0/8 already exists" + +- name: "AGGREGATE 3: ASSERT - Update" + netbox.netbox.netbox_aggregate: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: "10.0.0.0/8" + rir: "Example RIR" + date_added: "1989-01-18" + description: "Test Description" + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "AGGREGATE 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['date_added'] == "1989-01-18" + - test_three['diff']['after']['description'] == "Test Description" + - test_three['diff']['after']['tags'][0] == 4 + - test_three['aggregate']['prefix'] == "10.0.0.0/8" + - test_three['aggregate']['family'] == 4 + - test_three['aggregate']['rir'] == 1 + - test_three['aggregate']['date_added'] == "1989-01-18" + - test_three['aggregate']['description'] == "Test Description" + - test_three['aggregate']['tags'][0] == 4 + - test_three['msg'] == "aggregate 10.0.0.0/8 updated" + +- name: "AGGREGATE 4: ASSERT - Delete" + netbox.netbox.netbox_aggregate: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: "10.0.0.0/8" + state: absent + register: test_four + +- name: "AGGREGATE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['aggregate']['prefix'] == "10.0.0.0/8" + - test_four['aggregate']['family'] == 4 + - test_four['aggregate']['rir'] == 1 + - test_four['aggregate']['date_added'] == "1989-01-18" + - test_four['aggregate']['description'] == "Test Description" + - test_four['aggregate']['tags'][0] == 4 + - test_four['msg'] == "aggregate 10.0.0.0/8 deleted" + +- name: "AGGREGATE 5: Necessary info creation" + netbox.netbox.netbox_aggregate: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: "2001::/32" + rir: "Example RIR" + state: present + register: test_five + +- name: "AGGREGATE 5: ASSERT - Necessary info creation" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['aggregate']['prefix'] == "2001::/32" + - test_five['aggregate']['family'] == 6 + - test_five['aggregate']['rir'] == 1 + - test_five['msg'] == "aggregate 2001::/32 created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cable.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cable.yml new file mode 100644 index 00000000..c1af3759 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cable.yml @@ -0,0 +1,186 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_CABLE +## +## +- name: "CABLE 1: Necessary info creation" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + state: present + register: test_one + +- name: "CABLE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['cable']['termination_a_type'] == "dcim.interface" + - test_one['cable']['termination_a_id'] == 13 + - test_one['cable']['termination_b_type'] == "dcim.interface" + - test_one['cable']['termination_b_id'] == 2 + - test_one['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 created" + +- name: "CABLE 2: Create duplicate" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + state: present + register: test_two + +- name: "CABLE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['cable']['termination_a_type'] == "dcim.interface" + - test_two['cable']['termination_a_id'] == 13 + - test_two['cable']['termination_b_type'] == "dcim.interface" + - test_two['cable']['termination_b_id'] == 2 + - test_two['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 already exists" + +- name: "CABLE 3: Update Cable with other fields" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + type: mmf-om4 + status: planned + label: label123 + color: abcdef + length: 30 + length_unit: m + state: present + register: test_three + +- name: "CABLE 3: ASSERT - Update Cable with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "mmf-om4" + - test_three['diff']['after']['status'] == "planned" + - test_three['diff']['after']['label'] == "label123" + - test_three['diff']['after']['color'] == "abcdef" + - test_three['diff']['after']['length'] == 30 + - test_three['diff']['after']['length_unit'] == "m" + - test_three['cable']['termination_a_type'] == "dcim.interface" + - test_three['cable']['termination_a_id'] == 13 + - test_three['cable']['termination_b_type'] == "dcim.interface" + - test_three['cable']['termination_b_id'] == 2 + - test_three['cable']['type'] == "mmf-om4" + - test_three['cable']['status'] == "planned" + - test_three['cable']['label'] == "label123" + - test_three['cable']['color'] == "abcdef" + - test_three['cable']['length'] == 30 + - test_three['cable']['length_unit'] == "m" + - test_three['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 updated" + +- name: "CABLE 4: ASSERT - Delete" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: dcim.interface + termination_a: + device: Test Nexus Child One + name: Ethernet2/2 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + state: absent + register: test_four + +- name: "CABLE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 deleted" + +- name: "CABLE 5: Connect Console Port and Console Server Port" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: dcim.consoleserverport + termination_a: + name: Console Server Port + device: test100 + termination_b_type: dcim.consoleport + termination_b: + name: Console Port + device: test100 + state: present + register: test_five + +- name: "CABLE 5: ASSERT - Connect Console Port and Console Server Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['cable']['termination_a_type'] == "dcim.consoleserverport" + - test_five['cable']['termination_a_id'] == 1 + - test_five['cable']['termination_b_type'] == "dcim.consoleport" + - test_five['cable']['termination_b_id'] == 1 + - test_five['msg'] == "cable dcim.consoleserverport Console Server Port <> dcim.consoleport Console Port created" + +- name: "CABLE 6: Circuits Termination as side A" + netbox.netbox.netbox_cable: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + termination_a_type: circuits.circuittermination + termination_a: + circuit: "Test Circuit Two" + term_side: "A" + termination_b_type: dcim.interface + termination_b: + device: "test100" + name: "GigabitEthernet2" + state: present + register: test_six + +- name: "CABLE 6: ASSERT - Circuits Termination as side A" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "absent" + - test_six['diff']['after']['state'] == "present" + - test_six['cable']['termination_a_type'] == "circuits.circuittermination" + - test_six['cable']['termination_a_id'] == 1 + - test_six['cable']['termination_b_type'] == "dcim.interface" + - test_six['cable']['termination_b_id'] == 4 + - test_six['msg'] == "cable circuits.circuittermination 1 <> dcim.interface GigabitEthernet2 created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_circuit.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_circuit.yml new file mode 100644 index 00000000..33d1230c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_circuit.yml @@ -0,0 +1,109 @@ +--- +## +## +### NETBOX_CIRCUIT +## +## +- name: "NETBOX_CIRCUIT 1: Create provider within Netbox with only required information" + netbox.netbox.netbox_circuit: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + cid: Test Circuit One + provider: Test Provider + circuit_type: Test Circuit Type + state: present + register: test_one + +- name: "NETBOX_CIRCUIT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['circuit']['cid'] == "Test Circuit One" + - test_one['circuit']['provider'] == 1 + - test_one['circuit']['type'] == 1 + - test_one['msg'] == "circuit Test Circuit One created" + +- name: "NETBOX_CIRCUIT 2: Duplicate" + netbox.netbox.netbox_circuit: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + cid: Test Circuit One + provider: Test Provider + circuit_type: Test Circuit Type + state: present + register: test_two + +- name: "NETBOX_CIRCUIT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['circuit']['cid'] == "Test Circuit One" + - test_two['circuit']['provider'] == 1 + - test_two['circuit']['type'] == 1 + - test_two['msg'] == "circuit Test Circuit One already exists" + +- name: "NETBOX_CIRCUIT 3: Update provider with other fields" + netbox.netbox.netbox_circuit: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + cid: Test Circuit One + provider: Test Provider + circuit_type: Test Circuit Type + status: Planned + tenant: Test Tenant + install_date: "2018-12-25" + commit_rate: 10000 + description: "Test circuit " + comments: "FAST CIRCUIT" + state: present + register: test_three + +- name: "NETBOX_CIRCUIT 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['status'] == "planned" + - test_three['diff']['after']['tenant'] == 1 + - test_three['diff']['after']['install_date'] == "2018-12-25" + - test_three['diff']['after']['commit_rate'] == 10000 + - test_three['diff']['after']['description'] == "Test circuit" + - test_three['diff']['after']['comments'] == "FAST CIRCUIT" + - test_three['circuit']['cid'] == "Test Circuit One" + - test_three['circuit']['provider'] == 1 + - test_three['circuit']['type'] == 1 + - test_three['circuit']['status'] == "planned" + - test_three['circuit']['tenant'] == 1 + - test_three['circuit']['install_date'] == "2018-12-25" + - test_three['circuit']['commit_rate'] == 10000 + - test_three['circuit']['description'] == "Test circuit" + - test_three['circuit']['comments'] == "FAST CIRCUIT" + - test_three['msg'] == "circuit Test Circuit One updated" + +- name: "NETBOX_CIRCUIT 4: Delete provider within netbox" + netbox.netbox.netbox_circuit: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + cid: Test Circuit One + state: absent + register: test_four + +- name: "NETBOX_CIRCUIT 4 : ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['circuit']['cid'] == "Test Circuit One" + - test_four['circuit']['provider'] == 1 + - test_four['circuit']['type'] == 1 + - test_four['circuit']['status'] == "planned" + - test_four['circuit']['tenant'] == 1 + - test_four['circuit']['install_date'] == "2018-12-25" + - test_four['circuit']['commit_rate'] == 10000 + - test_four['circuit']['description'] == "Test circuit" + - test_four['circuit']['comments'] == "FAST CIRCUIT" + - test_four['msg'] == "circuit Test Circuit One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_circuit_termination.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_circuit_termination.yml new file mode 100644 index 00000000..6851b510 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_circuit_termination.yml @@ -0,0 +1,129 @@ +--- +## +## +### NETBOX_CIRCUIT_TERMINATION +## +## +- name: "NETBOX_CIRCUIT_TERMINATION 1: Create provider within Netbox with only required information" + netbox.netbox.netbox_circuit_termination: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + circuit: Test Circuit + term_side: A + site: "Test Site" + port_speed: 10000 + state: present + register: test_one + +- name: "NETBOX_CIRCUIT_TERMINATION 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['circuit_termination']['circuit'] == 1 + - test_one['circuit_termination']['term_side'] == "A" + - test_one['circuit_termination']['site'] == 1 + - test_one['circuit_termination']['port_speed'] == 10000 + - test_one['msg'] == "circuit_termination test_circuit_a created" + +- name: "NETBOX_CIRCUIT_TERMINATION 2: Duplicate" + netbox.netbox.netbox_circuit_termination: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + circuit: Test Circuit + term_side: A + state: present + register: test_two + +- name: "NETBOX_CIRCUIT_TERMINATION 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['circuit_termination']['circuit'] == 1 + - test_two['circuit_termination']['term_side'] == "A" + - test_two['circuit_termination']['site'] == 1 + - test_two['circuit_termination']['port_speed'] == 10000 + - test_two['msg'] == "circuit_termination test_circuit_a already exists" + +- name: "NETBOX_CIRCUIT_TERMINATION 3: Update provider with other fields" + netbox.netbox.netbox_circuit_termination: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + circuit: Test Circuit + term_side: A + upstream_speed: 1000 + xconnect_id: 10X100 + pp_info: PP10-24 + description: "Test description" + state: present + register: test_three + +- name: "NETBOX_CIRCUIT_TERMINATION 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['upstream_speed'] == 1000 + - test_three['diff']['after']['xconnect_id'] == "10X100" + - test_three['diff']['after']['pp_info'] == "PP10-24" + - test_three['diff']['after']['description'] == "Test description" + - test_three['circuit_termination']['circuit'] == 1 + - test_three['circuit_termination']['term_side'] == "A" + - test_three['circuit_termination']['site'] == 1 + - test_three['circuit_termination']['port_speed'] == 10000 + - test_three['circuit_termination']['upstream_speed'] == 1000 + - test_three['circuit_termination']['xconnect_id'] == "10X100" + - test_three['circuit_termination']['pp_info'] == "PP10-24" + - test_three['circuit_termination']['description'] == "Test description" + - test_three['msg'] == "circuit_termination test_circuit_a updated" + +- name: "NETBOX_CIRCUIT_TERMINATION 4: Create Z Side" + netbox.netbox.netbox_circuit_termination: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + circuit: Test Circuit + term_side: Z + site: "Test Site" + port_speed: 10000 + state: present + register: test_four + +- name: "NETBOX_CIRCUIT_TERMINATION 4: ASSERT - Create Z Side" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['circuit_termination']['circuit'] == 1 + - test_four['circuit_termination']['term_side'] == "Z" + - test_four['circuit_termination']['site'] == 1 + - test_four['circuit_termination']['port_speed'] == 10000 + - test_four['msg'] == "circuit_termination test_circuit_z created" + +- name: "NETBOX_CIRCUIT_TERMINATION 5: Delete provider within netbox" + netbox.netbox.netbox_circuit_termination: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + circuit: Test Circuit + term_side: A + state: absent + register: test_five + +- name: "NETBOX_CIRCUIT_TERMINATION 5: ASSERT - Delete" + assert: + that: + - test_five is changed + - test_five['circuit_termination']['circuit'] == 1 + - test_five['circuit_termination']['term_side'] == "A" + - test_five['circuit_termination']['site'] == 1 + - test_five['circuit_termination']['port_speed'] == 10000 + - test_five['circuit_termination']['upstream_speed'] == 1000 + - test_five['circuit_termination']['xconnect_id'] == "10X100" + - test_five['circuit_termination']['pp_info'] == "PP10-24" + - test_five['circuit_termination']['description'] == "Test description" + - test_five['msg'] == "circuit_termination test_circuit_a deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_circuit_type.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_circuit_type.yml new file mode 100644 index 00000000..45f956e3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_circuit_type.yml @@ -0,0 +1,96 @@ +--- +## +## +### NETBOX_CIRCUIT_TYPE +## +## +- name: "CIRCUIT_TYPE 1: Necessary info creation" + netbox.netbox.netbox_circuit_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Circuit Type One" + state: present + register: test_one + +- name: "CIRCUIT_TYPE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['circuit_type']['name'] == "Test Circuit Type One" + - test_one['circuit_type']['slug'] == "test-circuit-type-one" + - test_one['msg'] == "circuit_type Test Circuit Type One created" + +- name: "CIRCUIT_TYPE 2: Create duplicate" + netbox.netbox.netbox_circuit_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Circuit Type One" + state: present + register: test_two + +- name: "CIRCUIT_TYPE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['circuit_type']['name'] == "Test Circuit Type One" + - test_two['circuit_type']['slug'] == "test-circuit-type-one" + - test_two['msg'] == "circuit_type Test Circuit Type One already exists" + +- name: "CIRCUIT_TYPE 3: User specified slug" + netbox.netbox.netbox_circuit_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Circuit Type Two" + slug: "test-circuit-type-2" + state: present + register: test_three + +- name: "CIRCUIT_TYPE 3: ASSERT - User specified slug" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['circuit_type']['name'] == "Test Circuit Type Two" + - test_three['circuit_type']['slug'] == "test-circuit-type-2" + - test_three['msg'] == "circuit_type Test Circuit Type Two created" + +- name: "CIRCUIT_TYPE 4: ASSERT - Delete" + netbox.netbox.netbox_circuit_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Circuit Type One" + state: absent + register: test_four + +- name: "CIRCUIT_TYPE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['circuit_type']['name'] == "Test Circuit Type One" + - test_four['circuit_type']['slug'] == "test-circuit-type-one" + - test_four['msg'] == "circuit_type Test Circuit Type One deleted" + +- name: "CIRCUIT_TYPE 5: ASSERT - Delete" + netbox.netbox.netbox_circuit_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Circuit Type Two" + slug: "test-circuit-type-2" + state: absent + register: test_five + +- name: "CIRCUIT_TYPE 5: ASSERT - Delete" + assert: + that: + - test_five is changed + - test_five['circuit_type']['name'] == "Test Circuit Type Two" + - test_five['circuit_type']['slug'] == "test-circuit-type-2" + - test_five['msg'] == "circuit_type Test Circuit Type Two deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cluster.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cluster.yml new file mode 100644 index 00000000..11ba5ef8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cluster.yml @@ -0,0 +1,98 @@ +--- +## +## +### NETBOX_CLUSTER +## +## +- name: "CLUSTER 1: Necessary info creation" + netbox.netbox.netbox_cluster: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster One" + cluster_type: "Test Cluster Type" + state: present + register: test_one + +- name: "CLUSTER 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['cluster']['name'] == "Test Cluster One" + - test_one['cluster']['type'] == 1 + - test_one['msg'] == "cluster Test Cluster One created" + +- name: "CLUSTER 2: Create duplicate" + netbox.netbox.netbox_cluster: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster One" + cluster_type: "Test Cluster Type" + state: present + register: test_two + +- name: "CLUSTER 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['cluster']['name'] == "Test Cluster One" + - test_two['cluster']['type'] == 1 + - test_two['msg'] == "cluster Test Cluster One already exists" + +- name: "CLUSTER 3: Update" + netbox.netbox.netbox_cluster: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster One" + cluster_type: "Test Cluster Type" + cluster_group: "Test Cluster Group" + site: "Test Site" + comments: "Updated cluster" + tenant: "Test Tenant" + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "CLUSTER 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['group'] == 1 + - test_three['diff']['after']['site'] == 1 + - test_three['diff']['after']['comments'] == "Updated cluster" + - test_three['diff']['after']['tags'][0] == 4 + - test_three['diff']['after']['tenant'] == 1 + - test_three['cluster']['name'] == "Test Cluster One" + - test_three['cluster']['type'] == 1 + - test_three['cluster']['group'] == 1 + - test_three['cluster']['site'] == 1 + - test_three['cluster']['comments'] == "Updated cluster" + - test_three['cluster']['tags'][0] == 4 + - test_three['cluster']['tenant'] == 1 + - test_three['msg'] == "cluster Test Cluster One updated" + +- name: "CLUSTER 4: ASSERT - Delete" + netbox.netbox.netbox_cluster: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster One" + state: absent + register: test_four + +- name: "CLUSTER 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['cluster']['name'] == "Test Cluster One" + - test_four['cluster']['type'] == 1 + - test_four['cluster']['group'] == 1 + - test_four['cluster']['site'] == 1 + - test_four['cluster']['comments'] == "Updated cluster" + - test_four['cluster']['tags'][0] == 4 + - test_four['msg'] == "cluster Test Cluster One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cluster_group.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cluster_group.yml new file mode 100644 index 00000000..9f84518c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cluster_group.yml @@ -0,0 +1,96 @@ +--- +## +## +### NETBOX_CLUSTER_GROUP +## +## +- name: "CLUSTER_GROUP 1: Necessary info creation" + netbox.netbox.netbox_cluster_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Group One" + state: present + register: test_one + +- name: "CLUSTER_GROUP 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['cluster_group']['name'] == "Test Cluster Group One" + - test_one['cluster_group']['slug'] == "test-cluster-group-one" + - test_one['msg'] == "cluster_group Test Cluster Group One created" + +- name: "CLUSTER_GROUP 2: Create duplicate" + netbox.netbox.netbox_cluster_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Group One" + state: present + register: test_two + +- name: "CLUSTER_GROUP 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['cluster_group']['name'] == "Test Cluster Group One" + - test_two['cluster_group']['slug'] == "test-cluster-group-one" + - test_two['msg'] == "cluster_group Test Cluster Group One already exists" + +- name: "CLUSTER_GROUP 3: User specified slug" + netbox.netbox.netbox_cluster_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Group Two" + slug: "test-cluster-group-2" + state: present + register: test_three + +- name: "CLUSTER_GROUP 3: ASSERT - User specified slug" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['cluster_group']['name'] == "Test Cluster Group Two" + - test_three['cluster_group']['slug'] == "test-cluster-group-2" + - test_three['msg'] == "cluster_group Test Cluster Group Two created" + +- name: "CLUSTER_GROUP 4: ASSERT - Delete" + netbox.netbox.netbox_cluster_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Group One" + state: absent + register: test_four + +- name: "CLUSTER_GROUP 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['cluster_group']['name'] == "Test Cluster Group One" + - test_four['cluster_group']['slug'] == "test-cluster-group-one" + - test_four['msg'] == "cluster_group Test Cluster Group One deleted" + +- name: "CLUSTER_GROUP 5: ASSERT - Delete" + netbox.netbox.netbox_cluster_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Group Two" + slug: "test-cluster-group-2" + state: absent + register: test_five + +- name: "CLUSTER_GROUP 5: ASSERT - Delete" + assert: + that: + - test_five is changed + - test_five['cluster_group']['name'] == "Test Cluster Group Two" + - test_five['cluster_group']['slug'] == "test-cluster-group-2" + - test_five['msg'] == "cluster_group Test Cluster Group Two deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cluster_type.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cluster_type.yml new file mode 100644 index 00000000..abcaed09 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_cluster_type.yml @@ -0,0 +1,95 @@ +## +## +### NETBOX_CLUSTER_TYPE +## +## +- name: "CLUSTER_TYPE 1: Necessary info creation" + netbox.netbox.netbox_cluster_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Type One" + state: present + register: test_one + +- name: "CLUSTER_TYPE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['cluster_type']['name'] == "Test Cluster Type One" + - test_one['cluster_type']['slug'] == "test-cluster-type-one" + - test_one['msg'] == "cluster_type Test Cluster Type One created" + +- name: "CLUSTER_TYPE 2: Create duplicate" + netbox.netbox.netbox_cluster_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Type One" + state: present + register: test_two + +- name: "CLUSTER_TYPE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['cluster_type']['name'] == "Test Cluster Type One" + - test_two['cluster_type']['slug'] == "test-cluster-type-one" + - test_two['msg'] == "cluster_type Test Cluster Type One already exists" + +- name: "CLUSTER_TYPE 3: User specified slug" + netbox.netbox.netbox_cluster_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Type Two" + slug: "test-cluster-type-2" + state: present + register: test_three + +- name: "CLUSTER_TYPE 3: ASSERT - User specified slug" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['cluster_type']['name'] == "Test Cluster Type Two" + - test_three['cluster_type']['slug'] == "test-cluster-type-2" + - test_three['msg'] == "cluster_type Test Cluster Type Two created" + +- name: "CLUSTER_TYPE 4: ASSERT - Delete" + netbox.netbox.netbox_cluster_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Type One" + state: absent + register: test_four + +- name: "CLUSTER_TYPE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['cluster_type']['name'] == "Test Cluster Type One" + - test_four['cluster_type']['slug'] == "test-cluster-type-one" + - test_four['msg'] == "cluster_type Test Cluster Type One deleted" + +- name: "CLUSTER_TYPE 5: ASSERT - Delete" + netbox.netbox.netbox_cluster_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Cluster Type Two" + slug: "test-cluster-type-2" + state: absent + register: test_five + +- name: "CLUSTER_TYPE 5: ASSERT - Delete" + assert: + that: + - test_five is changed + - test_five['cluster_type']['name'] == "Test Cluster Type Two" + - test_five['cluster_type']['slug'] == "test-cluster-type-2" + - test_five['msg'] == "cluster_type Test Cluster Type Two deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_port.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_port.yml new file mode 100644 index 00000000..1c97cb8a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_port.yml @@ -0,0 +1,108 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_CONSOLE_PORT +## +## +- name: "CONSOLE_PORT 1: Necessary info creation" + netbox.netbox.netbox_console_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port + device: test100 + state: present + register: test_one + +- name: "CONSOLE_PORT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['console_port']['name'] == "Console Port" + - test_one['console_port']['device'] == 1 + - test_one['msg'] == "console_port Console Port created" + +- name: "CONSOLE_PORT 2: Create duplicate" + netbox.netbox.netbox_console_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port + device: test100 + state: present + register: test_two + +- name: "CONSOLE_PORT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['console_port']['name'] == "Console Port" + - test_two['console_port']['device'] == 1 + - test_two['msg'] == "console_port Console Port already exists" + +- name: "CONSOLE_PORT 3: Update Console Port with other fields" + netbox.netbox.netbox_console_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port + device: test100 + type: usb-a + description: test description + state: present + register: test_three + +- name: "CONSOLE_PORT 3: ASSERT - Update Console Port with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "usb-a" + - test_three['diff']['after']['description'] == "test description" + - test_three['console_port']['name'] == "Console Port" + - test_three['console_port']['device'] == 1 + - test_three['console_port']['type'] == "usb-a" + - test_three['console_port']['description'] == "test description" + - test_three['msg'] == "console_port Console Port updated" + +- name: "CONSOLE_PORT 4: Create Console Port for Delete Test" + netbox.netbox.netbox_console_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port 2 + device: test100 + state: present + register: test_four + +- name: "CONSOLE_PORT 4: ASSERT - Create Console Port for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['console_port']['name'] == "Console Port 2" + - test_four['console_port']['device'] == 1 + - test_four['msg'] == "console_port Console Port 2 created" + +- name: "CONSOLE_PORT 5: Delete Console Port" + netbox.netbox.netbox_console_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port 2 + device: test100 + state: absent + register: test_five + +- name: "CONSOLE_PORT 5: ASSERT - Delete Console Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "console_port Console Port 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_port_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_port_template.yml new file mode 100644 index 00000000..b1bd1d1e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_port_template.yml @@ -0,0 +1,105 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_CONSOLE_PORT_TEMPLATE +## +## +- name: "CONSOLE_PORT_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_console_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port Template + device_type: Cisco Test + state: present + register: test_one + +- name: "CONSOLE_PORT_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['console_port_template']['name'] == "Console Port Template" + - test_one['console_port_template']['device_type'] == 1 + - test_one['msg'] == "console_port_template Console Port Template created" + +- name: "CONSOLE_PORT_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_console_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port Template + device_type: Cisco Test + state: present + register: test_two + +- name: "CONSOLE_PORT_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['console_port_template']['name'] == "Console Port Template" + - test_two['console_port_template']['device_type'] == 1 + - test_two['msg'] == "console_port_template Console Port Template already exists" + +- name: "CONSOLE_PORT_TEMPLATE 3: Update Console Port Template with other fields" + netbox.netbox.netbox_console_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port Template + device_type: Cisco Test + type: usb-a + state: present + register: test_three + +- name: "CONSOLE_PORT_TEMPLATE 3: ASSERT - Update Console Port Template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "usb-a" + - test_three['console_port_template']['name'] == "Console Port Template" + - test_three['console_port_template']['device_type'] == 1 + - test_three['console_port_template']['type'] == "usb-a" + - test_three['msg'] == "console_port_template Console Port Template updated" + +- name: "CONSOLE_PORT_TEMPLATE 4: Create Console Port Template for Delete Test" + netbox.netbox.netbox_console_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port Template 2 + device_type: Cisco Test + state: present + register: test_four + +- name: "CONSOLE_PORT_TEMPLATE 4: ASSERT - Create Console Port Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['console_port_template']['name'] == "Console Port Template 2" + - test_four['console_port_template']['device_type'] == 1 + - test_four['msg'] == "console_port_template Console Port Template 2 created" + +- name: "CONSOLE_PORT_TEMPLATE 5: Delete Console Port Template" + netbox.netbox.netbox_console_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Port Template 2 + device_type: Cisco Test + state: absent + register: test_five + +- name: "CONSOLE_PORT_TEMPLATE 5: ASSERT - Delete Console Port Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "console_port_template Console Port Template 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_server_port.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_server_port.yml new file mode 100644 index 00000000..f7034532 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_server_port.yml @@ -0,0 +1,108 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_CONSOLE_SERVER_PORT +## +## +- name: "CONSOLE_SERVER_PORT 1: Necessary info creation" + netbox.netbox.netbox_console_server_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port + device: test100 + state: present + register: test_one + +- name: "CONSOLE_SERVER_PORT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['console_server_port']['name'] == "Console Server Port" + - test_one['console_server_port']['device'] == 1 + - test_one['msg'] == "console_server_port Console Server Port created" + +- name: "CONSOLE_SERVER_PORT 2: Create duplicate" + netbox.netbox.netbox_console_server_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port + device: test100 + state: present + register: test_two + +- name: "CONSOLE_SERVER_PORT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['console_server_port']['name'] == "Console Server Port" + - test_two['console_server_port']['device'] == 1 + - test_two['msg'] == "console_server_port Console Server Port already exists" + +- name: "CONSOLE_SERVER_PORT 3: Update Console Server Port with other fields" + netbox.netbox.netbox_console_server_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port + device: test100 + type: usb-a + description: test description + state: present + register: test_three + +- name: "CONSOLE_SERVER_PORT 3: ASSERT - Update Console Server Port with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "usb-a" + - test_three['diff']['after']['description'] == "test description" + - test_three['console_server_port']['name'] == "Console Server Port" + - test_three['console_server_port']['device'] == 1 + - test_three['console_server_port']['type'] == "usb-a" + - test_three['console_server_port']['description'] == "test description" + - test_three['msg'] == "console_server_port Console Server Port updated" + +- name: "CONSOLE_SERVER_PORT 4: Create Console Server Port for Delete Test" + netbox.netbox.netbox_console_server_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port 2 + device: test100 + state: present + register: test_four + +- name: "CONSOLE_SERVER_PORT 4: ASSERT - Create Console Server Port for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['console_server_port']['name'] == "Console Server Port 2" + - test_four['console_server_port']['device'] == 1 + - test_four['msg'] == "console_server_port Console Server Port 2 created" + +- name: "CONSOLE_SERVER_PORT 5: Delete Console Server Port" + netbox.netbox.netbox_console_server_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port 2 + device: test100 + state: absent + register: test_five + +- name: "CONSOLE_SERVER_PORT 5: ASSERT - Delete Console Server Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "console_server_port Console Server Port 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_server_port_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_server_port_template.yml new file mode 100644 index 00000000..4ad47d40 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_console_server_port_template.yml @@ -0,0 +1,105 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_CONSOLE_SERVER_PORT_TEMPLATE +## +## +- name: "CONSOLE_SERVER_PORT_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_console_server_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port Template + device_type: Cisco Test + state: present + register: test_one + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['console_server_port_template']['name'] == "Console Server Port Template" + - test_one['console_server_port_template']['device_type'] == 1 + - test_one['msg'] == "console_server_port_template Console Server Port Template created" + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_console_server_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port Template + device_type: Cisco Test + state: present + register: test_two + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['console_server_port_template']['name'] == "Console Server Port Template" + - test_two['console_server_port_template']['device_type'] == 1 + - test_two['msg'] == "console_server_port_template Console Server Port Template already exists" + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 3: Update Console Server Port Template with other fields" + netbox.netbox.netbox_console_server_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port Template + device_type: Cisco Test + type: usb-a + state: present + register: test_three + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 3: ASSERT - Update Console Server Port Template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "usb-a" + - test_three['console_server_port_template']['name'] == "Console Server Port Template" + - test_three['console_server_port_template']['device_type'] == 1 + - test_three['console_server_port_template']['type'] == "usb-a" + - test_three['msg'] == "console_server_port_template Console Server Port Template updated" + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 4: Create Console Server Port Template for Delete Test" + netbox.netbox.netbox_console_server_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port Template 2 + device_type: Cisco Test + state: present + register: test_four + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 4: ASSERT - Create Console Server Port Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['console_server_port_template']['name'] == "Console Server Port Template 2" + - test_four['console_server_port_template']['device_type'] == 1 + - test_four['msg'] == "console_server_port_template Console Server Port Template 2 created" + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 5: Delete Console Server Port Template" + netbox.netbox.netbox_console_server_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Console Server Port Template 2 + device_type: Cisco Test + state: absent + register: test_five + +- name: "CONSOLE_SERVER_PORT_TEMPLATE 5: ASSERT - Delete Console Server Port Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "console_server_port_template Console Server Port Template 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device.yml new file mode 100644 index 00000000..13cde45b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device.yml @@ -0,0 +1,241 @@ +--- +## +## +### NETBOX_DEVICE +## +## +- name: "1 - Device with required information" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1" + device_type: + id: "1" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + state: present + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == 'absent' + - test_one['diff']['after']['state'] == 'present' + - test_one['device']['name'] == "R1" + - test_one['device']['device_role'] == 1 + - test_one['device']['device_type'] == 1 + - test_one['device']['site'] == 1 + - test_one['device']['status'] == "staged" + - test_one['device']['name'] == "R1" + - test_one['msg'] == "device R1 created" + +- name: "2 - Duplicate device" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + state: present + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['device']['name'] == "R1" + - test_two['device']['device_role'] == 1 + - test_two['device']['device_type'] == 1 + - test_two['device']['site'] == 1 + - test_two['device']['status'] == "staged" + - test_two['msg'] == "device R1 already exists" + +- name: "3 - Update device" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1" + serial: "FXS1001" + local_context_data: + bgp_as: "65412" + virtual_chassis: "Test Nexus One" + vc_position: 3 + vc_priority: 15 + state: present + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['after']['serial'] == "FXS1001" + - test_three['diff']['after']['local_context_data']["bgp_as"] == "65412" + - test_three['diff']['after']['virtual_chassis'] == 1 + - test_three['diff']['after']['vc_position'] == 3 + - test_three['diff']['after']['vc_priority'] == 15 + - test_three['device']['name'] == "R1" + - test_three['device']['device_role'] == 1 + - test_three['device']['device_type'] == 1 + - test_three['device']['site'] == 1 + - test_three['device']['status'] == "staged" + - test_three['device']['serial'] == "FXS1001" + - test_three['device']['local_context_data']["bgp_as"] == "65412" + - test_three['device']['virtual_chassis'] == 1 + - test_three['device']['vc_position'] == 3 + - test_three['device']['vc_priority'] == 15 + - test_three['msg'] == "device R1 updated" + +- name: "3.1 - Update device name using query_params" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1-changed-name" + serial: "FXS1001" + query_params: + - serial + state: present + register: test_three_dot_one + +- name: "3.1 - ASSERT" + assert: + that: + - test_three_dot_one is changed + - test_three_dot_one['diff']['after']['name'] == "R1-changed-name" + - test_three_dot_one['device']['device_role'] == 1 + - test_three_dot_one['device']['device_type'] == 1 + - test_three_dot_one['device']['site'] == 1 + - test_three_dot_one['device']['status'] == "staged" + - test_three_dot_one['device']['serial'] == "FXS1001" + - test_three_dot_one['device']['local_context_data']["bgp_as"] == "65412" + - test_three_dot_one['msg'] == "device R1-changed-name updated" + +- name: "4 - Create device with tags and assign to rack" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "TestR1" + device_type: "1841" + device_role: "Core Switch" + site: "Test Site2" + rack: "Test Rack Site 2" + position: 35 + face: "Front" + tags: + - "schnozzberry" + tenant: "Test Tenant" + asset_tag: "1234" + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['device']['name'] == "TestR1" + - test_four['device']['device_role'] == 1 + - test_four['device']['device_type'] == 5 + - test_four['device']['site'] == 2 + - test_four['device']['status'] == "active" + - test_four['device']['rack'] == 1 + - test_four['device']['tags'][0] == 4 + - test_four['device']['tenant'] == 1 + - test_four['device']['asset_tag'] == '1234' + - test_four['msg'] == "device TestR1 created" + +- name: "5 - Delete previous device" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "TestR1" + state: absent + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "device TestR1 deleted" + +- name: "6 - Delete R1" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "R1-changed-name" + state: absent + register: test_six + +- name: "6 - ASSERT" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "present" + - test_six['diff']['after']['state'] == "absent" + - test_six['msg'] == "device R1-changed-name deleted" + +- name: "7 - Add primary_ip4/6 to test100" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "test100" + primary_ip4: "172.16.180.1/24" + primary_ip6: "2001::1:1/64" + state: present + register: test_seven + +- name: "7 - ASSERT" + assert: + that: + - test_seven is changed + - test_seven['diff']['after']['primary_ip4'] == 1 + - test_seven['diff']['after']['primary_ip6'] == 2 + - test_seven['device']['name'] == "test100" + - test_seven['device']['device_role'] == 1 + - test_seven['device']['device_type'] == 1 + - test_seven['device']['site'] == 1 + - test_seven['device']['status'] == "active" + - test_seven['device']['primary_ip4'] == 1 + - test_seven['device']['primary_ip6'] == 2 + - test_seven['msg'] == "device test100 updated" + +- name: "8 - Device with empty string name" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "" + device_type: + id: 1 + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + state: present + register: test_eight + +- name: "8 - ASSERT" + assert: + that: + - test_eight is changed + - test_eight['diff']['before']['state'] == 'absent' + - test_eight['diff']['after']['state'] == 'present' + - test_eight['device']['device_role'] == 1 + - test_eight['device']['device_type'] == 1 + - test_eight['device']['site'] == 1 + - test_eight['device']['status'] == "staged" + - "'-' in test_eight['device']['name']" + - "test_eight['device']['name'] | length == 36" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_bay.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_bay.yml new file mode 100644 index 00000000..18a80435 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_bay.yml @@ -0,0 +1,87 @@ +--- +## +## +### NETBOX_DEVICE_BAY +## +## +- name: "DEVICE_BAY 1: Necessary info creation" + netbox.netbox.netbox_device_bay: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "Test Nexus One" + name: "Device Bay One" + state: present + register: test_one + +- name: "DEVICE_BAY 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['device_bay']['name'] == "Device Bay One" + - test_one['device_bay']['device'] == 4 + - test_one['msg'] == "device_bay Device Bay One created" + +- name: "DEVICE_BAY 2: Create duplicate" + netbox.netbox.netbox_device_bay: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "Test Nexus One" + name: "Device Bay One" + state: present + register: test_two + +- name: "DEVICE_BAY 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['device_bay']['name'] == "Device Bay One" + - test_two['device_bay']['device'] == 4 + - test_two['msg'] == "device_bay Device Bay One already exists" + +- name: "DEVICE_BAY 3: ASSERT - Update" + netbox.netbox.netbox_device_bay: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "Test Nexus One" + name: "Device Bay One" + installed_device: "Test Nexus Child One" + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "DEVICE_BAY 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['installed_device'] == 5 + - test_three['diff']['after']['tags'][0] == 4 + - test_three['device_bay']['name'] == "Device Bay One" + - test_three['device_bay']['device'] == 4 + - test_three['device_bay']['installed_device'] == 5 + - test_three['device_bay']['tags'][0] == 4 + - test_three['msg'] == "device_bay Device Bay One updated" + +- name: "DEVICE_BAY 4: ASSERT - Delete" + netbox.netbox.netbox_device_bay: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Device Bay One" + state: absent + register: test_four + +- name: "DEVICE_BAY 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['device_bay']['name'] == "Device Bay One" + - test_four['device_bay']['device'] == 4 + - test_four['device_bay']['installed_device'] == 5 + - test_four['device_bay']['tags'][0] == 4 + - test_four['msg'] == "device_bay Device Bay One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_bay_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_bay_template.yml new file mode 100644 index 00000000..4b696503 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_bay_template.yml @@ -0,0 +1,81 @@ +--- +## +## +### NETBOX_DEVICE_BAY_TEMPLATE +## +## +- name: "DEVICE_BAY_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_device_bay_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device_type: WS Test 3850 + name: Device Bay Template One + state: present + register: test_one + +- name: "DEVICE_BAY_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['device_bay_template']['name'] == "Device Bay Template One" + - test_one['device_bay_template']['device_type'] == 7 + - test_one['msg'] == "device_bay_template Device Bay Template One created" + +- name: "DEVICE_BAY_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_device_bay_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device_type: WS Test 3850 + name: Device Bay Template One + state: present + register: test_two + +- name: "DEVICE_BAY_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['device_bay_template']['name'] == "Device Bay Template One" + - test_two['device_bay_template']['device_type'] == 7 + - test_two['msg'] == "device_bay_template Device Bay Template One already exists" + +- name: "DEVICE_BAY_TEMPLATE 3: ASSERT - Create Device Bay Template for Delete Test" + netbox.netbox.netbox_device_bay_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device_type: WS Test 3850 + name: Device Bay Template Two + state: present + register: test_three + +- name: "DEVICE_BAY_TEMPLATE 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['device_bay_template']['name'] == "Device Bay Template Two" + - test_three['device_bay_template']['device_type'] == 7 + - test_three['msg'] == "device_bay_template Device Bay Template Two created" + +- name: "DEVICE_BAY_TEMPLATE 4: ASSERT - Delete" + netbox.netbox.netbox_device_bay_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Device Bay Template Two + device_type: WS Test 3850 + state: absent + register: test_four + +- name: "DEVICE_BAY_TEMPLATE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['device_bay_template']['name'] == "Device Bay Template Two" + - test_four['device_bay_template']['device_type'] == 7 + - test_four['msg'] == "device_bay_template Device Bay Template Two deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_interface.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_interface.yml new file mode 100644 index 00000000..ed581f35 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_interface.yml @@ -0,0 +1,291 @@ +--- +## +## +### NETBOX_DEVICE_INTERFACE +## +## +- name: "1 - Interface with required information" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet3 + type: "1000Base-T (1GE)" + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['msg'] == "interface GigabitEthernet3 created" + - test_one['diff']['before']['state'] == 'absent' + - test_one['diff']['after']['state'] == 'present' + - test_one['interface']['name'] == "GigabitEthernet3" + - test_one['interface']['device'] == 1 + +- name: "2 - Update test100 - GigabitEthernet3" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet3 + mtu: 1600 + enabled: false + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - test_two is changed + - test_two['msg'] == "interface GigabitEthernet3 updated" + - test_two['diff']['after']['enabled'] == false + - test_two['diff']['after']['mtu'] == 1600 + - test_two['interface']['name'] == "GigabitEthernet3" + - test_two['interface']['device'] == 1 + - test_two['interface']['enabled'] == false + - test_two['interface']['mtu'] == 1600 + +- name: "3 - Delete interface test100 - GigabitEthernet3" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet3 + state: absent + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['msg'] == "interface GigabitEthernet3 deleted" + - test_three['diff']['before']['state'] == "present" + - test_three['diff']['after']['state'] == "absent" + +- name: "4 - Create LAG with several specified options" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: port-channel1 + type: Link Aggregation Group (LAG) + mtu: 1600 + mgmt_only: false + mode: Access + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['msg'] == "interface port-channel1 created" + - test_four['diff']['before']['state'] == 'absent' + - test_four['diff']['after']['state'] == 'present' + - test_four['interface']['name'] == "port-channel1" + - test_four['interface']['device'] == 1 + - test_four['interface']['enabled'] == true + - test_four['interface']['type'] == "lag" + - test_four['interface']['mgmt_only'] == false + - test_four['interface']['mode'] == "access" + - test_four['interface']['mtu'] == 1600 + +- name: "5 - Create interface and assign it to parent LAG" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet3 + enabled: false + type: 1000Base-T (1GE) + lag: + name: port-channel1 + mtu: 1600 + mgmt_only: false + mode: Access + state: present + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['msg'] == "interface GigabitEthernet3 created" + - test_five['diff']['before']['state'] == 'absent' + - test_five['diff']['after']['state'] == 'present' + - test_five['interface']['name'] == "GigabitEthernet3" + - test_five['interface']['device'] == 1 + - test_five['interface']['enabled'] == false + - test_five['interface']['type'] == "1000base-t" + - test_five['interface']['mgmt_only'] == false + - test_five['interface']['lag'] == 8 + - test_five['interface']['mode'] == "access" + - test_five['interface']['mtu'] == 1600 + +- name: "6 - Create interface as trunk port" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet21 + enabled: false + type: 1000Base-T (1GE) + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + mtu: 1600 + mgmt_only: true + mode: Tagged + state: present + register: test_six + +- name: "6 - ASSERT" + assert: + that: + - test_six is changed + - test_six['msg'] == "interface GigabitEthernet21 created" + - test_six['diff']['before']['state'] == 'absent' + - test_six['diff']['after']['state'] == 'present' + - test_six['interface']['name'] == "GigabitEthernet21" + - test_six['interface']['device'] == 1 + - test_six['interface']['enabled'] == false + - test_six['interface']['type'] == "1000base-t" + - test_six['interface']['mgmt_only'] == true + - test_six['interface']['mode'] == "tagged" + - test_six['interface']['mtu'] == 1600 + - test_six['interface']['tagged_vlans'] == [2, 3] + - test_six['interface']['untagged_vlan'] == 1 + +- name: "7 - Duplicate Interface" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet1 + register: test_seven + +- name: "7 - ASSERT" + assert: + that: + - not test_seven['changed'] + - test_seven['msg'] == "interface GigabitEthernet1 already exists" + - test_seven['interface']['name'] == "GigabitEthernet1" + - test_seven['interface']['device'] == 1 + +- name: "Add port-channel1 to R1 to test finding proper port-channel1" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "R1-Device" + name: "port-channel1" + type: "Link Aggregation Group (LAG)" + +- name: "8 - Create interface and assign it to parent LAG - non dict" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: test100 + name: GigabitEthernet4 + enabled: false + type: 1000Base-T (1GE) + lag: "port-channel1" + mtu: 1600 + mgmt_only: false + mode: Access + state: present + register: test_eight + +- name: "8 - ASSERT" + assert: + that: + - test_eight is changed + - test_eight['msg'] == "interface GigabitEthernet4 created" + - test_eight['diff']['before']['state'] == 'absent' + - test_eight['diff']['after']['state'] == 'present' + - test_eight['interface']['name'] == "GigabitEthernet4" + - test_eight['interface']['device'] == 1 + - test_eight['interface']['enabled'] == false + - test_eight['interface']['type'] == "1000base-t" + - test_eight['interface']['mgmt_only'] == false + - test_eight['interface']['lag'] == 8 + - test_eight['interface']['mode'] == "access" + - test_eight['interface']['mtu'] == 1600 + +- name: "9 - Create interface on VC child" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: Test Nexus Child One + name: Ethernet2/2 + type: 1000Base-T (1GE) + state: present + register: test_nine + +- name: "9 - ASSERT" + assert: + that: + - test_nine is changed + - test_nine['msg'] == "interface Ethernet2/2 created" + - test_nine['diff']['before']['state'] == 'absent' + - test_nine['diff']['after']['state'] == 'present' + - test_nine['interface']['name'] == "Ethernet2/2" + - test_nine['interface']['device'] == 5 + - test_nine['interface']['enabled'] == true + - test_nine['interface']['type'] == "1000base-t" + +- name: "10 - Update interface on VC child" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: Test Nexus One + name: Ethernet2/2 + description: "Updated child interface from parent device" + update_vc_child: True + state: present + register: test_ten + +- name: "10 - ASSERT" + assert: + that: + - test_ten is changed + - test_ten['msg'] == "interface Ethernet2/2 updated" + - test_ten['diff']['after']['description'] == 'Updated child interface from parent device' + - test_ten['interface']['name'] == "Ethernet2/2" + - test_ten['interface']['device'] == 5 + - test_ten['interface']['enabled'] == true + - test_ten['interface']['type'] == "1000base-t" + - test_ten['interface']['description'] == 'Updated child interface from parent device' + +- name: "11 - Update interface on VC child w/o update_vc_child" + netbox.netbox.netbox_device_interface: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: Test Nexus One + name: Ethernet2/2 + description: "Updated child interface from parent device - test" + state: present + ignore_errors: yes + register: test_eleven + +- name: "11 - ASSERT" + assert: + that: + - test_eleven is failed + - test_eleven['msg'] == "Must set update_vc_child to True to allow child device interface modification" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_interface_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_interface_template.yml new file mode 100644 index 00000000..b6e98914 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_interface_template.yml @@ -0,0 +1,109 @@ +--- +## +## +### NETBOX_DEVICE_INTERFACE_TEMPLATE +## +## +- name: "1 - Interface with required information" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['msg'] == "interface_template 10GBASE-T (10GE) created" + - test_one['diff']['before']['state'] == 'absent' + - test_one['diff']['after']['state'] == 'present' + - test_one['interface_template']['name'] == "10GBASE-T (10GE)" + - test_one['interface_template']['device_type'] == 2 + - test_one['interface_template']['type'] == '10gbase-t' + +- name: "2 - Update 10GBASE-T (10GE)" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + mgmt_only: true + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - test_two is changed + - test_two['msg'] == "interface_template 10GBASE-T (10GE) updated" + - test_two['diff']['after']['mgmt_only'] == true + - test_two['interface_template']['name'] == "10GBASE-T (10GE)" + - test_two['interface_template']['device_type'] == 2 + - test_two['interface_template']['mgmt_only'] == true + +- name: "3 - Delete interface template 10GBASE-T (10GE)" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + state: absent + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['msg'] == "interface_template 10GBASE-T (10GE) deleted" + - test_three['diff']['before']['state'] == "present" + - test_three['diff']['after']['state'] == "absent" + +- name: "4 - Create LAG with several specified options" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device_type: Arista Test + name: port channel template + type: lag + mgmt_only: false + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['msg'] == "interface_template port channel template created" + - test_four['diff']['before']['state'] == 'absent' + - test_four['diff']['after']['state'] == 'present' + - test_four['interface_template']['name'] == "port channel template" + - test_four['interface_template']['device_type'] == 2 + - test_four['interface_template']['type'] == "lag" + - test_four['interface_template']['mgmt_only'] == false + +- name: "5 - Duplicate Interface Template port channel template" + netbox.netbox.netbox_device_interface_template: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device_type: Arista Test + name: port channel template + type: lag + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - not test_five['changed'] + - test_five['msg'] == "interface_template port channel template already exists" + - test_five['interface_template']['name'] == "port channel template" + - test_five['interface_template']['device_type'] == 2 + - test_five['interface_template']['type'] == "lag" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_role.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_role.yml new file mode 100644 index 00000000..64ec9840 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_role.yml @@ -0,0 +1,101 @@ +--- +## +## +### NETBOX_DEVICE_ROLE +## +## +- name: "DEVICE_ROLE 1: Necessary info creation" + netbox.netbox.netbox_device_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Device Role" + color: "FFFFFF" + state: present + register: test_one + +- name: "DEVICE_ROLE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['device_role']['name'] == "Test Device Role" + - test_one['device_role']['slug'] == "test-device-role" + - test_one['device_role']['color'] == "ffffff" + - test_one['msg'] == "device_role Test Device Role created" + +- name: "DEVICE_ROLE 2: Create duplicate" + netbox.netbox.netbox_device_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Device Role" + color: "FFFFFF" + state: present + register: test_two + +- name: "DEVICE_ROLE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['device_role']['name'] == "Test Device Role" + - test_two['device_role']['slug'] == "test-device-role" + - test_two['device_role']['color'] == "ffffff" + - test_two['msg'] == "device_role Test Device Role already exists" + +- name: "DEVICE_ROLE 3: ASSERT - Update" + netbox.netbox.netbox_device_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Device Role" + color: "003EFF" + vm_role: false + state: present + register: test_three + +- name: "DEVICE_ROLE 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['after']['color'] == "003eff" + - test_three['diff']['after']['vm_role'] == false + - test_three['device_role']['name'] == "Test Device Role" + - test_three['device_role']['slug'] == "test-device-role" + - test_three['device_role']['color'] == "003eff" + - test_three['device_role']['vm_role'] == false + - test_three['msg'] == "device_role Test Device Role updated" + +- name: "DEVICE_ROLE 4: ASSERT - Delete" + netbox.netbox.netbox_device_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Device Role + state: absent + register: test_four + +- name: "DEVICE_ROLE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "device_role Test Device Role deleted" + +- name: "DEVICE_ROLE 5: ASSERT - Delete non existing" + netbox.netbox.netbox_device_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Device Role + state: absent + register: test_five + +- name: "DEVICE_ROLE 5: ASSERT - Delete non existing`" + assert: + that: + - not test_five['changed'] + - test_five['device_role'] == None + - test_five['msg'] == "device_role Test Device Role already absent" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_type.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_type.yml new file mode 100644 index 00000000..6fd2c36a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_device_type.yml @@ -0,0 +1,131 @@ +--- +## +## +### NETBOX_DEVICE_TYPE +## +## +- name: "DEVICE_TYPE 1: Necessary info creation" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + slug: test-device-type + model: ws-test-3750 + manufacturer: Test Manufacturer + state: present + register: test_one + +- name: "DEVICE_TYPE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['device_type']['slug'] == "test-device-type" + - test_one['device_type']['model'] == "ws-test-3750" + - test_one['device_type']['manufacturer'] == 3 + - test_one['msg'] == "device_type test-device-type created" + +- name: "DEVICE_TYPE 2: Create duplicate" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + slug: test-device-type + model: "ws-test-3750" + manufacturer: Test Manufacturer + state: present + register: test_two + +- name: "DEVICE_TYPE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_one['device_type']['slug'] == "test-device-type" + - test_one['device_type']['model'] == "ws-test-3750" + - test_one['device_type']['manufacturer'] == 3 + - test_two['msg'] == "device_type test-device-type already exists" + +- name: "DEVICE_TYPE 3: ASSERT - Update" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + slug: test-device-type + model: ws-test-3750 + manufacturer: Test Manufacturer + part_number: ws-3750g-v2 + u_height: 1 + is_full_depth: false + subdevice_role: parent + state: present + register: test_three + +- name: "DEVICE_TYPE 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['after']['is_full_depth'] == false + - test_three['diff']['after']['part_number'] == "ws-3750g-v2" + - test_three['diff']['after']['subdevice_role'] == "parent" + - test_three['device_type']['slug'] == "test-device-type" + - test_three['device_type']['model'] == "ws-test-3750" + - test_three['device_type']['manufacturer'] == 3 + - test_three['device_type']['is_full_depth'] == false + - test_three['device_type']['part_number'] == "ws-3750g-v2" + - test_three['device_type']['subdevice_role'] == "parent" + - test_three['msg'] == "device_type test-device-type updated" + +- name: "DEVICE_TYPE 4: ASSERT - Delete" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + model: test-device-type + state: absent + register: test_four + +- name: "DEVICE_TYPE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "device_type test-device-type deleted" + +- name: "DEVICE_TYPE 5: ASSERT - Delete non existing" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + model: "Test Device Type" + state: absent + register: test_five + +- name: "DEVICE_TYPE 5: ASSERT - Delete non existing`" + assert: + that: + - not test_five['changed'] + - test_five['device_type'] == None + - test_five['msg'] == "device_type Test Device Type already absent" + +- name: "DEVICE_TYPE 6: Without Slug" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + model: "WS Test 3850" + manufacturer: Test Manufacturer + state: present + register: test_six + +- name: "DEVICE_TYPE 6: ASSERT - Without Slug" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "absent" + - test_six['diff']['after']['state'] == "present" + - test_six['device_type']['slug'] == "ws-test-3850" + - test_six['device_type']['model'] == "WS Test 3850" + - test_six['device_type']['manufacturer'] == 3 + - test_six['msg'] == "device_type WS Test 3850 created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_front_port.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_front_port.yml new file mode 100644 index 00000000..1f4c60a4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_front_port.yml @@ -0,0 +1,150 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_FRONT_PORT +## +## +- name: "FRONT_PORT 1: Necessary info creation" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port + device: test100 + type: bnc + rear_port: Rear Port + state: present + register: test_one + +- name: "FRONT_PORT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['front_port']['name'] == "Front Port" + - test_one['front_port']['device'] == 1 + - test_one['front_port']['type'] == "bnc" + - test_one['front_port']['rear_port'] == 1 + - test_one['msg'] == "front_port Front Port created" + +- name: "FRONT_PORT 2: Create duplicate" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port + device: test100 + type: bnc + rear_port: Rear Port + state: present + register: test_two + +- name: "FRONT_PORT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['front_port']['name'] == "Front Port" + - test_two['front_port']['device'] == 1 + - test_two['front_port']['type'] == "bnc" + - test_two['front_port']['rear_port'] == 1 + - test_two['msg'] == "front_port Front Port already exists" + +- name: "FRONT_PORT 3: Update Front Port with other fields" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port + device: test100 + type: bnc + rear_port: Rear Port + rear_port_position: 5 + description: test description + state: present + register: test_three + +- name: "FRONT_PORT 3: ASSERT - Update Front Port with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['rear_port_position'] == 5 + - test_three['diff']['after']['description'] == "test description" + - test_three['front_port']['name'] == "Front Port" + - test_three['front_port']['device'] == 1 + - test_three['front_port']['type'] == "bnc" + - test_three['front_port']['rear_port'] == 1 + - test_three['front_port']['rear_port_position'] == 5 + - test_three['front_port']['description'] == "test description" + - test_three['msg'] == "front_port Front Port updated" + +- name: "FRONT_PORT 4: Create Front Port for Delete Test" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port 2 + device: test100 + type: bnc + rear_port: Rear Port + state: present + register: test_four + +- name: "FRONT_PORT 4: ASSERT - Create Front Port for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['front_port']['name'] == "Front Port 2" + - test_four['front_port']['device'] == 1 + - test_four['front_port']['type'] == "bnc" + - test_four['front_port']['rear_port'] == 1 + - test_four['msg'] == "front_port Front Port 2 created" + +- name: "FRONT_PORT 5: Delete Front Port" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port 2 + device: test100 + type: bnc + rear_port: Rear Port + state: absent + register: test_five + +- name: "FRONT_PORT 5: ASSERT - Delete Front Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "front_port Front Port 2 deleted" + +- name: "FRONT_PORT 6: Create duplicate with rear_port dictionary" + netbox.netbox.netbox_front_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port + device: test100 + type: bnc + rear_port: + device: test100 + name: Rear Port + state: present + register: test_six + +- name: "FRONT_PORT 6: ASSERT - Create duplicate with rear_port dictionary" + assert: + that: + - not test_six['changed'] + - test_six['front_port']['name'] == "Front Port" + - test_six['front_port']['device'] == 1 + - test_six['front_port']['type'] == "bnc" + - test_six['front_port']['rear_port'] == 1 + - test_six['msg'] == "front_port Front Port already exists" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_front_port_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_front_port_template.yml new file mode 100644 index 00000000..30e90710 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_front_port_template.yml @@ -0,0 +1,147 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_FRONT_PORT_TEMPLATE +## +## +- name: "FRONT_PORT_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: Rear Port Template + state: present + register: test_one + +- name: "FRONT_PORT_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['front_port_template']['name'] == "Front Port Template" + - test_one['front_port_template']['device_type'] == 1 + - test_one['front_port_template']['type'] == "bnc" + - test_one['front_port_template']['rear_port'] == 1 + - test_one['msg'] == "front_port_template Front Port Template created" + +- name: "FRONT_PORT_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: Rear Port Template + state: present + register: test_two + +- name: "FRONT_PORT_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['front_port_template']['name'] == "Front Port Template" + - test_two['front_port_template']['device_type'] == 1 + - test_two['front_port_template']['type'] == "bnc" + - test_two['front_port_template']['rear_port'] == 1 + - test_two['msg'] == "front_port_template Front Port Template already exists" + +- name: "FRONT_PORT_TEMPLATE 3: Update Front Port Template with other fields" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: Rear Port Template + rear_port_template_position: 5 + state: present + register: test_three + +- name: "FRONT_PORT_TEMPLATE 3: ASSERT - Update Front Port Template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['rear_port_position'] == 5 + - test_three['front_port_template']['name'] == "Front Port Template" + - test_three['front_port_template']['device_type'] == 1 + - test_three['front_port_template']['type'] == "bnc" + - test_three['front_port_template']['rear_port_position'] == 5 + - test_three['front_port_template']['rear_port'] == 1 + - test_three['msg'] == "front_port_template Front Port Template updated" + +- name: "FRONT_PORT_TEMPLATE 4: Create Front Port Template for Delete Test" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template 2 + device_type: Cisco Test + type: bnc + rear_port_template: Rear Port Template + state: present + register: test_four + +- name: "FRONT_PORT_TEMPLATE 4: ASSERT - Create Front Port Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['front_port_template']['name'] == "Front Port Template 2" + - test_four['front_port_template']['device_type'] == 1 + - test_four['front_port_template']['type'] == "bnc" + - test_four['front_port_template']['rear_port'] == 1 + - test_four['msg'] == "front_port_template Front Port Template 2 created" + +- name: "FRONT_PORT_TEMPLATE 5: Delete Front Port Template" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template 2 + device_type: Cisco Test + type: bnc + rear_port_template: Rear Port Template + state: absent + register: test_five + +- name: "FRONT_PORT_TEMPLATE 5: ASSERT - Delete Front Port Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "front_port_template Front Port Template 2 deleted" + +- name: "FRONT_PORT 6: Create duplicate with rear_port_template dictionary" + netbox.netbox.netbox_front_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: + device: Cisco Test + name: Rear Port Template + state: present + register: test_six + +- name: "FRONT_PORT 6: ASSERT - Create duplicate with rear_port_template dictionary" + assert: + that: + - not test_six['changed'] + - test_six['front_port_template']['name'] == "Front Port Template" + - test_six['front_port_template']['device_type'] == 1 + - test_six['front_port_template']['type'] == "bnc" + - test_six['front_port_template']['rear_port'] == 1 + - test_six['msg'] == "front_port_template Front Port Template already exists" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_inventory_item.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_inventory_item.yml new file mode 100644 index 00000000..d551b2fa --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_inventory_item.yml @@ -0,0 +1,107 @@ +--- +## +## +### NETBOX_INVENTORY_ITEM +## +## +- name: "INVENTORY_ITEM 1: Necessary info creation" + netbox.netbox.netbox_inventory_item: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "test100" + name: "10G-SFP+" + state: present + register: test_one + +- name: "INVENTORY_ITEM 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['inventory_item']['name'] == "10G-SFP+" + - test_one['inventory_item']['device'] == 1 + - test_one['msg'] == "inventory_item 10G-SFP+ created" + +- name: "INVENTORY_ITEM 2: Create duplicate" + netbox.netbox.netbox_inventory_item: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "test100" + name: "10G-SFP+" + state: present + register: test_two + +- name: "INVENTORY_ITEM 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['inventory_item']['name'] == "10G-SFP+" + - test_two['inventory_item']['device'] == 1 + - test_two['msg'] == "inventory_item 10G-SFP+ already exists" + +- name: "INVENTORY_ITEM 3: ASSERT - Update" + netbox.netbox.netbox_inventory_item: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "test100" + name: "10G-SFP+" + manufacturer: "Cisco" + part_id: "10G-SFP+" + serial: "1234" + asset_tag: "1234" + description: "New SFP" + discovered: True + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "INVENTORY_ITEM 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['asset_tag'] == "1234" + - test_three['diff']['after']['serial'] == "1234" + - test_three['diff']['after']['description'] == "New SFP" + - test_three['diff']['after']['manufacturer'] == 1 + - test_three['diff']['after']['part_id'] == "10G-SFP+" + - test_three['diff']['after']['tags'][0] == 4 + - test_three['diff']['after']['discovered'] == True + - test_three['inventory_item']['name'] == "10G-SFP+" + - test_three['inventory_item']['device'] == 1 + - test_three['inventory_item']['asset_tag'] == "1234" + - test_three['inventory_item']['serial'] == "1234" + - test_three['inventory_item']['description'] == "New SFP" + - test_three['inventory_item']['manufacturer'] == 1 + - test_three['inventory_item']['part_id'] == "10G-SFP+" + - test_three['inventory_item']['tags'][0] == 4 + - test_three['inventory_item']['discovered'] == True + - test_three['msg'] == "inventory_item 10G-SFP+ updated" + +- name: "INVENTORY_ITEM 4: ASSERT - Delete" + netbox.netbox.netbox_inventory_item: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + device: "test100" + name: "10G-SFP+" + state: absent + register: test_four + +- name: "INVENTORY_ITEM 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['inventory_item']['name'] == "10G-SFP+" + - test_four['inventory_item']['device'] == 1 + - test_four['inventory_item']['asset_tag'] == "1234" + - test_four['inventory_item']['serial'] == "1234" + - test_four['inventory_item']['description'] == "New SFP" + - test_four['inventory_item']['manufacturer'] == 1 + - test_four['inventory_item']['part_id'] == "10G-SFP+" + - test_four['inventory_item']['tags'][0] == 4 + - test_four['msg'] == "inventory_item 10G-SFP+ deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_ip_address.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_ip_address.yml new file mode 100644 index 00000000..fcee6961 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_ip_address.yml @@ -0,0 +1,350 @@ +--- +## +## +### NETBOX_IP_ADDRESS +## +## +- name: "1 - Create IP address within Netbox with only required information - State: Present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.1.10/30 + state: present + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['msg'] == "ip_address 192.168.1.10/30 created" + - test_one['ip_address']['address'] == "192.168.1.10/30" + +- name: "2 - Update 192.168.1.10/30" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.1.10/30 + description: "Updated ip address" + tags: + - "Updated" + state: present + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - test_two is changed + - test_two['diff']['after']['description'] == "Updated ip address" + - test_two['diff']['after']['tags'][0] == 10 + - test_two['msg'] == "ip_address 192.168.1.10/30 updated" + - test_two['ip_address']['address'] == "192.168.1.10/30" + - test_two['ip_address']['tags'][0] == 10 + - test_two['ip_address']['description'] == "Updated ip address" + +- name: "3 - Delete IP - 192.168.1.10 - State: Absent" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.1.10/30 + state: absent + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "present" + - test_three['diff']['after']['state'] == "absent" + - test_three['msg'] == "ip_address 192.168.1.10/30 deleted" + +- name: "4 - Create IP in global VRF - 192.168.1.20/30 - State: Present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.1.20/30 + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['msg'] == "ip_address 192.168.1.20/30 created" + - test_four['ip_address']['address'] == "192.168.1.20/30" + +- name: "5 - Create IP in global VRF - 192.168.1.20/30 - State: New" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.1.20/30 + state: new + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['msg'] == "ip_address 192.168.1.20/30 created" + - test_five['ip_address']['address'] == "192.168.1.20/30" + +- name: "6 - Create new address with only prefix specified - State: new" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 192.168.100.0/24 + state: new + register: test_six + +- name: "6 - ASSERT" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "absent" + - test_six['diff']['after']['state'] == "present" + - test_six['msg'] == "ip_address 192.168.100.1/24 created" + - test_six['ip_address']['address'] == "192.168.100.1/24" + +- name: "7 - Create IP address with several specified" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + address: 172.16.1.20/24 + vrf: Test VRF + tenant: Test Tenant + status: Reserved + role: Loopback + description: Test description + tags: + - "Schnozzberry" + state: present + register: test_seven + +- name: "7 - ASSERT" + assert: + that: + - test_seven is changed + - test_seven['diff']['before']['state'] == "absent" + - test_seven['diff']['after']['state'] == "present" + - test_seven['msg'] == "ip_address 172.16.1.20/24 created" + - test_seven['ip_address']['address'] == "172.16.1.20/24" + - test_seven['ip_address']['description'] == "Test description" + - test_seven['ip_address']['family'] == 4 + - test_seven['ip_address']['role'] == "loopback" + - test_seven['ip_address']['status'] == "reserved" + - test_seven['ip_address']['tags'][0] == 4 + - test_seven['ip_address']['tenant'] == 1 + - test_seven['ip_address']['vrf'] == 1 + +- name: "8 - Create IP address and assign a nat_inside IP" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + address: 10.10.1.30/16 + vrf: Test VRF + nat_inside: + address: 172.16.1.20 + vrf: Test VRF + register: test_eight + +- name: "8 - ASSERT" + assert: + that: + - test_eight is changed + - test_eight['diff']['before']['state'] == "absent" + - test_eight['diff']['after']['state'] == "present" + - test_eight['msg'] == "ip_address 10.10.1.30/16 created" + - test_eight['ip_address']['address'] == "10.10.1.30/16" + - test_eight['ip_address']['family'] == 4 + - test_eight['ip_address']['nat_inside'] == 11 + - test_eight['ip_address']['vrf'] == 1 + +- name: "9 - Create IP address on GigabitEthernet2 - test100 - State: present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + address: 10.10.200.30/16 + assigned_object: + name: GigabitEthernet2 + device: test100 + register: test_nine + +- name: "9 - ASSERT" + assert: + that: + - test_nine is changed + - test_nine['diff']['before']['state'] == "absent" + - test_nine['diff']['after']['state'] == "present" + - test_nine['msg'] == "ip_address 10.10.200.30/16 created" + - test_nine['ip_address']['address'] == "10.10.200.30/16" + - test_nine['ip_address']['family'] == 4 + - test_nine['ip_address']['assigned_object_type'] == "dcim.interface" + - test_nine['ip_address']['assigned_object_id'] == 4 + +- name: "10 - Create IP address on GigabitEthernet2 - test100 - State: new" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + prefix: 10.10.0.0/16 + assigned_object: + name: GigabitEthernet2 + device: test100 + state: new + register: test_ten + +- name: "10 - ASSERT" + assert: + that: + - test_ten is changed + - test_ten['diff']['before']['state'] == "absent" + - test_ten['diff']['after']['state'] == "present" + - test_ten['msg'] == "ip_address 10.10.0.1/16 created" + - test_ten['ip_address']['address'] == "10.10.0.1/16" + - test_ten['ip_address']['family'] == 4 + - test_ten['ip_address']['assigned_object_type'] == "dcim.interface" + - test_ten['ip_address']['assigned_object_id'] == 4 + +- name: "11 - Create IP address on GigabitEthernet2 - test100 - State: present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + prefix: 192.168.100.0/24 + assigned_object: + name: GigabitEthernet2 + device: test100 + state: present + register: test_eleven + +- name: "11 - ASSERT" + assert: + that: + - test_eleven is changed + - test_eleven['diff']['before']['state'] == "absent" + - test_eleven['diff']['after']['state'] == "present" + - test_eleven['msg'] == "ip_address 192.168.100.2/24 created" + - test_eleven['ip_address']['address'] == "192.168.100.2/24" + +- name: "12 - Duplicate - 192.168.100.2/24 on interface" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.100.2/24 + assigned_object: + name: GigabitEthernet2 + device: test100 + state: present + register: test_twelve + +- name: "12 - ASSERT" + assert: + that: + - not test_twelve['changed'] + - test_twelve['msg'] == "ip_address 192.168.100.2/24 already exists" + - test_twelve['ip_address']['address'] == "192.168.100.2/24" + - test_twelve['ip_address']['assigned_object_type'] == "dcim.interface" + - test_twelve['ip_address']['assigned_object_id'] == 4 + +- name: "13 - Duplicate - 192.168.100.2/24" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 192.168.100.2/24 + state: present + register: test_thirteen + +- name: "13 - ASSERT" + assert: + that: + - not test_thirteen['changed'] + - test_thirteen['msg'] == "ip_address 192.168.100.2/24 already exists" + - test_thirteen['ip_address']['address'] == "192.168.100.2/24" + +- name: "14 - Create IP address on Eth0 - test100-vm - State: present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + address: 10.188.1.100/24 + assigned_object: + name: Eth0 + virtual_machine: test100-vm + register: test_fourteen + +- name: "14 - ASSERT" + assert: + that: + - test_fourteen is changed + - test_fourteen['diff']['before']['state'] == "absent" + - test_fourteen['diff']['after']['state'] == "present" + - test_fourteen['msg'] == "ip_address 10.188.1.100/24 created" + - test_fourteen['ip_address']['address'] == "10.188.1.100/24" + - test_fourteen['ip_address']['family'] == 4 + - test_fourteen['ip_address']['assigned_object_type'] == "virtualization.vminterface" + - test_fourteen['ip_address']['assigned_object_id'] == 1 + +- name: "15 - Create same IP address on Eth0 - test101-vm - State: present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + address: 10.188.1.100/24 + assigned_object: + name: Eth0 + virtual_machine: test101-vm + state: "present" + register: test_fifteen + +- name: "15 - ASSERT" + assert: + that: + - test_fifteen is changed + - test_fifteen['diff']['before']['state'] == "absent" + - test_fifteen['diff']['after']['state'] == "present" + - test_fifteen['msg'] == "ip_address 10.188.1.100/24 created" + - test_fifteen['ip_address']['address'] == "10.188.1.100/24" + - test_fifteen['ip_address']['family'] == 4 + - test_fifteen['ip_address']['assigned_object_type'] == "virtualization.vminterface" + - test_fifteen['ip_address']['assigned_object_id'] == 6 + +- name: "16 - Create IP address with no mask - State: Present" + netbox.netbox.netbox_ip_address: + netbox_url: http://localhost.org:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + address: 10.120.10.1 + state: present + register: test_sixteen + +- name: "16 - ASSERT" + assert: + that: + - test_sixteen is changed + - test_sixteen['diff']['before']['state'] == "absent" + - test_sixteen['diff']['after']['state'] == "present" + - test_sixteen['msg'] == "ip_address 10.120.10.1/32 created" + - test_sixteen['ip_address']['address'] == "10.120.10.1/32" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_ipam_role.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_ipam_role.yml new file mode 100644 index 00000000..1f1ff0f3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_ipam_role.yml @@ -0,0 +1,94 @@ +--- +## +## +### NETBOX_IPAM_ROLE +## +## +- name: "IPAM_ROLE 1: Necessary info creation" + netbox.netbox.netbox_ipam_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test IPAM Role" + state: present + register: test_one + +- name: "IPAM_ROLE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['role']['name'] == "Test IPAM Role" + - test_one['role']['slug'] == "test-ipam-role" + - test_one['msg'] == "role Test IPAM Role created" + +- name: "IPAM_ROLE 2: Create duplicate" + netbox.netbox.netbox_ipam_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test IPAM Role" + state: present + register: test_two + +- name: "IPAM_ROLE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['role']['name'] == "Test IPAM Role" + - test_two['role']['slug'] == "test-ipam-role" + - test_two['msg'] == "role Test IPAM Role already exists" + +- name: "IPAM_ROLE 3: ASSERT - Update" + netbox.netbox.netbox_ipam_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test IPAM Role" + weight: 4096 + state: present + register: test_three + +- name: "IPAM_ROLE 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['after']['weight'] == 4096 + - test_three['role']['name'] == "Test IPAM Role" + - test_three['role']['slug'] == "test-ipam-role" + - test_three['role']['weight'] == 4096 + - test_three['msg'] == "role Test IPAM Role updated" + +- name: "IPAM_ROLE 4: ASSERT - Delete" + netbox.netbox.netbox_ipam_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test IPAM Role + state: absent + register: test_four + +- name: "IPAM_ROLE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "role Test IPAM Role deleted" + +- name: "IPAM_ROLE 5: ASSERT - Delete non existing" + netbox.netbox.netbox_ipam_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test IPAM Role + state: absent + register: test_five + +- name: "IPAM_ROLE 5: ASSERT - Delete non existing`" + assert: + that: + - not test_five['changed'] + - test_five['role'] == None + - test_five['msg'] == "role Test IPAM Role already absent" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_lookup.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_lookup.yml new file mode 100644 index 00000000..3217f1c7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_lookup.yml @@ -0,0 +1,82 @@ +--- +## +## +### NETBOX_LOOKUP +## +## +- name: "NETBOX_LOOKUP 1: Lookup returns exactly two sites" + assert: + that: "{{ query_result|count }} == 3" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'sites', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + +- name: "NETBOX_LOOKUP 2: Query doesn't return Wibble (sanity check json_query)" + assert: + that: "{{ query_result|json_query('[?value.display_name==`Wibble`]')|count }} == 0" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'devices', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + +- name: "NETBOX_LOOKUP 3: Device query returns exactly one TestDeviceR1" + assert: + that: "{{ query_result|json_query('[?value.display_name==`TestDeviceR1`]')|count }} == 1" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'devices', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + +- name: "NETBOX_LOOKUP 4: VLAN ID 400 can be queried and is named 'Test VLAN'" + assert: + that: "{{ (query_result|json_query('[?value.vid==`400`].value.name'))[0] == 'Test VLAN' }}" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'vlans', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + +- name: "NETBOX_LOOKUP 5: Add one of two devices for lookup filter test." + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "L1" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + tags: + - "nolookup" + state: present + +- name: "NETBOX_LOOKUP 6: Add two of two devices for lookup filter test." + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "L2" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site2" + status: "Staged" + tags: + - "lookup" + state: present + +- name: "NETBOX_LOOKUP 7: Device query returns exactly the L2 device" + assert: + that: "{{ query_result|json_query('[?value.display_name==`L2`]')|count }} == 1" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'devices', api_filter='role=core-switch tag=lookup', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + +- name: "NETBOX_LOOKUP 8: Device query specifying raw data returns payload without key/value dict" + assert: + that: "{{ query_result|json_query('[?display_name==`L2`]')|count }} == 1" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'devices', api_filter='role=core-switch tag=lookup', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567', raw_data=True) }}" + +- name: "NETBOX_LOOKUP 9: Device query specifying multiple sites, Make sure L1 and L2 are in the results" + assert: + that: + - "'L1' in {{ query_result |json_query('[*].display_name') }}" + - "'L2' in {{ query_result |json_query('[*].display_name') }}" + vars: + query_result: "{{ query('netbox.netbox.nb_lookup', 'devices', api_filter='role=core-switch site=test-site site=test-site2', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567', raw_data=True) }}" + +- name: "NETBOX_LOOKUP 10: Device query by ID" + assert: + that: + - "{{ query('netbox.netbox.nb_lookup', 'devices', api_filter='id=1', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_manufacturer.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_manufacturer.yml new file mode 100644 index 00000000..4dd1907e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_manufacturer.yml @@ -0,0 +1,91 @@ +--- +## +## +### NETBOX_MANUFACTURER +## +## +- name: "MANUFACTURER 1: Necessary info creation" + netbox.netbox.netbox_manufacturer: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Manufacturer Two + state: present + register: test_one + +- name: "MANUFACTURER 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['manufacturer']['name'] == "Test Manufacturer Two" + - test_one['manufacturer']['slug'] == "test-manufacturer-two" + - test_one['msg'] == "manufacturer Test Manufacturer Two created" + +- name: "MANUFACTURER 2: Create duplicate" + netbox.netbox.netbox_manufacturer: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Manufacturer Two + state: present + register: test_two + +- name: "MANUFACTURER 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['manufacturer']['name'] == "Test Manufacturer Two" + - test_two['manufacturer']['slug'] == "test-manufacturer-two" + - test_two['msg'] == "manufacturer Test Manufacturer Two already exists" + +- name: "MANUFACTURER 3: Update" + netbox.netbox.netbox_manufacturer: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: test manufacturer two + state: present + register: test_three + +- name: "MANUFACTURER 3: ASSERT - Update" + assert: + that: + - test_three['changed'] + - test_three['manufacturer']['name'] == "test manufacturer two" + - test_three['manufacturer']['slug'] == "test-manufacturer-two" + - test_three['msg'] == "manufacturer test manufacturer two updated" + +- name: "MANUFACTURER 4: ASSERT - Delete" + netbox.netbox.netbox_manufacturer: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: test manufacturer two + state: absent + register: test_four + +- name: "MANUFACTURER 3: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "manufacturer test manufacturer two deleted" + +- name: "MANUFACTURER 5: ASSERT - Delete non existing" + netbox.netbox.netbox_manufacturer: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Manufacturer Two + state: absent + register: test_five + +- name: "MANUFACTURER 5: ASSERT - Delete non existing" + assert: + that: + - not test_five['changed'] + - test_five['manufacturer'] == None + - test_five['msg'] == "manufacturer Test Manufacturer Two already absent" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_platform.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_platform.yml new file mode 100644 index 00000000..95ccdb4c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_platform.yml @@ -0,0 +1,99 @@ +--- +## +## +### NETBOX_PLATFORM +## +## +- name: "PLATFORM 1: Necessary info creation" + netbox.netbox.netbox_platform: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Platform + state: present + register: test_one + +- name: "PLATFORM 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['platform']['name'] == "Test Platform" + - test_one['platform']['slug'] == "test-platform" + - test_one['msg'] == "platform Test Platform created" + +- name: "PLATFORM 2: Create duplicate" + netbox.netbox.netbox_platform: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Platform + state: present + register: test_two + +- name: "PLATFORM 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['platform']['name'] == "Test Platform" + - test_two['platform']['slug'] == "test-platform" + - test_two['msg'] == "platform Test Platform already exists" + +- name: "PLATFORM 3: ASSERT - Update" + netbox.netbox.netbox_platform: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Platform + manufacturer: Test Manufacturer + napalm_driver: ios + napalm_args: + global_delay_factor: 2 + state: present + register: test_three + +- name: "PLATFORM 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['after']['manufacturer'] == 3 + - test_three['diff']['after']['napalm_args']['global_delay_factor'] == 2 + - test_three['diff']['after']['napalm_driver'] == "ios" + - test_three['platform']['manufacturer'] == 3 + - test_three['platform']['napalm_args']['global_delay_factor'] == 2 + - test_three['platform']['napalm_driver'] == "ios" + - test_three['msg'] == "platform Test Platform updated" + +- name: "PLATFORM 4: ASSERT - Delete" + netbox.netbox.netbox_platform: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Platform + state: absent + register: test_four + +- name: "PLATFORM 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "platform Test Platform deleted" + +- name: "PLATFORM 5: ASSERT - Delete non existing" + netbox.netbox.netbox_platform: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Platform + state: absent + register: test_five + +- name: "PLATFORM 5: ASSERT - Delete non existing`" + assert: + that: + - not test_five['changed'] + - test_five['platform'] == None + - test_five['msg'] == "platform Test Platform already absent" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_feed.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_feed.yml new file mode 100644 index 00000000..a02fd912 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_feed.yml @@ -0,0 +1,127 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_FEED +## +## +- name: "POWER_FEED 1: Necessary info creation" + netbox.netbox.netbox_power_feed: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Feed + power_panel: Power Panel + state: present + register: test_one + +- name: "POWER_FEED 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_feed']['name'] == "Power Feed" + - test_one['power_feed']['power_panel'] == 1 + - test_one['msg'] == "power_feed Power Feed created" + +- name: "POWER_FEED 2: Create duplicate" + netbox.netbox.netbox_power_feed: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Feed + power_panel: Power Panel + state: present + register: test_two + +- name: "POWER_FEED 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_feed']['name'] == "Power Feed" + - test_two['power_feed']['power_panel'] == 1 + - test_two['msg'] == "power_feed Power Feed already exists" + +- name: "POWER_FEED 3: Update power_feed with other fields" + netbox.netbox.netbox_power_feed: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Feed + power_panel: Power Panel + status: offline + type: redundant + supply: dc + phase: three-phase + voltage: 400 + amperage: 32 + max_utilization: 25 + comments: totally normal power feed + state: present + register: test_three + +- name: "POWER_FEED 3: ASSERT - Update power_feed with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['status'] == "offline" + - test_three['diff']['after']['type'] == "redundant" + - test_three['diff']['after']['supply'] == "dc" + - test_three['diff']['after']['phase'] == "three-phase" + - test_three['diff']['after']['voltage'] == 400 + - test_three['diff']['after']['amperage'] == 32 + - test_three['diff']['after']['max_utilization'] == 25 + - test_three['diff']['after']['comments'] == "totally normal power feed" + - test_three['power_feed']['name'] == "Power Feed" + - test_three['power_feed']['power_panel'] == 1 + - test_three['power_feed']['status'] == "offline" + - test_three['power_feed']['type'] == "redundant" + - test_three['power_feed']['supply'] == "dc" + - test_three['power_feed']['phase'] == "three-phase" + - test_three['power_feed']['voltage'] == 400 + - test_three['power_feed']['amperage'] == 32 + - test_three['power_feed']['max_utilization'] == 25 + - test_three['power_feed']['comments'] == "totally normal power feed" + - test_three['msg'] == "power_feed Power Feed updated" + +- name: "POWER_FEED 4: Create Power Feed for Delete Test" + netbox.netbox.netbox_power_feed: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Feed 2 + power_panel: Power Panel + state: present + register: test_four + +- name: "POWER_FEED 4: ASSERT - Create Power Feed for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_feed']['name'] == "Power Feed 2" + - test_four['power_feed']['power_panel'] == 1 + - test_four['msg'] == "power_feed Power Feed 2 created" + + +- name: "POWER_FEED 5: Delete Power Feed" + netbox.netbox.netbox_power_feed: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Feed 2 + power_panel: Power Panel + state: absent + register: test_five + +- name: "POWER_FEED 5: ASSERT - Delete Power Feed" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_feed Power Feed 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_outlet.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_outlet.yml new file mode 100644 index 00000000..c7b5f7d3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_outlet.yml @@ -0,0 +1,114 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_OUTLET +## +## +- name: "POWER_OUTLET 1: Necessary info creation" + netbox.netbox.netbox_power_outlet: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet + device: Device Power Tests + state: present + register: test_one + +- name: "POWER_OUTLET 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_outlet']['name'] == "Power Outlet" + - test_one['power_outlet']['device'] == 10 + - test_one['msg'] == "power_outlet Power Outlet created" + +- name: "POWER_OUTLET 2: Create duplicate" + netbox.netbox.netbox_power_outlet: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet + device: Device Power Tests + state: present + register: test_two + +- name: "POWER_OUTLET 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_outlet']['name'] == "Power Outlet" + - test_two['power_outlet']['device'] == 10 + - test_two['msg'] == "power_outlet Power Outlet already exists" + +- name: "POWER_OUTLET 3: Update power_outlet with other fields" + netbox.netbox.netbox_power_outlet: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet + device: Device Power Tests + type: ita-e + power_port: Power Port + feed_leg: B + description: test description + state: present + register: test_three + +- name: "POWER_OUTLET 3: ASSERT - Update power_outlet with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "ita-e" + - test_three['diff']['after']['power_port'] == 1 + - test_three['diff']['after']['feed_leg'] == "B" + - test_three['diff']['after']['description'] == "test description" + - test_three['power_outlet']['name'] == "Power Outlet" + - test_three['power_outlet']['device'] == 10 + - test_three['power_outlet']['type'] == "ita-e" + - test_three['power_outlet']['power_port'] == 1 + - test_three['power_outlet']['feed_leg'] == "B" + - test_three['power_outlet']['description'] == "test description" + - test_three['msg'] == "power_outlet Power Outlet updated" + +- name: "POWER_OUTLET 4: Create Power Outlet for Delete Test" + netbox.netbox.netbox_power_outlet: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet 2 + device: Device Power Tests + state: present + register: test_four + +- name: "POWER_OUTLET 4: ASSERT - Create Power Outlet for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_outlet']['name'] == "Power Outlet 2" + - test_four['power_outlet']['device'] == 10 + - test_four['msg'] == "power_outlet Power Outlet 2 created" + +- name: "POWER_OUTLET 5: Delete Power Outlet" + netbox.netbox.netbox_power_outlet: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet 2 + device: Device Power Tests + state: absent + register: test_five + +- name: "POWER_OUTLET 5: ASSERT - Delete Power Outlet" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_outlet Power Outlet 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_outlet_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_outlet_template.yml new file mode 100644 index 00000000..654830c1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_outlet_template.yml @@ -0,0 +1,111 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_OUTLET_TEMPLATE +## +## +- name: "POWER_OUTLET_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_power_outlet_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet Template + device_type: Device Type Power Tests + state: present + register: test_one + +- name: "POWER_OUTLET_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_outlet_template']['name'] == "Power Outlet Template" + - test_one['power_outlet_template']['device_type'] == 8 + - test_one['msg'] == "power_outlet_template Power Outlet Template created" + +- name: "POWER_OUTLET_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_power_outlet_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet Template + device_type: Device Type Power Tests + state: present + register: test_two + +- name: "POWER_OUTLET_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_outlet_template']['name'] == "Power Outlet Template" + - test_two['power_outlet_template']['device_type'] == 8 + - test_two['msg'] == "power_outlet_template Power Outlet Template already exists" + +- name: "POWER_OUTLET_TEMPLATE 3: Update power_outlet_template with other fields" + netbox.netbox.netbox_power_outlet_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet Template + device_type: Device Type Power Tests + type: ita-e + power_port: Power Port + feed_leg: B + state: present + register: test_three + +- name: "POWER_OUTLET_TEMPLATE 3: ASSERT - Update power_outlet_template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "ita-e" + - test_three['diff']['after']['power_port'] == 1 + - test_three['diff']['after']['feed_leg'] == "B" + - test_three['power_outlet_template']['name'] == "Power Outlet Template" + - test_three['power_outlet_template']['device_type'] == 8 + - test_three['power_outlet_template']['type'] == "ita-e" + - test_three['power_outlet_template']['power_port'] == 1 + - test_three['power_outlet_template']['feed_leg'] == "B" + - test_three['msg'] == "power_outlet_template Power Outlet Template updated" + +- name: "POWER_OUTLET_TEMPLATE 4: Create Power Outlet Template for Delete Test" + netbox.netbox.netbox_power_outlet_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet Template 2 + device_type: Device Type Power Tests + state: present + register: test_four + +- name: "POWER_OUTLET_TEMPLATE 4: ASSERT - Create Power Outlet Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_outlet_template']['name'] == "Power Outlet Template 2" + - test_four['power_outlet_template']['device_type'] == 8 + - test_four['msg'] == "power_outlet_template Power Outlet Template 2 created" + +- name: "POWER_OUTLET_TEMPLATE 5: Delete Power Outlet Template" + netbox.netbox.netbox_power_outlet_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Outlet Template 2 + device_type: Device Type Power Tests + state: absent + register: test_five + +- name: "POWER_OUTLET_TEMPLATE 5: ASSERT - Delete Power Outlet Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_outlet_template Power Outlet Template 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_panel.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_panel.yml new file mode 100644 index 00000000..6083a1c4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_panel.yml @@ -0,0 +1,106 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_PANEL +## +## +- name: "POWER_PANEL 1: Necessary info creation" + netbox.netbox.netbox_power_panel: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Panel + site: Test Site + state: present + register: test_one + +- name: "POWER_PANEL 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_panel']['name'] == "Power Panel" + - test_one['power_panel']['site'] == 1 + - test_one['msg'] == "power_panel Power Panel created" + +- name: "POWER_PANEL 2: Create duplicate" + netbox.netbox.netbox_power_panel: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Panel + site: Test Site + state: present + register: test_two + +- name: "POWER_PANEL 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_panel']['name'] == "Power Panel" + - test_two['power_panel']['site'] == 1 + - test_two['msg'] == "power_panel Power Panel already exists" + +- name: "POWER_PANEL 3: Update power_panel with other fields" + netbox.netbox.netbox_power_panel: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Panel + site: Test Site + rack_group: Test Rack Group + state: present + register: test_three + +- name: "POWER_PANEL 3: ASSERT - Update power_panel with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['rack_group'] == 1 + - test_three['power_panel']['name'] == "Power Panel" + - test_three['power_panel']['site'] == 1 + - test_three['power_panel']['rack_group'] == 1 + - test_three['msg'] == "power_panel Power Panel updated" + +- name: "POWER_PANEL 4: Create Power Panel for Delete Test" + netbox.netbox.netbox_power_panel: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Panel 2 + site: Test Site + state: present + register: test_four + +- name: "POWER_PANEL 4: ASSERT - Create Power Panel for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_panel']['name'] == "Power Panel 2" + - test_four['power_panel']['site'] == 1 + - test_four['msg'] == "power_panel Power Panel 2 created" + + +- name: "POWER_PANEL 5: Delete Power Panel" + netbox.netbox.netbox_power_panel: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Panel 2 + site: Test Site + state: absent + register: test_five + +- name: "POWER_PANEL 5: ASSERT - Delete Power Panel" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_panel Power Panel 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_port.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_port.yml new file mode 100644 index 00000000..b6368bd9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_port.yml @@ -0,0 +1,125 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_PORT +## +## +- name: "POWER_PORT 0: Create device for testing power ports" + netbox.netbox.netbox_device: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Device Power Tests + device_type: Cisco Test + device_role: Core Switch + site: Test Site + state: present + +- name: "POWER_PORT 1: Necessary info creation" + netbox.netbox.netbox_power_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port + device: Device Power Tests + state: present + register: test_one + +- name: "POWER_PORT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_port']['name'] == "Power Port" + - test_one['power_port']['device'] == 10 + - test_one['msg'] == "power_port Power Port created" + +- name: "POWER_PORT 2: Create duplicate" + netbox.netbox.netbox_power_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port + device: Device Power Tests + state: present + register: test_two + +- name: "POWER_PORT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_port']['name'] == "Power Port" + - test_two['power_port']['device'] == 10 + - test_two['msg'] == "power_port Power Port already exists" + +- name: "POWER_FEED 3: Update power_port with other fields" + netbox.netbox.netbox_power_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port + device: Device Power Tests + type: ita-e + allocated_draw: 10 + maximum_draw: 20 + description: test description + state: present + register: test_three + +- name: "POWER_FEED 3: ASSERT - Update power_port with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "ita-e" + - test_three['diff']['after']['allocated_draw'] == 10 + - test_three['diff']['after']['maximum_draw'] == 20 + - test_three['diff']['after']['description'] == "test description" + - test_three['power_port']['name'] == "Power Port" + - test_three['power_port']['device'] == 10 + - test_three['power_port']['type'] == "ita-e" + - test_three['power_port']['allocated_draw'] == 10 + - test_three['power_port']['maximum_draw'] == 20 + - test_three['power_port']['description'] == "test description" + - test_three['msg'] == "power_port Power Port updated" + +- name: "POWER_PORT 4: Create Power Port for Delete Test" + netbox.netbox.netbox_power_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port 2 + device: Device Power Tests + state: present + register: test_four + +- name: "POWER_PORT 4: ASSERT - Create Power Port for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_port']['name'] == "Power Port 2" + - test_four['power_port']['device'] == 10 + - test_four['msg'] == "power_port Power Port 2 created" + +- name: "POWER_PORT 5: Delete Power Port" + netbox.netbox.netbox_power_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port 2 + device: Device Power Tests + state: absent + register: test_five + +- name: "POWER_PORT 5: ASSERT - Delete Power Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_port Power Port 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_port_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_port_template.yml new file mode 100644 index 00000000..9e7547fd --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_power_port_template.yml @@ -0,0 +1,120 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_POWER_PORT_TEMPLATE +## +## +- name: "POWER_PORT_TEMPLATE 0: Create device type for testing power ports" + netbox.netbox.netbox_device_type: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + model: Device Type Power Tests + manufacturer: Test Manufacturer + state: present + +- name: "POWER_PORT_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_power_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port Template + device_type: Device Type Power Tests + state: present + register: test_one + +- name: "POWER_PORT_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['power_port_template']['name'] == "Power Port Template" + - test_one['power_port_template']['device_type'] == 8 + - test_one['msg'] == "power_port_template Power Port Template created" + +- name: "POWER_PORT_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_power_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port Template + device_type: Device Type Power Tests + state: present + register: test_two + +- name: "POWER_PORT_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['power_port_template']['name'] == "Power Port Template" + - test_two['power_port_template']['device_type'] == 8 + - test_two['msg'] == "power_port_template Power Port Template already exists" + +- name: "POWER_PORT_TEMPLATE 3: Update power_port_template with other fields" + netbox.netbox.netbox_power_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port Template + device_type: Device Type Power Tests + type: ita-e + allocated_draw: 10 + maximum_draw: 20 + state: present + register: test_three + +- name: "POWER_PORT_TEMPLATE 3: ASSERT - Update power_port_template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['type'] == "ita-e" + - test_three['diff']['after']['allocated_draw'] == 10 + - test_three['diff']['after']['maximum_draw'] == 20 + - test_three['power_port_template']['name'] == "Power Port Template" + - test_three['power_port_template']['device_type'] == 8 + - test_three['power_port_template']['type'] == "ita-e" + - test_three['power_port_template']['allocated_draw'] == 10 + - test_three['power_port_template']['maximum_draw'] == 20 + - test_three['msg'] == "power_port_template Power Port Template updated" + +- name: "POWER_PORT_TEMPLATE 4: Create Power Port Template for Delete Test" + netbox.netbox.netbox_power_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port Template 2 + device_type: Device Type Power Tests + state: present + register: test_four + +- name: "POWER_PORT_TEMPLATE 4: ASSERT - Create Power Port Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['power_port_template']['name'] == "Power Port Template 2" + - test_four['power_port_template']['device_type'] == 8 + - test_four['msg'] == "power_port_template Power Port Template 2 created" + +- name: "POWER_PORT_TEMPLATE 5: Delete Power Port Template" + netbox.netbox.netbox_power_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Power Port Template 2 + device_type: Device Type Power Tests + state: absent + register: test_five + +- name: "POWER_PORT_TEMPLATE 5: ASSERT - Delete Power Port Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "power_port_template Power Port Template 2 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_prefix.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_prefix.yml new file mode 100644 index 00000000..7a465548 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_prefix.yml @@ -0,0 +1,245 @@ +--- +## +## +### NETBOX_PREFIX +## +## +- name: "1 - Create prefix within Netbox with only required information" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.156.0.0/19 + state: present + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['msg'] == "prefix 10.156.0.0/19 created" + - test_one['prefix']['prefix'] == "10.156.0.0/19" + +- name: "2 - Duplicate" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.156.0.0/19 + state: present + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['msg'] == "prefix 10.156.0.0/19 already exists" + - test_two['prefix']['prefix'] == "10.156.0.0/19" + +- name: "3 - Update 10.156.0.0/19" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.156.0.0/19 + site: Test Site + status: Reserved + description: "This prefix has been updated" + state: present + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['after']['site'] == 1 + - test_three['diff']['after']['status'] == "reserved" + - test_three['diff']['after']['description'] == "This prefix has been updated" + - test_three['msg'] == "prefix 10.156.0.0/19 updated" + - test_three['prefix']['prefix'] == "10.156.0.0/19" + - test_three['prefix']['site'] == 1 + - test_three['prefix']['status'] == "reserved" + - test_three['prefix']['description'] == "This prefix has been updated" + +- name: "4 - Delete prefix within netbox" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.156.0.0/19 + state: absent + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "prefix 10.156.0.0/19 deleted" + +- name: "5 - Create prefix with several specified options" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + family: 4 + prefix: 10.156.32.0/19 + site: Test Site + vrf: Test VRF + tenant: Test Tenant + vlan: + name: Test VLAN + site: Test Site + tenant: Test Tenant + vlan_group: Test Vlan Group + status: Reserved + prefix_role: Network of care + description: Test description + is_pool: true + tags: + - "Schnozzberry" + state: present + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['msg'] == "prefix 10.156.32.0/19 created" + - test_five['prefix']['prefix'] == "10.156.32.0/19" + - test_five['prefix']['family'] == 4 + - test_five['prefix']['site'] == 1 + - test_five['prefix']['vrf'] == 1 + - test_five['prefix']['tenant'] == 1 + - test_five['prefix']['vlan'] == 4 + - test_five['prefix']['status'] == "reserved" + - test_five['prefix']['role'] == 1 + - test_five['prefix']['description'] == "Test description" + - test_five['prefix']['is_pool'] == true + - test_five['prefix']['tags'][0] == 4 + +- name: "6 - Get a new /24 inside 10.156.0.0/19 within Netbox - Parent doesn't exist" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + parent: 10.156.0.0/19 + prefix_length: 24 + state: present + first_available: yes + register: test_six + +- name: "6 - ASSERT" + assert: + that: + - not test_six['changed'] + - test_six['msg'] == "Parent prefix does not exist - 10.156.0.0/19" + +- name: "7 - Create prefix within Netbox with only required information" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.156.0.0/19 + state: present + register: test_seven + +- name: "7 - ASSERT" + assert: + that: + - test_seven is changed + - test_seven['diff']['before']['state'] == "absent" + - test_seven['diff']['after']['state'] == "present" + - test_seven['msg'] == "prefix 10.156.0.0/19 created" + - test_seven['prefix']['prefix'] == "10.156.0.0/19" + +- name: "8 - Get a new /24 inside 10.156.0.0/19 within Netbox" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + parent: 10.156.0.0/19 + prefix_length: 24 + state: present + first_available: yes + register: test_eight + +- name: "8 - ASSERT" + assert: + that: + - test_eight is changed + - test_eight['diff']['before']['state'] == "absent" + - test_eight['diff']['after']['state'] == "present" + - test_eight['msg'] == "prefix 10.156.0.0/24 created" + - test_eight['prefix']['prefix'] == "10.156.0.0/24" + +- name: "9 - Create 10.157.0.0/19" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + prefix: 10.157.0.0/19 + vrf: Test VRF + site: Test Site + state: present + register: test_nine + +- name: "9 - ASSERT" + assert: + that: + - test_nine is changed + - test_nine['diff']['before']['state'] == "absent" + - test_nine['diff']['after']['state'] == "present" + - test_nine['msg'] == "prefix 10.157.0.0/19 created" + - test_nine['prefix']['prefix'] == "10.157.0.0/19" + - test_nine['prefix']['site'] == 1 + - test_nine['prefix']['vrf'] == 1 + +- name: "10 - Get a new /24 inside 10.157.0.0/19 within Netbox with additional values" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + parent: 10.157.0.0/19 + prefix_length: 24 + vrf: Test VRF + site: Test Site + state: present + first_available: yes + register: test_ten + +- name: "10 - ASSERT" + assert: + that: + - test_ten is changed + - test_ten['diff']['before']['state'] == "absent" + - test_ten['diff']['after']['state'] == "present" + - test_ten['msg'] == "prefix 10.157.0.0/24 created" + - test_ten['prefix']['prefix'] == "10.157.0.0/24" + - test_ten['prefix']['site'] == 1 + - test_ten['prefix']['vrf'] == 1 + +- name: "11 - Get a new /24 inside 10.156.0.0/19 within Netbox" + netbox.netbox.netbox_prefix: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + parent: 10.156.0.0/19 + prefix_length: 24 + state: present + first_available: yes + register: test_eleven + +- name: "11 - ASSERT" + assert: + that: + - test_eleven is changed + - test_eleven['diff']['before']['state'] == "absent" + - test_eleven['diff']['after']['state'] == "present" + - test_eleven['msg'] == "prefix 10.156.1.0/24 created" + - test_eleven['prefix']['prefix'] == "10.156.1.0/24" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_provider.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_provider.yml new file mode 100644 index 00000000..782df16f --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_provider.yml @@ -0,0 +1,99 @@ +--- +## +## +### NETBOX_PROVIDER +## +## +- name: "NETBOX_PROVIDER 1: Create provider within Netbox with only required information" + netbox.netbox.netbox_provider: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Provider One + state: present + register: test_one + +- name: "NETBOX_PROVIDER 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['provider']['name'] == "Test Provider One" + - test_one['provider']['slug'] == "test-provider-one" + - test_one['msg'] == "provider Test Provider One created" + +- name: "NETBOX_PROVIDER 2: Duplicate" + netbox.netbox.netbox_provider: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Provider One + state: present + register: test_two + +- name: "NETBOX_PROVIDER 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['provider']['name'] == "Test Provider One" + - test_two['provider']['slug'] == "test-provider-one" + - test_two['msg'] == "provider Test Provider One already exists" + +- name: "NETBOX_PROVIDER 3: Update provider with other fields" + netbox.netbox.netbox_provider: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Provider One + asn: 65001 + account: "200129104" + portal_url: http://provider.net + noc_contact: noc@provider.net + admin_contact: admin@provider.net + comments: "BAD PROVIDER" + state: present + register: test_three + +- name: "NETBOX_PROVIDER 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['asn'] == 65001 + - test_three['diff']['after']['account'] == "200129104" + - test_three['diff']['after']['portal_url'] == "http://provider.net" + - test_three['diff']['after']['noc_contact'] == "noc@provider.net" + - test_three['diff']['after']['admin_contact'] == "admin@provider.net" + - test_three['diff']['after']['comments'] == "BAD PROVIDER" + - test_three['provider']['name'] == "Test Provider One" + - test_three['provider']['slug'] == "test-provider-one" + - test_three['provider']['asn'] == 65001 + - test_three['provider']['account'] == "200129104" + - test_three['provider']['portal_url'] == "http://provider.net" + - test_three['provider']['noc_contact'] == "noc@provider.net" + - test_three['provider']['admin_contact'] == "admin@provider.net" + - test_three['provider']['comments'] == "BAD PROVIDER" + - test_three['msg'] == "provider Test Provider One updated" + +- name: "NETBOX_PROVIDER 4: Delete provider within netbox" + netbox.netbox.netbox_provider: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test Provider One + state: absent + register: test_four + +- name: "NETBOX_PROVIDER 4 : ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['provider']['name'] == "Test Provider One" + - test_four['provider']['slug'] == "test-provider-one" + - test_four['provider']['asn'] == 65001 + - test_four['provider']['account'] == "200129104" + - test_four['provider']['portal_url'] == "http://provider.net" + - test_four['provider']['noc_contact'] == "noc@provider.net" + - test_four['provider']['admin_contact'] == "admin@provider.net" + - test_four['provider']['comments'] == "BAD PROVIDER" + - test_four['msg'] == "provider Test Provider One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rack.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rack.yml new file mode 100644 index 00000000..a65cb66e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rack.yml @@ -0,0 +1,225 @@ +--- +## +## +### NETBOX_RACK +## +## +- name: "1 - Test rack creation" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test rack one" + site: "Test Site" + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rack']['name'] == "Test rack one" + - test_one['rack']['site'] == 1 + +- name: "Test duplicate rack" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test rack one" + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['rack']['name'] == "Test rack one" + - test_two['rack']['site'] == 1 + - test_two['msg'] == "rack Test rack one already exists" + +- name: "3 - Create new rack with similar name" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test rack - Test Site + site: Test Site + state: present + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['rack']['name'] == "Test rack - Test Site" + - test_three['rack']['site'] == 1 + - test_three['msg'] == "rack Test rack - Test Site created" + +- name: "4 - Attempt to create Test rack one again" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test rack one + site: Test Site + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - not test_four['changed'] + - test_four['rack']['name'] == "Test rack one" + - test_four['rack']['site'] == 1 + - test_four['msg'] == "rack Test rack one already exists" + +- name: "5 - Update Test rack one with more options" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test rack one + site: Test Site + rack_role: "Test Rack Role" + rack_group: "Test Rack Group" + facility_id: "EQUI10291" + tenant: "Test Tenant" + status: Available + serial: "FXS10001" + asset_tag: "1234" + width: 23 + u_height: 48 + type: "2-post frame" + outer_width: 32 + outer_depth: 24 + outer_unit: "Inches" + comments: "Just testing rack module" + tags: + - "Schnozzberry" + state: present + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['after']['asset_tag'] == "1234" + - test_five['diff']['after']['comments'] == "Just testing rack module" + - test_five['diff']['after']['facility_id'] == "EQUI10291" + - test_five['diff']['after']['group'] == 1 + - test_five['diff']['after']['outer_depth'] == 24 + - test_five['diff']['after']['outer_unit'] == "in" + - test_five['diff']['after']['outer_width'] == 32 + - test_five['diff']['after']['role'] == 1 + - test_five['diff']['after']['serial'] == "FXS10001" + - test_five['diff']['after']['status'] == "available" + - test_five['diff']['after']['tenant'] == 1 + - test_five['diff']['after']['tags'][0] == 4 + - test_five['diff']['after']['type'] == "2-post-frame" + - test_five['diff']['after']['u_height'] == 48 + - test_five['diff']['after']['width'] == 23 + - test_five['rack']['name'] == "Test rack one" + - test_five['rack']['site'] == 1 + - test_five['rack']['asset_tag'] == "1234" + - test_five['rack']['comments'] == "Just testing rack module" + - test_five['rack']['facility_id'] == "EQUI10291" + - test_five['rack']['group'] == 1 + - test_five['rack']['outer_depth'] == 24 + - test_five['rack']['outer_unit'] == "in" + - test_five['rack']['outer_width'] == 32 + - test_five['rack']['role'] == 1 + - test_five['rack']['serial'] == "FXS10001" + - test_five['rack']['status'] == "available" + - test_five['rack']['tenant'] == 1 + - test_five['rack']['tags'][0] == 4 + - test_five['rack']['type'] == "2-post-frame" + - test_five['rack']['u_height'] == 48 + - test_five['rack']['width'] == 23 + - test_five['msg'] == "rack Test rack one updated" + +- name: "6 - Update Test rack one with same options" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test rack one + site: Test Site + rack_role: "Test Rack Role" + rack_group: "Test Rack Group" + facility_id: "EQUI10291" + tenant: "Test Tenant" + status: Available + serial: "FXS10001" + asset_tag: "1234" + width: 23 + u_height: 48 + type: "2-post frame" + outer_width: 32 + outer_depth: 24 + outer_unit: "Inches" + comments: "Just testing rack module" + tags: + - "Schnozzberry" + state: present + register: test_six + +- name: "6 - ASSERT" + assert: + that: + - test_six is not changed + - test_six['rack']['name'] == "Test rack one" + - test_six['rack']['site'] == 1 + - test_six['rack']['asset_tag'] == "1234" + - test_six['rack']['comments'] == "Just testing rack module" + - test_six['rack']['facility_id'] == "EQUI10291" + - test_six['rack']['group'] == 1 + - test_six['rack']['outer_depth'] == 24 + - test_six['rack']['outer_unit'] == "in" + - test_six['rack']['outer_width'] == 32 + - test_six['rack']['role'] == 1 + - test_six['rack']['serial'] == "FXS10001" + - test_six['rack']['status'] == "available" + - test_six['rack']['tenant'] == 1 + - test_six['rack']['tags'][0] == 4 + - test_six['rack']['type'] == "2-post-frame" + - test_six['rack']['u_height'] == 48 + - test_six['rack']['width'] == 23 + +- name: "7 - Create rack with same asset tag and serial number" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test rack two + site: Test Site + serial: "FXS10001" + asset_tag: "1234" + state: present + ignore_errors: yes + register: test_seven + +- name: "7 - ASSERT" + assert: + that: + - test_seven is failed + - "'Asset tag already exists' in test_seven['msg']" + +- name: "8 - Test delete" + netbox.netbox.netbox_rack: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test rack one" + state: "absent" + register: test_eight + +- name: "8 - ASSERT" + assert: + that: + - test_eight is changed + - test_eight['diff']['before']['state'] == "present" + - test_eight['diff']['after']['state'] == "absent" + - test_eight['msg'] == "rack Test rack one deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rack_group.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rack_group.yml new file mode 100644 index 00000000..6a10cbf9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rack_group.yml @@ -0,0 +1,62 @@ +--- +## +## +### NETBOX_RACK_GROUP +## +## +- name: "RACK_GROUP 1: Necessary info creation" + netbox.netbox.netbox_rack_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Group + site: Test Site + state: present + register: test_one + +- name: "RACK_GROUP 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rack_group']['name'] == "Rack Group" + - test_one['rack_group']['slug'] == "rack-group" + - test_one['rack_group']['site'] == 1 + - test_one['msg'] == "rack_group Rack Group created" + +- name: "RACK_GROUP 2: Create duplicate" + netbox.netbox.netbox_rack_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Group + site: Test Site + state: present + register: test_two + +- name: "RACK_GROUP 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['rack_group']['name'] == "Rack Group" + - test_two['rack_group']['slug'] == "rack-group" + - test_two['rack_group']['site'] == 1 + - test_two['msg'] == "rack_group Rack Group already exists" + +- name: "RACK_GROUP 3: ASSERT - Delete" + netbox.netbox.netbox_rack_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Group + state: absent + register: test_three + +- name: "RACK_GROUP 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "present" + - test_three['diff']['after']['state'] == "absent" + - test_three['msg'] == "rack_group Rack Group deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rack_role.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rack_role.yml new file mode 100644 index 00000000..5ca9e44e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rack_role.yml @@ -0,0 +1,81 @@ +--- +## +## +### NETBOX_RACK_ROLE +## +## +- name: "RACK_ROLE 1: Necessary info creation" + netbox.netbox.netbox_rack_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Role + color: "ffffff" + state: present + register: test_one + +- name: "RACK_ROLE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rack_role']['name'] == "Rack Role" + - test_one['rack_role']['slug'] == "rack-role" + - test_one['rack_role']['color'] == "ffffff" + - test_one['msg'] == "rack_role Rack Role created" + +- name: "RACK_ROLE 2: Create duplicate" + netbox.netbox.netbox_rack_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Role + state: present + register: test_two + +- name: "RACK_ROLE 1: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['rack_role']['name'] == "Rack Role" + - test_two['rack_role']['slug'] == "rack-role" + - test_two['rack_role']['color'] == "ffffff" + - test_two['msg'] == "rack_role Rack Role already exists" + +- name: "RACK_ROLE 3: Update" + netbox.netbox.netbox_rack_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Role + color: "003EFF" + state: present + register: test_three + +- name: "RACK_ROLE 3: ASSERT - Update" + assert: + that: + - test_three is changed + - test_three['diff']['after']['color'] == "003eff" + - test_three['rack_role']['name'] == "Rack Role" + - test_three['rack_role']['slug'] == "rack-role" + - test_three['rack_role']['color'] == "003eff" + - test_three['msg'] == "rack_role Rack Role updated" + +- name: "RACK_ROLE 4: Delete" + netbox.netbox.netbox_rack_role: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rack Role + state: absent + register: test_four + +- name: "RACK_ROLE 4: ASSERT - Update" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "rack_role Rack Role deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rear_port.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rear_port.yml new file mode 100644 index 00000000..10eb2309 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rear_port.yml @@ -0,0 +1,139 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_REAR_PORT +## +## +- name: "REAR_PORT 1: Necessary info creation" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port + device: test100 + type: bnc + state: present + register: test_one + +- name: "REAR_PORT 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rear_port']['name'] == "Rear Port" + - test_one['rear_port']['device'] == 1 + - test_one['rear_port']['type'] == "bnc" + - test_one['msg'] == "rear_port Rear Port created" + +- name: "REAR_PORT 2: Create duplicate" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port + device: test100 + type: bnc + state: present + register: test_two + +- name: "REAR_PORT 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['rear_port']['name'] == "Rear Port" + - test_two['rear_port']['device'] == 1 + - test_two['rear_port']['type'] == "bnc" + - test_two['msg'] == "rear_port Rear Port already exists" + +- name: "REAR_PORT 3: Update Rear Port with other fields" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port + device: test100 + type: bnc + positions: 5 + description: test description + state: present + register: test_three + +- name: "REAR_PORT 3: ASSERT - Update Rear Port with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['positions'] == 5 + - test_three['diff']['after']['description'] == "test description" + - test_three['rear_port']['name'] == "Rear Port" + - test_three['rear_port']['device'] == 1 + - test_three['rear_port']['type'] == "bnc" + - test_three['rear_port']['positions'] == 5 + - test_three['rear_port']['description'] == "test description" + - test_three['msg'] == "rear_port Rear Port updated" + +- name: "REAR_PORT 4: Create Rear Port for Delete Test" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port 2 + device: test100 + type: bnc + state: present + register: test_four + +- name: "REAR_PORT 4: ASSERT - Create Rear Port for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['rear_port']['name'] == "Rear Port 2" + - test_four['rear_port']['device'] == 1 + - test_four['rear_port']['type'] == "bnc" + - test_four['msg'] == "rear_port Rear Port 2 created" + +- name: "REAR_PORT 5: Delete Rear Port" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port 2 + device: test100 + type: bnc + state: absent + register: test_five + +- name: "REAR_PORT 5: ASSERT - Delete Rear Port" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "rear_port Rear Port 2 deleted" + +- name: "REAR_PORT 6: Create second Rear Port" + netbox.netbox.netbox_rear_port: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port + device: Test Nexus One + type: bnc + state: present + register: test_six + +- name: "REAR_PORT 6: ASSERT - Create second Rear Port" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "absent" + - test_six['diff']['after']['state'] == "present" + - test_six['rear_port']['name'] == "Rear Port" + - test_six['rear_port']['device'] == 4 + - test_six['rear_port']['type'] == "bnc" + - test_six['msg'] == "rear_port Rear Port created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rear_port_template.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rear_port_template.yml new file mode 100644 index 00000000..ca867619 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rear_port_template.yml @@ -0,0 +1,136 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_REAR_PORT_TEMPLATE +## +## +- name: "REAR_PORT_TEMPLATE 1: Necessary info creation" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template + device_type: Cisco Test + type: bnc + state: present + register: test_one + +- name: "REAR_PORT_TEMPLATE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rear_port_template']['name'] == "Rear Port Template" + - test_one['rear_port_template']['device_type'] == 1 + - test_one['rear_port_template']['type'] == "bnc" + - test_one['msg'] == "rear_port_template Rear Port Template created" + +- name: "REAR_PORT_TEMPLATE 2: Create duplicate" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template + device_type: Cisco Test + type: bnc + state: present + register: test_two + +- name: "REAR_PORT_TEMPLATE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['rear_port_template']['name'] == "Rear Port Template" + - test_two['rear_port_template']['device_type'] == 1 + - test_two['rear_port_template']['type'] == "bnc" + - test_two['msg'] == "rear_port_template Rear Port Template already exists" + +- name: "REAR_PORT_TEMPLATE 3: Update Rear Port Template with other fields" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template + device_type: Cisco Test + type: bnc + positions: 5 + state: present + register: test_three + +- name: "REAR_PORT_TEMPLATE 3: ASSERT - Update Rear Port Template with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['positions'] == 5 + - test_three['rear_port_template']['name'] == "Rear Port Template" + - test_three['rear_port_template']['device_type'] == 1 + - test_three['rear_port_template']['type'] == "bnc" + - test_three['rear_port_template']['positions'] == 5 + - test_three['msg'] == "rear_port_template Rear Port Template updated" + +- name: "REAR_PORT_TEMPLATE 4: Create Rear Port Template for Delete Test" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template 2 + device_type: Cisco Test + type: bnc + state: present + register: test_four + +- name: "REAR_PORT_TEMPLATE 4: ASSERT - Create Rear Port Template for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['rear_port_template']['name'] == "Rear Port Template 2" + - test_four['rear_port_template']['device_type'] == 1 + - test_four['rear_port_template']['type'] == "bnc" + - test_four['msg'] == "rear_port_template Rear Port Template 2 created" + +- name: "REAR_PORT_TEMPLATE 5: Delete Rear Port Template" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template 2 + device_type: Cisco Test + type: bnc + state: absent + register: test_five + +- name: "REAR_PORT_TEMPLATE 5: ASSERT - Delete Rear Port Template" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "rear_port_template Rear Port Template 2 deleted" + +- name: "REAR_PORT_TEMPLATE 6: Create second Rear Port Template" + netbox.netbox.netbox_rear_port_template: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Rear Port Template 2 + device_type: Arista Test + type: bnc + state: present + register: test_six + +- name: "REAR_PORT_TEMPLATE 6: ASSERT - Create second Rear Port Template" + assert: + that: + - test_six is changed + - test_six['diff']['before']['state'] == "absent" + - test_six['diff']['after']['state'] == "present" + - test_six['rear_port_template']['name'] == "Rear Port Template 2" + - test_six['rear_port_template']['device_type'] == 2 + - test_six['rear_port_template']['type'] == "bnc" + - test_six['msg'] == "rear_port_template Rear Port Template 2 created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_region.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_region.yml new file mode 100644 index 00000000..1359598a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_region.yml @@ -0,0 +1,79 @@ +--- +## +## +### NETBOX_REGION +## +## +- name: "REGION 1: Necessary info creation" + netbox.netbox.netbox_region: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Region One" + state: present + register: test_one + +- name: "REGION 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['region']['name'] == "Test Region One" + - test_one['region']['slug'] == "test-region-one" + - test_one['msg'] == "region Test Region One created" + +- name: "REGION 2: Create duplicate" + netbox.netbox.netbox_region: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Region One" + state: present + register: test_two + +- name: "REGION 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['region']['name'] == "Test Region One" + - test_two['region']['slug'] == "test-region-one" + - test_two['msg'] == "region Test Region One already exists" + +- name: "REGION 3: ASSERT - Update" + netbox.netbox.netbox_region: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Region One" + parent_region: "Test Region" + state: present + register: test_three + +- name: "REGION 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['parent'] == 1 + - test_three['region']['name'] == "Test Region One" + - test_three['region']['slug'] == "test-region-one" + - test_three['region']['parent'] == 1 + - test_three['msg'] == "region Test Region One updated" + +- name: "REGION 4: ASSERT - Delete" + netbox.netbox.netbox_region: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Region One" + state: absent + register: test_four + +- name: "REGION 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['region']['name'] == "Test Region One" + - test_four['region']['slug'] == "test-region-one" + - test_four['region']['parent'] == 1 + - test_four['msg'] == "region Test Region One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rir.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rir.yml new file mode 100644 index 00000000..cc493593 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_rir.yml @@ -0,0 +1,79 @@ +--- +## +## +### NETBOX_RIR +## +## +- name: "RIR 1: Necessary info creation" + netbox.netbox.netbox_rir: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test RIR One + state: present + register: test_one + +- name: "RIR 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['rir']['name'] == "Test RIR One" + - test_one['rir']['slug'] == "test-rir-one" + - test_one['msg'] == "rir Test RIR One created" + +- name: "RIR 2: Create duplicate" + netbox.netbox.netbox_rir: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test RIR One + state: present + register: test_two + +- name: "RIR 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['rir']['name'] == "Test RIR One" + - test_two['rir']['slug'] == "test-rir-one" + - test_two['msg'] == "rir Test RIR One already exists" + +- name: "RIR 3: ASSERT - Update" + netbox.netbox.netbox_rir: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test RIR One" + is_private: true + state: present + register: test_three + +- name: "RIR 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['is_private'] == true + - test_three['rir']['name'] == "Test RIR One" + - test_three['rir']['slug'] == "test-rir-one" + - test_three['rir']['is_private'] == true + - test_three['msg'] == "rir Test RIR One updated" + +- name: "RIR 4: ASSERT - Delete" + netbox.netbox.netbox_rir: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test RIR One" + state: absent + register: test_four + +- name: "RIR 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['rir']['name'] == "Test RIR One" + - test_four['rir']['slug'] == "test-rir-one" + - test_four['rir']['is_private'] == true + - test_four['msg'] == "rir Test RIR One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_service.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_service.yml new file mode 100644 index 00000000..8ba4e60c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_service.yml @@ -0,0 +1,193 @@ +--- +## +## +### NETBOX_SERVICE +## +## +- name: "1 - Device with required information needs to add new service" + netbox.netbox.netbox_device: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "FOR_SERVICE" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + state: present + +- name: "NETBOX_SERVICE: Create new service" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "FOR_SERVICE" + name: "node-exporter" + port: 9100 + protocol: TCP + state: present + register: test_service_create + +- name: "NETBOX_SERVICE ASSERT - Create" + assert: + that: + - test_service_create is changed + - test_service_create['services']['name'] == "node-exporter" + - test_service_create['services']['port'] == 9100 + - test_service_create['services']['protocol'] == "tcp" + - test_service_create['diff']['after']['state'] == "present" + - test_service_create['diff']['before']['state'] == "absent" + - test_service_create['msg'] == "services node-exporter created" + +- name: "NETBOX_SERVICE: Test idempotence" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "FOR_SERVICE" + name: "node-exporter" + port: 9100 + protocol: TCP + state: present + register: test_service_idempotence + +- name: "NETBOX_SERVICE ASSERT - Not changed" + assert: + that: + - test_service_idempotence['services']['name'] == "node-exporter" + - test_service_idempotence['services']['port'] == 9100 + - test_service_idempotence['services']['protocol'] == "tcp" + - test_service_idempotence['msg'] == "services node-exporter already exists" + +- name: "NETBOX_SERVICE: Test update" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "FOR_SERVICE" + name: "node-exporter" + port: 9100 + protocol: TCP + tags: + - "Schnozzberry" + state: present + register: test_service_update + +- name: "NETBOX_SERVICE ASSERT - Service has been updated" + assert: + that: + - test_service_update is changed + - test_service_update['diff']['after']['tags'][0] == 4 + - test_service_update['msg'] == "services node-exporter updated" + +- name: "NETBOX_SERVICE: Test same details, but different protocol - Create" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "FOR_SERVICE" + name: "node-exporter" + port: 9100 + protocol: UDP + state: present + register: test_service_protocol + +- name: "NETBOX_SERVICE ASSERT - Different protocol - Create" + assert: + that: + - test_service_protocol is changed + - test_service_protocol['diff']['after']['state'] == "present" + - test_service_protocol['diff']['before']['state'] == "absent" + - test_service_protocol['services']['name'] == "node-exporter" + - test_service_protocol['services']['port'] == 9100 + - test_service_protocol['services']['protocol'] == "udp" + - test_service_protocol['msg'] == "services node-exporter created" + +- name: "NETBOX_SERVICE: Test service deletion" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "FOR_SERVICE" + name: "node-exporter" + port: 9100 + protocol: UDP + state: absent + register: test_service_delete + +- name: "NETBOX_SERVICE ASSERT - Service has been deleted" + assert: + that: + - test_service_delete is changed + - test_service_delete['diff']['after']['state'] == "absent" + - test_service_delete['diff']['before']['state'] == "present" + - test_service_delete['msg'] == "services node-exporter deleted" + +- name: "NETBOX_SERVICE: Test service IP addresses" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + device: "test100" + name: "node-exporter" + port: 9100 + protocol: UDP + ipaddresses: + - address: "172.16.180.1/24" + state: present + register: test_service_ip_addresses + +- name: "NETBOX_SERVICE ASSERT - Service has been created with IP address" + assert: + that: + - test_service_ip_addresses is changed + - test_service_ip_addresses['diff']['after']['state'] == "present" + - test_service_ip_addresses['diff']['before']['state'] == "absent" + - test_service_ip_addresses['services']['name'] == "node-exporter" + - test_service_ip_addresses['services']['port'] == 9100 + - test_service_ip_addresses['services']['protocol'] == "udp" + - test_service_ip_addresses['services']['ipaddresses'] is defined + - test_service_ip_addresses['msg'] == "services node-exporter created" + +- name: "NETBOX_SERVICE: Missing both device & virtual_machine options - Tests required_one_of" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + name: "node-exporter" + port: 9100 + protocol: UDP + ipaddresses: + - address: "172.16.180.1/24" + state: present + ignore_errors: yes + register: test_service_required_one_of + +- name: "NETBOX_SERVICE ASSERT - Failed due to missing arguments" + assert: + that: + - test_service_required_one_of is failed + - 'test_service_required_one_of["msg"] == "one of the following is required: device, virtual_machine"' + +- name: "NETBOX_SERVICE: Create new service on virtual_machine" + netbox.netbox.netbox_service: + netbox_url: "http://localhost:32768" + netbox_token: "0123456789abcdef0123456789abcdef01234567" + data: + virtual_machine: "test100-vm" + name: "node-exporter" + port: 9100 + protocol: TCP + state: present + register: test_service_create_vm + +- name: "NETBOX_SERVICE ASSERT - Create" + assert: + that: + - test_service_create_vm is changed + - test_service_create_vm['services']['name'] == "node-exporter" + - test_service_create_vm['services']['port'] == 9100 + - test_service_create_vm['services']['protocol'] == "tcp" + - test_service_create_vm['diff']['after']['state'] == "present" + - test_service_create_vm['diff']['before']['state'] == "absent" + - test_service_create_vm['msg'] == "services node-exporter created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_site.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_site.yml new file mode 100644 index 00000000..dd7f9ffc --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_site.yml @@ -0,0 +1,132 @@ +--- +## +## +### NETBOX_SITE +## +## +- name: "1 - Create site within Netbox with only required information" + netbox.netbox.netbox_site: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test - Colorado + state: present + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['site']['name'] == "Test - Colorado" + - test_one['msg'] == "site Test - Colorado created" + +- name: "2 - Duplicate" + netbox.netbox.netbox_site: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test - Colorado + state: present + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['msg'] == "site Test - Colorado already exists" + - test_two['site']['name'] == "Test - Colorado" + +- name: "3 - Update Test - Colorado" + netbox.netbox.netbox_site: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test - Colorado + status: Planned + region: Test Region + contact_name: Mikhail + state: present + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['after']['status'] == "planned" + - test_three['diff']['after']['contact_name'] == "Mikhail" + - test_three['diff']['after']['region'] == 1 + - test_three['msg'] == "site Test - Colorado updated" + - test_three['site']['name'] == "Test - Colorado" + - test_three['site']['status'] == "planned" + - test_three['site']['contact_name'] == "Mikhail" + - test_three['site']['region'] == 1 + +- name: "4 - Create site with all parameters" + netbox.netbox.netbox_site: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test - California + status: Planned + region: Test Region + tenant: Test Tenant + facility: EquinoxCA7 + asn: 65001 + time_zone: America/Los Angeles + description: This is a test description + physical_address: Hollywood, CA, 90210 + shipping_address: Hollywood, CA, 90210 + latitude: 10.1 + longitude: 12.2 + contact_name: Jenny + contact_phone: 867-5309 + contact_email: jenny@changednumber.com + comments: "### Placeholder" + slug: "test_california" + state: present + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['site']['name'] == "Test - California" + - test_four['msg'] == "site Test - California created" + - test_four['site']['status'] == "planned" + - test_four['site']['region'] == 1 + - test_four['site']['tenant'] == 1 + - test_four['site']['facility'] == "EquinoxCA7" + - test_four['site']['asn'] == 65001 + - test_four['site']['time_zone'] == "America/Los_Angeles" + - test_four['site']['description'] == "This is a test description" + - test_four['site']['physical_address'] == "Hollywood, CA, 90210" + - test_four['site']['shipping_address'] == "Hollywood, CA, 90210" + - test_four['site']['latitude'] == "10.100000" + - test_four['site']['longitude'] == "12.200000" + - test_four['site']['contact_name'] == "Jenny" + - test_four['site']['contact_phone'] == "867-5309" + - test_four['site']['contact_email'] == "jenny@changednumber.com" + - test_four['site']['comments'] == "### Placeholder" + - test_four['site']['slug'] == "test_california" + +- name: "5 - Delete site within netbox" + netbox.netbox.netbox_site: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test - Colorado + state: absent + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['site']['name'] == "Test - Colorado" + - test_five['msg'] == "site Test - Colorado deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_tag.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_tag.yml new file mode 100644 index 00000000..38c4157c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_tag.yml @@ -0,0 +1,110 @@ +--- +## +## +### NETBOX_TAGS +## +## +- name: "TAG 1: ASSERT - Necessary info creation" + netbox.netbox.netbox_tag: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tag 1" + description: "Tag 1 test" + color: "0000ff" + state: present + register: test_one + +- name: "TAG 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['tags']['color'] == "0000ff" + - test_one['tags']['description'] == "Tag 1 test" + - test_one['tags']['name'] == "Test Tag 1" + - test_one['tags']['slug'] == "test-tag-1" + - test_one['msg'] == "tags Test Tag 1 created" + +- name: "TAG 2: Create duplicate" + netbox.netbox.netbox_tag: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tag 1" + description: "Tag 1 test" + color: "0000ff" + state: present + register: test_two + +- name: "TAG 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['tags']['name'] == "Test Tag 1" + - test_two['msg'] == "tags Test Tag 1 already exists" + +- name: "TAG 3: ASSERT - Update" + netbox.netbox.netbox_tag: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tag 1" + description: "Tag 1 update test" + color: "00ff00" + state: present + register: test_three + +- name: "TAG 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['color'] == "00ff00" + - test_three['diff']['after']['description'] == "Tag 1 update test" + - test_three['tags']['name'] == "Test Tag 1" + - test_three['tags']['description'] == "Tag 1 update test" + - test_three['tags']['color'] == "00ff00" + - test_three['msg'] == "tags Test Tag 1 updated" + +- name: "TAG 4: ASSERT - Delete" + netbox.netbox.netbox_tag: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tag 1" + state: absent + register: test_four + +- name: "TAG 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['diff']['after']['state'] == "absent" + - test_four['tags']['name'] == "Test Tag 1" + - test_four['tags']['slug'] == "test-tag-1" + - test_four['msg'] == "tags Test Tag 1 deleted" + +- name: "TAG 5: ASSERT - Necessary info creation" + netbox.netbox.netbox_tag: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tag 5" + slug: "test-tag-five" + description: "Tag 5 test" + color: "0000ff" + state: present + register: test_five + +- name: "TAG 5: ASSERT - Necessary info creation" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['tags']['color'] == "0000ff" + - test_five['tags']['description'] == "Tag 5 test" + - test_five['tags']['name'] == "Test Tag 5" + - test_five['tags']['slug'] == "test-tag-five" + - test_five['msg'] == "tags Test Tag 5 created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_tenant.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_tenant.yml new file mode 100644 index 00000000..7c9af8b9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_tenant.yml @@ -0,0 +1,106 @@ +--- +## +## +### NETBOX_TENANT +## +## +- name: "1 - Test tenant creation" + netbox.netbox.netbox_tenant: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Tenant ABC" + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['tenant']['name'] == "Tenant ABC" + - test_one['tenant']['slug'] == "tenant-abc" + - test_one['msg'] == "tenant Tenant ABC created" + +- name: "Test duplicate tenant" + netbox.netbox.netbox_tenant: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Tenant ABC" + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['tenant']['name'] == "Tenant ABC" + - test_two['tenant']['slug'] == "tenant-abc" + - test_two['msg'] == "tenant Tenant ABC already exists" + +- name: "3 - Test update" + netbox.netbox.netbox_tenant: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Tenant ABC" + description: "Updated description" + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['after']['description'] == "Updated description" + - test_three['tenant']['name'] == "Tenant ABC" + - test_three['tenant']['slug'] == "tenant-abc" + - test_three['tenant']['description'] == "Updated description" + - test_three['msg'] == "tenant Tenant ABC updated" + +- name: "4 - Test delete" + netbox.netbox.netbox_tenant: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Tenant ABC" + state: "absent" + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "present" + - test_four['diff']['after']['state'] == "absent" + - test_four['msg'] == "tenant Tenant ABC deleted" + +- name: "5 - Create tenant with all parameters" + netbox.netbox.netbox_tenant: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Tenant ABC" + description: "ABC Incorporated" + comments: "### This tenant is super cool" + tenant_group: "Test Tenant Group" + slug: "tenant_abc" + tags: + - "tagA" + - "tagB" + - "tagC" + state: present + register: test_five + +- name: "5 - ASSERT" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "absent" + - test_five['diff']['after']['state'] == "present" + - test_five['tenant']['name'] == "Tenant ABC" + - test_five['tenant']['slug'] == "tenant_abc" + - test_five['tenant']['description'] == "ABC Incorporated" + - test_five['tenant']['comments'] == "### This tenant is super cool" + - test_five['tenant']['group'] == 1 + - test_five['tenant']['tags'] | length == 3 + - test_five['msg'] == "tenant Tenant ABC created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_tenant_group.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_tenant_group.yml new file mode 100644 index 00000000..2ee81464 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_tenant_group.yml @@ -0,0 +1,75 @@ +--- +## +## +### NETBOX_TENANT_GROUP +## +## +- name: "1 - Test tenant group creation" + netbox.netbox.netbox_tenant_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tenant Group Two" + register: test_one + +- name: "1 - ASSERT" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['tenant_group']['name'] == "Test Tenant Group Two" + - test_one['tenant_group']['slug'] == "test-tenant-group-two" + - test_one['msg'] == "tenant_group Test Tenant Group Two created" + +- name: "Test duplicate tenant group" + netbox.netbox.netbox_tenant_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tenant Group Two" + register: test_two + +- name: "2 - ASSERT" + assert: + that: + - not test_two['changed'] + - test_two['tenant_group']['name'] == "Test Tenant Group Two" + - test_two['tenant_group']['slug'] == "test-tenant-group-two" + - test_two['msg'] == "tenant_group Test Tenant Group Two already exists" + +- name: "3 - Test delete" + netbox.netbox.netbox_tenant_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tenant Group Two" + state: "absent" + register: test_three + +- name: "3 - ASSERT" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "present" + - test_three['diff']['after']['state'] == "absent" + - test_three['msg'] == "tenant_group Test Tenant Group Two deleted" + +- name: "4 - Test another tenant group creation" + netbox.netbox.netbox_tenant_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test Tenant Group ABC" + slug: "test_tenant_group_four" + register: test_four + +- name: "4 - ASSERT" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['tenant_group']['name'] == "Test Tenant Group ABC" + - test_four['tenant_group']['slug'] == "test_tenant_group_four" + - test_four['msg'] == "tenant_group Test Tenant Group ABC created" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_virtual_chassis.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_virtual_chassis.yml new file mode 100644 index 00000000..04ada841 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_virtual_chassis.yml @@ -0,0 +1,131 @@ +--- +# © 2020 Nokia +# Licensed under the GNU General Public License v3.0 only +# SPDX-License-Identifier: GPL-3.0-only +## +## +### NETBOX_VIRTUAL_CHASSIS +## +## +- name: "VIRTUAL_CHASSIS 0: Create device for testing virtual chassis" + netbox.netbox.netbox_device: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Device Virtual Chassis Tests + device_type: Cisco Test + device_role: Core Switch + site: Test Site + vc_position: 1 + vc_priority: 1 + state: present + +- name: "VIRTUAL_CHASSIS 1: Necessary info creation" + netbox.netbox.netbox_virtual_chassis: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "First VC" + master: Device Virtual Chassis Tests + state: present + register: test_one + +- name: "VIRTUAL_CHASSIS 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['virtual_chassis']['master'] == 11 + - test_one['virtual_chassis']['name'] == "First VC" + - test_one['msg'] == "virtual_chassis First VC created" + +- name: "VIRTUAL_CHASSIS 2: Create duplicate" + netbox.netbox.netbox_virtual_chassis: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "First VC" + master: Device Virtual Chassis Tests + state: present + register: test_two + +- name: "VIRTUAL_CHASSIS 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['virtual_chassis']['master'] == 11 + - test_two['virtual_chassis']['name'] == "First VC" + - test_two['msg'] == "virtual_chassis First VC already exists" + +- name: "POWER_FEED 3: Update virtual_chassis with other fields" + netbox.netbox.netbox_virtual_chassis: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "First VC" + master: Device Virtual Chassis Tests + domain: Domain Text + state: present + register: test_three + +- name: "POWER_FEED 3: ASSERT - Update virtual_chassis with other fields" + assert: + that: + - test_three is changed + - test_three['diff']['after']['domain'] == "Domain Text" + - test_three['virtual_chassis']['master'] == 11 + - test_three['virtual_chassis']['domain'] == "Domain Text" + - test_three['virtual_chassis']['name'] == "First VC" + - test_three['msg'] == "virtual_chassis First VC updated" + +- name: "VIRTUAL_CHASSIS 4: Create device for testing virtual chassis deletion" + netbox.netbox.netbox_device: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Device Virtual Chassis Tests 2 + device_type: Cisco Test + device_role: Core Switch + site: Test Site + vc_position: 1 + vc_priority: 15 + state: present + +- name: "VIRTUAL_CHASSIS 4: Create Virtual Chassis for Delete Test" + netbox.netbox.netbox_virtual_chassis: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Second VC" + master: Device Virtual Chassis Tests 2 + state: present + register: test_four + +- name: "VIRTUAL_CHASSIS 4: ASSERT - Create Virtual Chassis for Delete Test" + assert: + that: + - test_four is changed + - test_four['diff']['before']['state'] == "absent" + - test_four['diff']['after']['state'] == "present" + - test_four['virtual_chassis']['master'] == 12 + - test_four['virtual_chassis']['name'] == "Second VC" + - test_four['msg'] == "virtual_chassis Second VC created" + +- name: "VIRTUAL_CHASSIS 5: Delete Virtual Chassis" + netbox.netbox.netbox_virtual_chassis: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Second VC" + master: Device Virtual Chassis Tests 2 + state: absent + register: test_five + +- name: "VIRTUAL_CHASSIS 5: ASSERT - Delete Virtual Chassis" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['msg'] == "virtual_chassis Second VC deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_virtual_machine.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_virtual_machine.yml new file mode 100644 index 00000000..05e88bf6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_virtual_machine.yml @@ -0,0 +1,99 @@ +--- +## +## +### NETBOX_VIRTUAL_MACHINES +## +## +- name: "VIRTUAL_MACHINE 1: Necessary info creation" + netbox.netbox.netbox_virtual_machine: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VM One" + cluster: "Test Cluster" + state: present + register: test_one + +- name: "VIRTUAL_MACHINE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['virtual_machine']['name'] == "Test VM One" + - test_one['virtual_machine']['cluster'] == 1 + - test_one['msg'] == "virtual_machine Test VM One created" + +- name: "VIRTUAL_MACHINE 2: Create duplicate" + netbox.netbox.netbox_virtual_machine: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VM One" + cluster: "Test Cluster" + state: present + register: test_two + +- name: "VIRTUAL_MACHINE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['virtual_machine']['name'] == "Test VM One" + - test_two['virtual_machine']['cluster'] == 1 + - test_two['msg'] == "virtual_machine Test VM One already exists" + +- name: "VIRTUAL_MACHINE 3: Update" + netbox.netbox.netbox_virtual_machine: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VM One" + cluster: "Test Cluster" + vcpus: 8 + memory: 8 + status: "Planned" + virtual_machine_role: "Test VM Role" + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "VIRTUAL_MACHINE 3: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['vcpus'] == 8 + - test_three['diff']['after']['memory'] == 8 + - test_three['diff']['after']['status'] == "planned" + - test_three['diff']['after']['role'] == 2 + - test_three['diff']['after']['tags'][0] == 4 + - test_three['virtual_machine']['name'] == "Test VM One" + - test_three['virtual_machine']['cluster'] == 1 + - test_three['virtual_machine']['vcpus'] == 8 + - test_three['virtual_machine']['memory'] == 8 + - test_three['virtual_machine']['status'] == "planned" + - test_three['virtual_machine']['role'] == 2 + - test_three['virtual_machine']['tags'][0] == 4 + - test_three['msg'] == "virtual_machine Test VM One updated" + +- name: "VIRTUAL_MACHINE 4: ASSERT - Delete" + netbox.netbox.netbox_virtual_machine: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VM One" + state: absent + register: test_four + +- name: "VIRTUAL_MACHINE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['virtual_machine']['name'] == "Test VM One" + - test_four['virtual_machine']['cluster'] == 1 + - test_four['virtual_machine']['vcpus'] == 8 + - test_four['virtual_machine']['memory'] == 8 + - test_four['virtual_machine']['status'] == "planned" + - test_four['virtual_machine']['role'] == 2 + - test_four['virtual_machine']['tags'][0] == 4 + - test_four['msg'] == "virtual_machine Test VM One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vlan.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vlan.yml new file mode 100644 index 00000000..d95abbec --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vlan.yml @@ -0,0 +1,193 @@ +--- +## +## +### NETBOX_VLAN +## +## +- name: "VLAN 1: Necessary info creation" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VLAN 500 + vid: 500 + state: present + register: test_one + +- name: "VLAN 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['vlan']['name'] == "Test VLAN 500" + - test_one['vlan']['vid'] == 500 + - test_one['msg'] == "vlan Test VLAN 500 created" + +- name: "VLAN 2: Create duplicate" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VLAN 500 + vid: 500 + state: present + register: test_two + +- name: "VLAN 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['vlan']['name'] == "Test VLAN 500" + - test_two['vlan']['vid'] == 500 + - test_two['msg'] == "vlan Test VLAN 500 already exists" + +- name: "VLAN 3: Create VLAN with same name, but different site" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VLAN 500 + vid: 500 + site: Test Site + tenant: Test Tenant + vlan_group: "Test VLAN Group" + state: present + register: test_three + +- name: "VLAN 3: ASSERT - Create VLAN with same name, but different site" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['vlan']['name'] == "Test VLAN 500" + - test_three['vlan']['vid'] == 500 + - test_three['vlan']['site'] == 1 + - test_three['vlan']['group'] == 1 + - test_three['msg'] == "vlan Test VLAN 500 created" + +- name: "VLAN 4: ASSERT - Update" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VLAN 500" + vid: 500 + tenant: "Test Tenant" + vlan_group: "Test VLAN Group" + status: Reserved + vlan_role: Network of care + description: Updated description + site: "Test Site" + tags: + - "Schnozzberry" + state: present + register: test_four + +- name: "VLAN 4: ASSERT - Updated" + assert: + that: + - test_four is changed + - test_four['diff']['after']['status'] == "reserved" + - test_four['diff']['after']['role'] == 1 + - test_four['diff']['after']['description'] == "Updated description" + - test_four['diff']['after']['tags'][0] == 4 + - test_four['vlan']['name'] == "Test VLAN 500" + - test_four['vlan']['tenant'] == 1 + - test_four['vlan']['site'] == 1 + - test_four['vlan']['group'] == 1 + - test_four['vlan']['status'] == "reserved" + - test_four['vlan']['role'] == 1 + - test_four['vlan']['description'] == "Updated description" + - test_four['vlan']['tags'][0] == 4 + - test_four['msg'] == "vlan Test VLAN 500 updated" + +- name: "VLAN: ASSERT - IDEMPOTENT WITH VLAN_GROUP" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VLAN 500" + vid: 500 + tenant: "Test Tenant" + vlan_group: "Test VLAN Group" + status: Reserved + vlan_role: Network of care + description: Updated description + site: "Test Site" + tags: + - "Schnozzberry" + state: present + register: idempotent_vlan_group + +- name: "VLAN: ASSERT - IDEMPOTENT WITH VLAN_GROUP" + assert: + that: + - idempotent_vlan_group is not changed + +- name: "VLAN: Create VLAN with same name, but different vlan_group" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VLAN 500 + vid: 500 + site: Test Site + tenant: Test Tenant + vlan_group: "Test VLAN Group 2" + state: present + register: new_vlan_group + +- name: "VLAN: ASSERT - Create VLAN with same name, but different vlan_group" + assert: + that: + - new_vlan_group is changed + - new_vlan_group['diff']['before']['state'] == "absent" + - new_vlan_group['diff']['after']['state'] == "present" + - new_vlan_group['vlan']['name'] == "Test VLAN 500" + - new_vlan_group['vlan']['vid'] == 500 + - new_vlan_group['vlan']['site'] == 1 + - new_vlan_group['vlan']['group'] == 2 + - new_vlan_group['msg'] == "vlan Test VLAN 500 created" + +- name: "VLAN 5: ASSERT - Delete more than one result" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VLAN 500" + state: absent + ignore_errors: yes + register: test_five + +- name: "VLAN 5: ASSERT - Delete more than one result" + assert: + that: + - test_five is failed + - test_five['msg'] == "More than one result returned for Test VLAN 500" + +- name: "VLAN 6: ASSERT - Delete" + netbox.netbox.netbox_vlan: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VLAN 500" + site: Test Site + vlan_group: "Test VLAN Group" + state: absent + register: test_six + +- name: "VLAN 6: ASSERT - Delete" + assert: + that: + - test_six is changed + - test_six['vlan']['name'] == "Test VLAN 500" + - test_six['vlan']['tenant'] == 1 + - test_six['vlan']['site'] == 1 + - test_six['vlan']['group'] == 1 + - test_six['vlan']['status'] == "reserved" + - test_six['vlan']['role'] == 1 + - test_six['vlan']['description'] == "Updated description" + - test_six['vlan']['tags'][0] == 4 + - test_six['msg'] == "vlan Test VLAN 500 deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vlan_group.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vlan_group.yml new file mode 100644 index 00000000..df59a169 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vlan_group.yml @@ -0,0 +1,118 @@ +--- +## +## +### NETBOX_VLAN_GROUP +## +## +- name: "VLAN_GROUP 1: Necessary info creation" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "VLAN Group One" + site: Test Site + state: present + register: test_one + +- name: "VLAN_GROUP 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['vlan_group']['name'] == "VLAN Group One" + - test_one['vlan_group']['slug'] == "vlan-group-one" + - test_one['vlan_group']['site'] == 1 + - test_one['msg'] == "vlan_group VLAN Group One created" + +- name: "VLAN_GROUP 2: Create duplicate" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "VLAN Group One" + site: Test Site + state: present + register: test_two + +- name: "VLAN_GROUP 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['vlan_group']['name'] == "VLAN Group One" + - test_two['vlan_group']['slug'] == "vlan-group-one" + - test_two['vlan_group']['site'] == 1 + - test_two['msg'] == "vlan_group VLAN Group One already exists" + +- name: "VLAN_GROUP 3: ASSERT - Create with same name, different site" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "VLAN Group One" + site: "Test Site2" + state: present + register: test_three + +- name: "VLAN_GROUP 3: ASSERT - Create with same name, different site" + assert: + that: + - test_three is changed + - test_three['vlan_group']['name'] == "VLAN Group One" + - test_three['vlan_group']['slug'] == "vlan-group-one" + - test_three['vlan_group']['site'] == 2 + - test_three['msg'] == "vlan_group VLAN Group One created" + +- name: "VLAN_GROUP 4: ASSERT - Create vlan group, no site" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "VLAN Group One" + state: present + ignore_errors: yes + register: test_four + +- name: "VLAN_GROUP 4: ASSERT - Create with same name, different site" + assert: + that: + - test_four is failed + - test_four['msg'] == "More than one result returned for VLAN Group One" + +- name: "VLAN_GROUP 5: ASSERT - Delete" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: VLAN Group One + site: Test Site2 + state: absent + register: test_five + +- name: "VLAN_GROUP 5: ASSERT - Delete" + assert: + that: + - test_five is changed + - test_five['diff']['before']['state'] == "present" + - test_five['diff']['after']['state'] == "absent" + - test_five['vlan_group']['name'] == "VLAN Group One" + - test_five['vlan_group']['slug'] == "vlan-group-one" + - test_five['vlan_group']['site'] == 2 + - test_five['msg'] == "vlan_group VLAN Group One deleted" + +- name: "VLAN_GROUP 6: ASSERT - Delete non existing" + netbox.netbox.netbox_vlan_group: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: VLAN Group One + site: Test Site2 + state: absent + register: test_six + +- name: "VLAN_GROUP 6: ASSERT - Delete non existing`" + assert: + that: + - not test_six['changed'] + - test_six['vlan_group'] == None + - test_six['msg'] == "vlan_group VLAN Group One already absent" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vm_interface.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vm_interface.yml new file mode 100644 index 00000000..56a60e22 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vm_interface.yml @@ -0,0 +1,159 @@ +--- +## +## +### NETBOX_VM_INTERFACE +## +## +- name: "NETBOX_VM_INTERFACE 1: Necessary info creation" + netbox.netbox.netbox_vm_interface: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + virtual_machine: "test100-vm" + name: "Eth10" + state: present + register: test_one + +- name: "NETBOX_VM_INTERFACE 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['interface']['name'] == "Eth10" + - test_one['interface']['virtual_machine'] == 1 + - test_one['msg'] == "interface Eth10 created" + +- name: "NETBOX_VM_INTERFACE 2: Create duplicate" + netbox.netbox.netbox_vm_interface: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + virtual_machine: "test100-vm" + name: "Eth10" + state: present + register: test_two + +- name: "NETBOX_VM_INTERFACE 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['interface']['name'] == "Eth10" + - test_two['interface']['virtual_machine'] == 1 + - test_two['msg'] == "interface Eth10 already exists" + +- name: "NETBOX_VM_INTERFACE 3: Updated" + netbox.netbox.netbox_vm_interface: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + virtual_machine: "test100-vm" + name: "Eth10" + enabled: false + mtu: 9000 + mac_address: "00:00:00:AA:AA:01" + description: "Updated test100-vm" + mode: Tagged + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + tags: + - "Schnozzberry" + state: present + register: test_three + +- name: "NETBOX_VM_INTERFACE 4: ASSERT - Updated" + assert: + that: + - test_three is changed + - test_three['diff']['after']['enabled'] == false + - test_three['diff']['after']['mtu'] == 9000 + - test_three['diff']['after']['mac_address'] == "00:00:00:AA:AA:01" + - test_three['diff']['after']['description'] == "Updated test100-vm" + - test_three['diff']['after']['mode'] == "tagged" + - test_three['diff']['after']['untagged_vlan'] == 1 + - test_three['diff']['after']['tagged_vlans'] == [2, 3] + - test_three['diff']['after']['tags'][0] == 4 + - test_three['interface']['name'] == "Eth10" + - test_three['interface']['virtual_machine'] == 1 + - test_three['interface']['enabled'] == false + - test_three['interface']['mtu'] == 9000 + - test_three['interface']['mac_address'] == "00:00:00:AA:AA:01" + - test_three['interface']['description'] == "Updated test100-vm" + - test_three['interface']['mode'] == "tagged" + - test_three['interface']['untagged_vlan'] == 1 + - test_three['interface']['tagged_vlans'] == [2, 3] + - test_three['interface']['tags'][0] == 4 + - test_three['msg'] == "interface Eth10 updated" + +- name: "NETBOX_VM_INTERFACE 4: ASSERT - Delete" + netbox.netbox.netbox_vm_interface: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Eth10" + virtual_machine: "test100-vm" + state: absent + register: test_four + +- name: "NETBOX_VM_INTERFACE 4: ASSERT - Delete" + assert: + that: + - test_four is changed + - test_four['interface']['name'] == "Eth10" + - test_four['interface']['virtual_machine'] == 1 + - test_four['msg'] == "interface Eth10 deleted" + +- name: "NETBOX_VM_INTERFACE 5: Attempt to update interface with same name on other VMs" + netbox.netbox.netbox_vm_interface: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + virtual_machine: "test100-vm" + name: "Eth0" + enabled: false + mtu: 9000 + mac_address: "00:00:00:AA:AA:01" + description: "Updated test100-vm Eth0 intf" + mode: Tagged + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP + site: Test Site + tags: + - "Schnozzberry" + state: present + register: test_five + +- name: "NETBOX_VM_INTERFACE 5: ASSERT - Updated" + assert: + that: + - test_five is changed + - test_five['diff']['after']['enabled'] == false + - test_five['diff']['after']['mtu'] == 9000 + - test_five['diff']['after']['mac_address'] == "00:00:00:AA:AA:01" + - test_five['diff']['after']['description'] == "Updated test100-vm Eth0 intf" + - test_five['diff']['after']['mode'] == "tagged" + - test_five['diff']['after']['untagged_vlan'] == 1 + - test_five['diff']['after']['tagged_vlans'] == [2, 3] + - test_five['diff']['after']['tags'][0] == 4 + - test_five['interface']['name'] == "Eth0" + - test_five['interface']['virtual_machine'] == 1 + - test_five['interface']['enabled'] == false + - test_five['interface']['mtu'] == 9000 + - test_five['interface']['mac_address'] == "00:00:00:AA:AA:01" + - test_five['interface']['description'] == "Updated test100-vm Eth0 intf" + - test_five['interface']['mode'] == "tagged" + - test_five['interface']['untagged_vlan'] == 1 + - test_five['interface']['tagged_vlans'] == [2, 3] + - test_five['interface']['tags'][0] == 4 + - test_five['msg'] == "interface Eth0 updated" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vrf.yml b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vrf.yml new file mode 100644 index 00000000..093e4446 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/integration/targets/v2.9/tasks/netbox_vrf.yml @@ -0,0 +1,128 @@ +--- +## +## +### NETBOX_VRF +## +## +- name: "VRF 1: Necessary info creation" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VRF One + state: present + register: test_one + +- name: "VRF 1: ASSERT - Necessary info creation" + assert: + that: + - test_one is changed + - test_one['diff']['before']['state'] == "absent" + - test_one['diff']['after']['state'] == "present" + - test_one['vrf']['name'] == "Test VRF One" + - test_one['msg'] == "vrf Test VRF One created" + +- name: "VRF 2: Create duplicate" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VRF One + state: present + register: test_two + +- name: "VRF 2: ASSERT - Create duplicate" + assert: + that: + - not test_two['changed'] + - test_two['vrf']['name'] == "Test VRF One" + - test_two['msg'] == "vrf Test VRF One already exists" + +- name: "VRF 3: Create VRF with same name, but different tenant" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: Test VRF One + tenant: Test Tenant + state: present + register: test_three + +- name: "VRF 3: ASSERT - Create VRF with same name, but different site" + assert: + that: + - test_three is changed + - test_three['diff']['before']['state'] == "absent" + - test_three['diff']['after']['state'] == "present" + - test_three['vrf']['name'] == "Test VRF One" + - test_three['vrf']['tenant'] == 1 + - test_three['msg'] == "vrf Test VRF One created" + +- name: "VRF 4: ASSERT - Update" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VRF One" + rd: "65001:1" + enforce_unique: False + tenant: "Test Tenant" + description: Updated description + tags: + - "Schnozzberry" + state: present + register: test_four + +- name: "VRF 4: ASSERT - Updated" + assert: + that: + - test_four is changed + - test_four['diff']['after']['rd'] == "65001:1" + - test_four['diff']['after']['enforce_unique'] == false + - test_four['diff']['after']['description'] == "Updated description" + - test_four['diff']['after']['tags'][0] == 4 + - test_four['vrf']['name'] == "Test VRF One" + - test_four['vrf']['tenant'] == 1 + - test_four['vrf']['rd'] == "65001:1" + - test_four['vrf']['enforce_unique'] == false + - test_four['vrf']['description'] == "Updated description" + - test_four['vrf']['tags'][0] == 4 + - test_four['msg'] == "vrf Test VRF One updated" + +- name: "VRF 5: ASSERT - Delete more than one result" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VRF One" + state: absent + ignore_errors: yes + register: test_five + +- name: "VRF 5: ASSERT - Delete more than one result" + assert: + that: + - test_five is failed + - test_five['msg'] == "More than one result returned for Test VRF One" + +- name: "VRF 6: ASSERT - Delete" + netbox.netbox.netbox_vrf: + netbox_url: http://localhost:32768 + netbox_token: 0123456789abcdef0123456789abcdef01234567 + data: + name: "Test VRF One" + tenant: Test Tenant + state: absent + register: test_six + +- name: "VRF 6: ASSERT - Delete" + assert: + that: + - test_six is changed + - test_six['vrf']['name'] == "Test VRF One" + - test_six['vrf']['tenant'] == 1 + - test_six['vrf']['rd'] == "65001:1" + - test_six['vrf']['enforce_unique'] == false + - test_six['vrf']['description'] == "Updated description" + - test_six['vrf']['tags'][0] == 4 + - test_six['msg'] == "vrf Test VRF One deleted" diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/sanity/ignore-2.10.txt b/collections-debian-merged/ansible_collections/netbox/netbox/tests/sanity/ignore-2.10.txt new file mode 100644 index 00000000..9dbeb775 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/sanity/ignore-2.10.txt @@ -0,0 +1,87 @@ +plugins/modules/netbox_interface.py import-3.8!skip # Module is deprecated, so will not be updated for 2.10 compatibility +plugins/modules/netbox_interface.py validate-modules!skip +plugins/modules/netbox_interface.py ansible-doc!skip +plugins/modules/netbox_interface.py import-3.6!skip +plugins/modules/netbox_interface.py import-3.7!skip +plugins/modules/netbox_aggregate.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_aggregate.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_cable.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_circuit.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_circuit.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_circuit_termination.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_circuit_type.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_cluster.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_cluster.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_cluster_group.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_cluster_type.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_console_port.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_console_port.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_console_port_template.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_console_server_port.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_console_server_port.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_device.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_device.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_console_server_port_template.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_device_bay.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_device_bay.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_device_bay_template.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_device_interface.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_device_interface.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_device_interface_template.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_device_role.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_device_type.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_device_type.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_front_port.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_front_port.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_front_port_template.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_inventory_item.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_inventory_item.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_ip_address.py validate-modules:mutually_exclusive-unknown +plugins/modules/netbox_ip_address.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_ip_address.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_ipam_role.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_manufacturer.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_platform.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_power_feed.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_power_feed.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_power_outlet.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_power_outlet.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_power_outlet_template.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_power_panel.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_power_port.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_power_port.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_power_port_template.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_prefix.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_prefix.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_provider.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_provider.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_rack.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_rack.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_rack_group.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_rack_role.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_rear_port.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_rear_port.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_rear_port_template.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_region.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_rir.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_service.py validate-modules:mutually_exclusive-unknown +plugins/modules/netbox_service.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_service.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_service.py validate-modules:required_one_of-unknown +plugins/modules/netbox_site.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_site.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_tag.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_tenant.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_tenant.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_tenant_group.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_virtual_chassis.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_virtual_chassis.py validate-modules:required_one_of-unknown +plugins/modules/netbox_virtual_machine.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_virtual_machine.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_vlan.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_vlan.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_vlan_group.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_vm_interface.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_vm_interface.py validate-modules:parameter-list-no-elements +plugins/modules/netbox_vrf.py validate-modules:required_if-requirements-unknown +plugins/modules/netbox_vrf.py validate-modules:parameter-list-no-elements diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/test_data.py b/collections-debian-merged/ansible_collections/netbox/netbox/tests/test_data.py new file mode 100644 index 00000000..95e6dd34 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/test_data.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Bruno Inec (@sweenu) <bruno@inec.fr> +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import json + +# Load test data from a json file, for a pytest parametrize +def load_test_data(path, test_path): + with open(f"{path}/test_data/{test_path}/data.json", "r") as f: + data = json.loads(f.read()) + tests = [] + for test in data: + tuple_data = tuple(test.values()) + tests.append(tuple_data) + return tests diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/__init__.py b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/__init__.py diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/filter_query_parameters/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/filter_query_parameters/data.json new file mode 100644 index 00000000..a9c224ba --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/filter_query_parameters/data.json @@ -0,0 +1,35 @@ +[ + { + "parameters": [ + {"name": "value1"}, + {"platform": "value2"} + ], + "expected": [ + {"name": "value1"}, + {"platform": "value2"} + ] + }, + { + "parameters": [ + {"z": "value1"}, + {"platform": "value2"} + ], + "expected": [ + {"platform": "value2"} + ] + }, + { + "parameters": [ + {"x": "value1"}, + {"y": "value2"} + ], + "expected": [ + ] + }, + { + "parameters": { + }, + "expected": [ + ] + } +] diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/get_resource_list_chunked/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/get_resource_list_chunked/data.json new file mode 100644 index 00000000..f6d1233a --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/get_resource_list_chunked/data.json @@ -0,0 +1,73 @@ +[ + { + "api_url": "https://netbox:1234?limit=0", + "max_uri_length": 35, + "query_key": "key", + "query_values": [ + 1, + 2, + 3, + 4 + ], + "expected": [ + "https://netbox:1234?limit=0&key=1", + "https://netbox:1234?limit=0&key=2", + "https://netbox:1234?limit=0&key=3", + "https://netbox:1234?limit=0&key=4" + ] + }, + { + "api_url": "https://netbox:1234?limit=0", + "max_uri_length": -5, + "query_key": "key", + "query_values": [ + 1, + 2, + 3, + 4 + ], + "expected": [ + "https://netbox:1234?limit=0&key=1", + "https://netbox:1234?limit=0&key=2", + "https://netbox:1234?limit=0&key=3", + "https://netbox:1234?limit=0&key=4" + ] + }, + { + "api_url": "https://netbox:1234?limit=0", + "max_uri_length": 50, + "query_key": "key", + "query_values": [ + 1, + 2, + 3000, + 4 + ], + "expected": [ + "https://netbox:1234?limit=0&key=1&key=2", + "https://netbox:1234?limit=0&key=3000&key=4" + ] + }, + { + "api_url": "https://netbox:1234", + "max_uri_length": 42, + "query_key": "key", + "query_values": [ + 1, + 2, + 3, + 4 + ], + "expected": [ + "https://netbox:1234?key=1&key=2&key=3", + "https://netbox:1234?key=4" + ] + }, + { + "api_url": "https://netbox:1234?limit=0", + "max_uri_length": 4000, + "query_key": "key", + "query_values": [], + "expected": [] + } +]
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/group_extractors/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/group_extractors/data.json new file mode 100644 index 00000000..7ba22099 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/group_extractors/data.json @@ -0,0 +1,80 @@ +[ + { + "plurals": false, + "interfaces": false, + "services": false, + "dns_name": false, + "expected": [ + "disk", + "memory", + "vcpus", + "config_context", + "custom_fields", + "region", + "cluster", + "cluster_group", + "cluster_type", + "is_virtual", + "site", + "tenant", + "rack", + "tag", + "role", + "platform", + "device_type", + "manufacturer" + ], + "not_expected": [ + "sites", + "tenants", + "racks", + "tags", + "device_roles", + "platforms", + "device_types", + "manufacturers", + "services", + "interfaces", + "dns_name" + ] + }, + { + "plurals": true, + "interfaces": true, + "services": true, + "dns_name": true, + "expected": [ + "disk", + "memory", + "vcpus", + "config_context", + "custom_fields", + "region", + "cluster", + "cluster_group", + "cluster_type", + "is_virtual", + "sites", + "tenants", + "racks", + "tags", + "device_roles", + "platforms", + "device_types", + "manufacturers", + "services", + "interfaces", + "dns_name" + ], + "not_expected": [ + "site", + "tenant", + "rack", + "tag", + "role", + "platform", + "device_type", + "manufacturer" + ] + } +]
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/refresh_url/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/refresh_url/data.json new file mode 100644 index 00000000..542e048e --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/refresh_url/data.json @@ -0,0 +1,186 @@ +[ + { + "options": { + "query_filters": [], + "device_query_filters": {}, + "vm_query_filters": {}, + "config_context": true + }, + "expected": [ + "https://netbox.test.endpoint:1234/api/dcim/devices/?limit=0", + "https://netbox.test.endpoint:1234/api/virtualization/virtual-machines/?limit=0" + ] + }, + { + "options": { + "query_filters": 12345, + "device_query_filters": 6543, + "vm_query_filters": null, + "config_context": true + }, + "expected": [ + "https://netbox.test.endpoint:1234/api/dcim/devices/?limit=0", + "https://netbox.test.endpoint:1234/api/virtualization/virtual-machines/?limit=0" + ] + }, + { + "options": { + "query_filters": [], + "device_query_filters": {}, + "vm_query_filters": {}, + "config_context": false + }, + "expected": [ + "https://netbox.test.endpoint:1234/api/dcim/devices/?limit=0&exclude=config_context", + "https://netbox.test.endpoint:1234/api/virtualization/virtual-machines/?limit=0&exclude=config_context" + ] + }, + { + "options": { + "query_filters": [ + { + "name": "name value" + }, + { + "region": "region value" + } + ], + "device_query_filters": {}, + "vm_query_filters": {}, + "config_context": true + }, + "expected": [ + "https://netbox.test.endpoint:1234/api/dcim/devices/?limit=0&name=name+value®ion=region+value", + "https://netbox.test.endpoint:1234/api/virtualization/virtual-machines/?limit=0&name=name+value®ion=region+value" + ] + }, + { + "options": { + "query_filters": [ + { + "name": "name value" + } + ], + "device_query_filters": [ + { + "region": "device" + } + ], + "vm_query_filters": [ + { + "region": "vm" + } + ], + "config_context": true + }, + "expected": [ + "https://netbox.test.endpoint:1234/api/dcim/devices/?limit=0&name=name+value®ion=device", + "https://netbox.test.endpoint:1234/api/virtualization/virtual-machines/?limit=0&name=name+value®ion=vm" + ] + }, + { + "options": { + "query_filters": [ + { + "name": "name value" + }, + { + "invalid query filter": "nope" + } + ], + "device_query_filters": [ + { + "has_primary_ip": "true" + }, + { + "invalid device filter": "nope" + } + ], + "vm_query_filters": [ + { + "disk": 42 + }, + { + "invalid vm filter": "nope" + } + ], + "config_context": true + }, + "expected": [ + "https://netbox.test.endpoint:1234/api/dcim/devices/?limit=0&name=name+value&has_primary_ip=true", + "https://netbox.test.endpoint:1234/api/virtualization/virtual-machines/?limit=0&name=name+value&disk=42" + ] + }, + { + "options": { + "query_filters": [ + { + "disk": "3" + } + ], + "device_query_filters": [], + "vm_query_filters": [], + "config_context": true + }, + "expected": [ + null, + "https://netbox.test.endpoint:1234/api/virtualization/virtual-machines/?limit=0&disk=3" + ] + }, + { + "options": { + "query_filters": [ + { + "has_primary_ip": "true" + } + ], + "device_query_filters": [], + "vm_query_filters": [], + "config_context": true + }, + "expected": [ + "https://netbox.test.endpoint:1234/api/dcim/devices/?limit=0&has_primary_ip=true", + null + ] + }, + { + "options": { + "query_filters": [ + { + "disk": "3" + } + ], + "device_query_filters": [ + { + "name": "name value" + } + ], + "vm_query_filters": [], + "config_context": true + }, + "expected": [ + "https://netbox.test.endpoint:1234/api/dcim/devices/?limit=0&name=name+value", + "https://netbox.test.endpoint:1234/api/virtualization/virtual-machines/?limit=0&disk=3" + ] + }, + { + "options": { + "query_filters": [ + { + "has_primary_ip": "true" + } + ], + "device_query_filters": [], + "vm_query_filters": [ + { + "name": "name value" + } + ], + "config_context": true + }, + "expected": [ + "https://netbox.test.endpoint:1234/api/dcim/devices/?limit=0&has_primary_ip=true", + "https://netbox.test.endpoint:1234/api/virtualization/virtual-machines/?limit=0&name=name+value" + ] + } +]
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/validate_query_parameter/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/validate_query_parameter/data.json new file mode 100644 index 00000000..a7fca74c --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_data/validate_query_parameter/data.json @@ -0,0 +1,26 @@ +[ + { + "parameter": "name", + "expected": true + }, + { + "parameter": "platform", + "expected": true + }, + { + "parameter": "region", + "expected": true + }, + { + "parameter": "x", + "expected": false + }, + { + "parameter": "y", + "expected": false + }, + { + "parameter": "z", + "expected": false + } +] diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_nb_inventory.py b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_nb_inventory.py new file mode 100644 index 00000000..ab94e463 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/inventory/test_nb_inventory.py @@ -0,0 +1,183 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Hillsong, Douglas Heriot (@DouglasHeriot) <douglas.heriot@hillsong.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import pytest +import os +from functools import partial +from unittest.mock import patch, MagicMock, Mock, call + +try: + from ansible_collections.netbox.netbox.plugins.inventory.nb_inventory import ( + InventoryModule, + ) + from ansible_collections.netbox.netbox.tests.test_data import load_test_data + +except ImportError: + import sys + + # Not installed as a collection + # Try importing relative to root directory of this ansible_modules project + + sys.path.append("plugins/inventory") + sys.path.append("tests") + from test_data import load_test_data + +load_relative_test_data = partial( + load_test_data, os.path.dirname(os.path.abspath(__file__)) +) + + +@pytest.fixture +def inventory_fixture( + allowed_device_query_parameters_fixture, allowed_vm_query_parameters_fixture +): + inventory = InventoryModule() + inventory.api_endpoint = "https://netbox.test.endpoint:1234" + + # Fill in data that is fetched dynamically + inventory.api_version = None + inventory.allowed_device_query_parameters = allowed_device_query_parameters_fixture + inventory.allowed_vm_query_parameters = allowed_vm_query_parameters_fixture + + return inventory + + +@pytest.fixture +def allowed_device_query_parameters_fixture(): + # Subset of parameters - real list is fetched dynamically from NetBox openapi endpoint + return [ + "id", + "interfaces", + "has_primary_ip", + "mac_address", + "name", + "platform", + "rack_id", + "region", + "role", + "tag", + ] + + +@pytest.fixture +def allowed_vm_query_parameters_fixture(): + # Subset of parameters - real list is fetched dynamically from NetBox openapi endpoint + return [ + "id", + "interfaces", + "disk", + "mac_address", + "name", + "platform", + "region", + "role", + "tag", + ] + + +@pytest.mark.parametrize( + "parameter, expected", load_relative_test_data("validate_query_parameter") +) +def test_validate_query_parameter(inventory_fixture, parameter, expected): + + value = "some value, doesn't matter" + result = inventory_fixture.validate_query_parameter( + {parameter: value}, inventory_fixture.allowed_device_query_parameters + ) + assert (result == (parameter, value)) == expected + + +@pytest.mark.parametrize( + "parameters, expected", load_relative_test_data("filter_query_parameters") +) +def test_filter_query_parameters(inventory_fixture, parameters, expected): + + result = inventory_fixture.filter_query_parameters( + parameters, inventory_fixture.allowed_device_query_parameters + ) + + # Result is iterators of tuples + # expected from json file is an array of dicts + + # Convert result iterator to list so we can get the length, and iterate over with an index + result_list = list(result) + + assert len(result_list) == len(expected) + + for i, parameter in enumerate(result_list): + assert parameter[0] == list(expected[i].keys())[0] + assert parameter[1] == list(expected[i].values())[0] + + +@pytest.mark.parametrize("options, expected", load_relative_test_data("refresh_url")) +def test_refresh_url(inventory_fixture, options, expected): + + inventory_fixture.query_filters = options["query_filters"] + inventory_fixture.device_query_filters = options["device_query_filters"] + inventory_fixture.vm_query_filters = options["vm_query_filters"] + inventory_fixture.config_context = options["config_context"] + + result = inventory_fixture.refresh_url() + + assert result == tuple(expected) + + +def test_refresh_lookups(inventory_fixture): + def raises_exception(): + raise Exception("Error from within a thread") + + def does_not_raise(): + pass + + with pytest.raises(Exception) as e: + inventory_fixture.refresh_lookups([does_not_raise, raises_exception]) + assert "Error from within a thread" in str(e) + + inventory_fixture.refresh_lookups([does_not_raise, does_not_raise]) + + +@pytest.mark.parametrize( + "plurals, services, interfaces, dns_name, expected, not_expected", + load_relative_test_data("group_extractors"), +) +def test_group_extractors( + inventory_fixture, plurals, services, interfaces, dns_name, expected, not_expected +): + inventory_fixture.plurals = plurals + inventory_fixture.services = services + inventory_fixture.interfaces = interfaces + inventory_fixture.dns_name = dns_name + extractors = inventory_fixture.group_extractors + + for key in expected: + assert key in extractors + + for key in not_expected: + assert key not in expected + + +@pytest.mark.parametrize( + "api_url, max_uri_length, query_key, query_values, expected", + load_relative_test_data("get_resource_list_chunked"), +) +def test_get_resource_list_chunked( + inventory_fixture, api_url, max_uri_length, query_key, query_values, expected +): + mock_get_resource_list = Mock() + mock_get_resource_list.return_value = ["resource"] + + inventory_fixture.get_resource_list = mock_get_resource_list + inventory_fixture.max_uri_length = max_uri_length + + resources = inventory_fixture.get_resource_list_chunked( + api_url, query_key, query_values + ) + + mock_get_resource_list.assert_has_calls(map(call, expected)) + assert mock_get_resource_list.call_count == len(expected) + assert resources == mock_get_resource_list.return_value * len(expected) diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/__init__.py b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/__init__.py diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/circuits.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/circuits.json new file mode 100644 index 00000000..e7f112b7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/circuits.json @@ -0,0 +1,28 @@ +{ + "status": [ + { + "value": "planned", + "display_name": "Planned" + }, + { + "value": "provisioning", + "display_name": "Provisioning" + }, + { + "value": "active", + "display_name": "Active" + }, + { + "value": "offline", + "display_name": "Offline" + }, + { + "value": "deprovisioning", + "display_name": "Deprovisioning" + }, + { + "value": "decommissioned", + "display_name": "Decommissioned" + } + ] +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/device_types.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/device_types.json new file mode 100644 index 00000000..e82964ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/device_types.json @@ -0,0 +1,12 @@ +{ + "subdevice_role": [ + { + "value": "parent", + "display_name": "Parent" + }, + { + "value": "child", + "display_name": "Child" + } + ] +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/devices.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/devices.json new file mode 100644 index 00000000..5bf1f2f3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/devices.json @@ -0,0 +1,42 @@ +{ + "face": [ + { + "value": "front", + "display_name": "Front" + }, + { + "value": "rear", + "display_name": "Rear" + } + ], + "status": [ + { + "value": "offline", + "display_name": "Offline" + }, + { + "value": "active", + "display_name": "Active" + }, + { + "value": "planned", + "display_name": "Planned" + }, + { + "value": "staged", + "display_name": "Staged" + }, + { + "value": "failed", + "display_name": "Failed" + }, + { + "value": "inventory", + "display_name": "Inventory" + }, + { + "value": "decommissioning", + "display_name": "Decommissioning" + } + ] +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/interfaces.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/interfaces.json new file mode 100644 index 00000000..2bda690f --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/interfaces.json @@ -0,0 +1,306 @@ +{ + "type": [ + { + "value": "virtual", + "display_name": "Virtual" + }, + { + "value": "lag", + "display_name": "Link Aggregation Group (LAG)" + }, + { + "value": "100base-tx", + "display_name": "100BASE-TX (10/100ME)" + }, + { + "value": "1000base-t", + "display_name": "1000BASE-T (1GE)" + }, + { + "value": "2.5gbase-t", + "display_name": "2.5GBASE-T (2.5GE)" + }, + { + "value": "5gbase-t", + "display_name": "5GBASE-T (5GE)" + }, + { + "value": "10gbase-t", + "display_name": "10GBASE-T (10GE)" + }, + { + "value": "10gbase-cx4", + "display_name": "10GBASE-CX4 (10GE)" + }, + { + "value": "1000base-x-gbic", + "display_name": "GBIC (1GE)" + }, + { + "value": "1000base-x-sfp", + "display_name": "SFP (1GE)" + }, + { + "value": "10gbase-x-sfpp", + "display_name": "SFP+ (10GE)" + }, + { + "value": "10gbase-x-xfp", + "display_name": "XFP (10GE)" + }, + { + "value": "10gbase-x-xenpak", + "display_name": "XENPAK (10GE)" + }, + { + "value": "10gbase-x-x2", + "display_name": "X2 (10GE)" + }, + { + "value": "25gbase-x-sfp28", + "display_name": "SFP28 (25GE)" + }, + { + "value": "40gbase-x-qsfpp", + "display_name": "QSFP+ (40GE)" + }, + { + "value": "50gbase-x-sfp28", + "display_name": "QSFP28 (50GE)" + }, + { + "value": "100gbase-x-cfp", + "display_name": "CFP (100GE)" + }, + { + "value": "100gbase-x-cfp2", + "display_name": "CFP2 (100GE)" + }, + { + "value": "200gbase-x-cfp2", + "display_name": "CFP2 (200GE)" + }, + { + "value": "100gbase-x-cfp4", + "display_name": "CFP4 (100GE)" + }, + { + "value": "100gbase-x-cpak", + "display_name": "Cisco CPAK (100GE)" + }, + { + "value": "100gbase-x-qsfp28", + "display_name": "QSFP28 (100GE)" + }, + { + "value": "200gbase-x-qsfp56", + "display_name": "QSFP56 (200GE)" + }, + { + "value": "400gbase-x-qsfpdd", + "display_name": "QSFP-DD (400GE)" + }, + { + "value": "400gbase-x-osfp", + "display_name": "OSFP (400GE)" + }, + { + "value": "ieee802.11a", + "display_name": "IEEE 802.11a" + }, + { + "value": "ieee802.11g", + "display_name": "IEEE 802.11b/g" + }, + { + "value": "ieee802.11n", + "display_name": "IEEE 802.11n" + }, + { + "value": "ieee802.11ac", + "display_name": "IEEE 802.11ac" + }, + { + "value": "ieee802.11ad", + "display_name": "IEEE 802.11ad" + }, + { + "value": "ieee802.11ax", + "display_name": "IEEE 802.11ax" + }, + { + "value": "gsm", + "display_name": "GSM" + }, + { + "value": "cdma", + "display_name": "CDMA" + }, + { + "value": "lte", + "display_name": "LTE" + }, + { + "value": "sonet-oc3", + "display_name": "OC-3/STM-1" + }, + { + "value": "sonet-oc12", + "display_name": "OC-12/STM-4" + }, + { + "value": "sonet-oc48", + "display_name": "OC-48/STM-16" + }, + { + "value": "sonet-oc192", + "display_name": "OC-192/STM-64" + }, + { + "value": "sonet-oc768", + "display_name": "OC-768/STM-256" + }, + { + "value": "sonet-oc1920", + "display_name": "OC-1920/STM-640" + }, + { + "value": "sonet-oc3840", + "display_name": "OC-3840/STM-1234" + }, + { + "value": "1gfc-sfp", + "display_name": "SFP (1GFC)" + }, + { + "value": "2gfc-sfp", + "display_name": "SFP (2GFC)" + }, + { + "value": "4gfc-sfp", + "display_name": "SFP (4GFC)" + }, + { + "value": "8gfc-sfpp", + "display_name": "SFP+ (8GFC)" + }, + { + "value": "16gfc-sfpp", + "display_name": "SFP+ (16GFC)" + }, + { + "value": "32gfc-sfp28", + "display_name": "SFP28 (32GFC)" + }, + { + "value": "128gfc-sfp28", + "display_name": "QSFP28 (128GFC)" + }, + { + "value": "inifiband-sdr", + "display_name": "SDR (2 Gbps)" + }, + { + "value": "inifiband-ddr", + "display_name": "DDR (4 Gbps)" + }, + { + "value": "inifiband-qdr", + "display_name": "QDR (8 Gbps)" + }, + { + "value": "inifiband-fdr10", + "display_name": "FDR10 (10 Gbps)" + }, + { + "value": "inifiband-fdr", + "display_name": "FDR (13.5 Gbps)" + }, + { + "value": "inifiband-edr", + "display_name": "EDR (25 Gbps)" + }, + { + "value": "inifiband-hdr", + "display_name": "HDR (50 Gbps)" + }, + { + "value": "inifiband-ndr", + "display_name": "NDR (100 Gbps)" + }, + { + "value": "inifiband-xdr", + "display_name": "XDR (250 Gbps)" + }, + { + "value": "t1", + "display_name": "T1 (1.544 Mbps)" + }, + { + "value": "e1", + "display_name": "E1 (2.048 Mbps)" + }, + { + "value": "t3", + "display_name": "T3 (45 Mbps)" + }, + { + "value": "e3", + "display_name": "E3 (34 Mbps)" + }, + { + "value": "cisco-stackwise", + "display_name": "Cisco StackWise" + }, + { + "value": "cisco-stackwise-plus", + "display_name": "Cisco StackWise Plus" + }, + { + "value": "cisco-flexstack", + "display_name": "Cisco FlexStack" + }, + { + "value": "cisco-flexstack-plus", + "display_name": "Cisco FlexStack Plus" + }, + { + "value": "juniper-vcp", + "display_name": "Juniper VCP" + }, + { + "value": "extreme-summitstack", + "display_name": "Extreme SummitStack" + }, + { + "value": "extreme-summitstack-128", + "display_name": "Extreme SummitStack-128" + }, + { + "value": "extreme-summitstack-256", + "display_name": "Extreme SummitStack-256" + }, + { + "value": "extreme-summitstack-512", + "display_name": "Extreme SummitStack-512" + }, + { + "value": "other", + "display_name": "Other" + } + ], + "mode": [ + { + "value": "access", + "display_name": "Access" + }, + { + "value": "tagged", + "display_name": "Tagged" + }, + { + "value": "tagged-all", + "display_name": "Tagged (All)" + } + ] +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/prefixes.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/prefixes.json new file mode 100644 index 00000000..135ce2bb --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/prefixes.json @@ -0,0 +1,20 @@ +{ + "status": [ + { + "value": "container", + "display_name": "Container" + }, + { + "value": "active", + "display_name": "Active" + }, + { + "value": "reserved", + "display_name": "Reserved" + }, + { + "value": "deprecated", + "display_name": "Deprecated" + } + ] +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/racks.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/racks.json new file mode 100644 index 00000000..3068db3d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/racks.json @@ -0,0 +1,66 @@ +{ + "status": [ + { + "value": "reserved", + "display_name": "Reserved" + }, + { + "value": "available", + "display_name": "Available" + }, + { + "value": "planned", + "display_name": "Planned" + }, + { + "value": "active", + "display_name": "Active" + }, + { + "value": "deprecated", + "display_name": "Deprecated" + } + ], + "type": [ + { + "value": "2-post-frame", + "display_name": "2-post frame" + }, + { + "value": "4-post-frame", + "display_name": "4-post frame" + }, + { + "value": "4-post-cabinet", + "display_name": "4-post cabinet" + }, + { + "value": "wall-frame", + "display_name": "Wall-mounted frame" + }, + { + "value": "wall-cabinet", + "display_name": "Wall-mounted cabinet" + } + ], + "width": [ + { + "value": 19, + "display_name": "19 inches" + }, + { + "value": 23, + "display_name": "23 inches" + } + ], + "outer_unit": [ + { + "value": "mm", + "display_name": "Millimeters" + }, + { + "value": "in", + "display_name": "Inches" + } + ] +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/services.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/services.json new file mode 100644 index 00000000..e14147a5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/services.json @@ -0,0 +1,12 @@ +{ + "protocol": [ + { + "value": "tcp", + "display_name": "TCP" + }, + { + "value": "udp", + "display_name": "UDP" + } + ] +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/sites.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/sites.json new file mode 100644 index 00000000..63628937 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/sites.json @@ -0,0 +1,16 @@ +{ + "status": [ + { + "value": "active", + "display_name": "Active" + }, + { + "value": "planned", + "display_name": "Planned" + }, + { + "value": "retired", + "display_name": "Retired" + } + ] +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/virtual_machines.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/virtual_machines.json new file mode 100644 index 00000000..d4e781e8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/virtual_machines.json @@ -0,0 +1,16 @@ +{ + "status": [ + { + "value": "active", + "display_name": "Active" + }, + { + "value": "offline", + "display_name": "Offline" + }, + { + "value": "staged", + "display_name": "Staged" + } + ] +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/vlans.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/vlans.json new file mode 100644 index 00000000..1f0e6765 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/fixtures/choices/vlans.json @@ -0,0 +1,16 @@ +{ + "status": [ + { + "value": "active", + "display_name": "Active" + }, + { + "value": "reserved", + "display_name": "Reserved" + }, + { + "value": "deprecated", + "display_name": "Deprecated" + } + ] +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/arg_spec_default/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/arg_spec_default/data.json new file mode 100644 index 00000000..58f80c19 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/arg_spec_default/data.json @@ -0,0 +1,17 @@ +[ + { + "data": { + "name": "Test Device", + "enabled": true, + "site": null, + "description": null, + "platform": null, + "status": 0 + }, + "expected": { + "name": "Test Device", + "enabled": true, + "status": 0 + } + } +]
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/build_query_params_child/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/build_query_params_child/data.json new file mode 100644 index 00000000..a6120aa8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/build_query_params_child/data.json @@ -0,0 +1,260 @@ +[ + { + "parent": "primary_ip4", + "module_data": { + "name": "test100", + "serial": "FXS1001", + "comments": "Temp device", + "primary_ip4": { + "address": "172.16.180.1/24", + "vrf": "Test VRF" + } + }, + "child": { + "address": "172.16.180.1/24", + "vrf": "Test VRF" + }, + "expected": { + "address": "172.16.180.1/24", + "vrf_id": 1 + } + }, + { + "parent": "primary_ip6", + "module_data": { + "name": "test100", + "serial": "FXS1001", + "comments": "Temp device", + "primary_ip4": { + "address": "2001::1:1/64", + "vrf": "Test VRF" + } + }, + "child": { + "address": "2001::1:1/64", + "vrf": "Test VRF" + }, + "expected": { + "address": "2001::1:1/64", + "vrf_id": 1 + } + }, + { + "parent": "assigned_object", + "module_data": { + "address": "10.10.10.1/24", + "description": "Test description", + "assigned_object": { + "device": "test100", + "name": "Ethernet1/1" + } + }, + "child": { + "device": "test100", + "name": "Ethernet1/1" + }, + "expected": { + "device_id": 1, + "name": "Ethernet1/1" + } + }, + { + "parent": "assigned_object", + "module_data": { + "address": "10.10.10.1/24", + "description": "Test description", + "assigned_object": { + "virtual_machine": "test100-vm", + "name": "Ethernet1/1" + } + }, + "child": { + "virtual_machine": "test100-vm", + "name": "Ethernet1/1" + }, + "expected": { + "virtual_machine_id": 1, + "name": "Ethernet1/1" + } + }, + { + "parent": "lag", + "module_data": { + "name": "GigabitEthernet1", + "device": 1, + "lag": { + "name": "port-channel1" + } + }, + "child": { + "name": "port-channel1" + }, + "expected": { + "device_id": 1, + "type": 200, + "name": "port-channel1" + } + }, + { + "parent": "lag", + "module_data": { + "name": "GigabitEthernet1", + "device": "Test Device", + "lag": { + "name": "port-channel1" + } + }, + "child": { + "name": "port-channel1" + }, + "expected": { + "device": "Test Device", + "type": 200, + "name": "port-channel1" + } + }, + { + "parent": "nat_inside", + "module_data": { + "address": "10.10.10.1/24", + "nat_inside": { + "address": "192.168.1.1/24", + "vrf": "Test VRF" + } + }, + "child": { + "address": "192.168.1.1/24", + "vrf": "Test VRF" + }, + "expected": { + "address": "192.168.1.1/24", + "vrf_id": 1 + } + }, + { + "parent": "vlan", + "module_data": { + "prefix": "10.10.10.0/24", + "description": "Test Prefix", + "vlan": { + "name": "Test VLAN", + "site": "Test Site", + "tenant": "Test Tenant", + "vid": 1, + "vlan_group": "Test VLAN group" + } + }, + "child": { + "name": "Test VLAN", + "site": "Test Site", + "tenant": "Test Tenant", + "vid": 1, + "vlan_group": "Test VLAN group" + }, + "expected": { + "name": "Test VLAN", + "site_id": 1, + "tenant_id": 1, + "vid": 1, + "group": "Test VLAN group" + } + }, + { + "parent": "vlan_group", + "module_data": { + "prefix": "10.10.10.0/24", + "description": "Test Prefix", + "vlan_group": { + "name": "Test VLAN Group", + "slug": "test-vlan-group", + "site": "Test Site" + } + }, + "child": { + "name": "Test VLAN Group", + "slug": "test-vlan-group", + "site": "Test Site" + }, + "expected": { + "slug": "test-vlan-group", + "site_id": 1 + } + }, + { + "parent": "untagged_vlan", + "module_data": { + "prefix": "10.10.10.0/24", + "description": "Test Prefix", + "untagged_vlan": { + "name": "Test VLAN", + "site": "Test Site", + "vid": 1 + } + }, + "child": { + "name": "Test VLAN", + "site": "Test Site", + "vid": 1 + }, + "expected": { + "name": "Test VLAN", + "site_id": 1, + "vid": 1 + } + }, + { + "parent": "vrf", + "module_data": { + "prefix": "10.10.10.0/24", + "description": "Test Prefix", + "vrf": { + "name": "Test VRF", + "tenant": "Test Tenant" + } + }, + "child": { + "name": "Test VRF", + "tenant": "Test Tenant" + }, + "expected": { + "name": "Test VRF", + "tenant_id": 1 + } + }, + { + "parent": "termination_a", + "module_data": { + "termination_a_type": "circuits.circuittermination", + "termination_a": { + "circuit": "Circuit1", + "term_side": "A" + } + }, + "child": { + "circuit": "Circuit1", + "term_side": "A" + }, + "expected": { + "circuit_id": 1, + "term_side": "A" + } + }, + { + "parent": "termination_b", + "module_data": { + "termination_b_type": "dcim.interface", + "termination_b": { + "device": "device1", + "name": "Ethernet1/1" + } + }, + "child": { + "device": "device1", + "name": "Ethernet1/1" + }, + "expected": { + "device_id": 1, + "name": "Ethernet1/1" + } + } +]
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/build_query_params_no_child/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/build_query_params_no_child/data.json new file mode 100644 index 00000000..014457aa --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/build_query_params_no_child/data.json @@ -0,0 +1,410 @@ +[ + { + "parent": "circuit", + "module_data": { + "cid": "Test-Circuit-1000", + "cluster_type": "Test Circuit Type", + "provider": "Test Provider" + }, + "expected": { + "cid": "Test-Circuit-1000" + } + }, + { + "parent": "circuit_termination", + "module_data": { + "circuit": "Test Circuit", + "term_side": "A", + "site": "Test Site", + "port_speed": 10000 + }, + "expected": { + "circuit_id": 1, + "term_side": "A" + } + }, + { + "parent": "circuit_type", + "module_data": { + "name": "Test Circuit Type", + "slug": "test-circuit-type" + }, + "expected": { + "slug": "test-circuit-type" + } + }, + { + "parent": "aggregate", + "module_data": { + "prefix": "192.168.0.0/16", + "rir": "Example RIR", + "date_added": "2019-01-18" + }, + "expected": { + "prefix": "192.168.0.0/16", + "rir_id": 1 + } + }, + { + "parent": "cluster", + "module_data": { + "name": "Test Cluster", + "type": "Test Cluster Type", + "site": "Test Site" + }, + "expected": { + "name": "Test Cluster", + "type_id": 1 + } + }, + { + "parent": "cluster_group", + "module_data": { + "name": "Test Cluster Group", + "slug": "test-cluster-group" + }, + "expected": { + "slug": "test-cluster-group" + } + }, + { + "parent": "cluster_type", + "module_data": { + "name": "Test Cluster Type", + "slug": "test-cluster-type" + }, + "expected": { + "slug": "test-cluster-type" + } + }, + { + "parent": "device", + "module_data": { + "name": "Test Device", + "status": "Active" + }, + "expected": { + "name": "Test Device" + } + }, + { + "parent": "device_bay", + "module_data": { + "name": "Device Bay #1", + "device": "test100" + }, + "expected": { + "name": "Device Bay #1", + "device_id": 1 + } + }, + { + "parent": "device_role", + "module_data": { + "name": "Test Device Role", + "slug": "test-device-role", + "status": "Active" + }, + "expected": { + "slug": "test-device-role" + } + }, + { + "parent": "device_type", + "module_data": { + "name": "Test Device Type", + "slug": "test-device-type", + "status": "Active" + }, + "expected": { + "slug": "test-device-type" + } + }, + { + "parent": "installed_device", + "module_data": { + "name": "Test Device", + "status": "Active" + }, + "expected": { + "name": "Test Device" + } + }, + { + "parent": "interface", + "module_data": { + "name": "GigabitEthernet1", + "device": "Test Device", + "form_factor": 1000 + }, + "expected": { + "name": "GigabitEthernet1", + "device_id": 1 + } + }, + { + "parent": "interface", + "module_data": { + "name": "Eth0", + "virtual_machine": "Test Device", + "type": 0 + }, + "expected": { + "name": "Eth0", + "virtual_machine_id": 1 + } + }, + { + "parent": "inventory_item", + "module_data": { + "name": "10G-SFP+", + "device": "test100", + "serial": "1234", + "asset_tag": "1234" + }, + "expected": { + "name": "10G-SFP+", + "device_id": 1 + } + }, + { + "parent": "ip_address", + "module_data": { + "address": "192.168.1.1/24", + "vrf": "Test VRF", + "description": "Test description" + }, + "expected": { + "address": "192.168.1.1/24", + "vrf_id": 1 + } + }, + { + "parent": "prefix", + "module_data": { + "prefix": "10.10.10.0/24", + "vrf": "Test VRF", + "status": "Reserved" + }, + "expected": { + "prefix": "10.10.10.0/24", + "vrf_id": 1 + } + }, + { + "parent": "prefix", + "module_data": { + "parent": "10.10.0.0/16" + }, + "expected": { + "prefix": "10.10.0.0/16" + } + }, + { + "parent": "provider", + "module_data": { + "name": "Test Provider", + "slug": "test-provider", + "asn": 65001 + }, + "expected": { + "slug": "test-provider" + } + }, + { + "parent": "rack", + "module_data": { + "name": "Test Rack", + "slug": "test-rack", + "site": "Test Site" + }, + "expected": { + "name": "Test Rack", + "site_id": 1 + } + }, + { + "parent": "rack_group", + "module_data": { + "name": "Test Rack Group", + "slug": "test-rack-group" + }, + "expected": { + "slug": "test-rack-group" + } + }, + { + "parent": "rack_role", + "module_data": { + "name": "Test Rack Role", + "slug": "test-rack-role" + }, + "expected": { + "slug": "test-rack-role" + } + }, + { + "parent": "region", + "module_data": { + "name": "Test Region", + "slug": "test-region" + }, + "expected": { + "slug": "test-region" + } + }, + { + "parent": "parent_region", + "module_data": { + "name": "Parent Region", + "slug": "parent-region" + }, + "expected": { + "slug": "parent-region" + } + }, + { + "parent": "rir", + "module_data": { + "name": "Test RIR One", + "slug": "test-rir-one" + }, + "expected": { + "slug": "test-rir-one" + } + }, + { + "parent": "site", + "module_data": { + "name": "Test Site", + "slug": "test-site", + "asn": 65000, + "contact_name": "John Smith" + }, + "expected": { + "slug": "test-site" + } + }, + { + "parent": "tenant", + "module_data": { + "name": "Test Tenant", + "description": "Test Description", + "slug": "test-tenant" + }, + "expected": { + "slug": "test-tenant" + } + }, + { + "parent": "tenant_group", + "module_data": { + "name": "Test Tenant Group", + "description": "Test Description", + "slug": "test-tenant-group" + }, + "expected": { + "slug": "test-tenant-group" + } + }, + { + "parent": "interface_template", + "module_data": { + "device_type": 1, + "name": "SFP+ (10GBE)", + "type": "SFP+ (10GBE)" + }, + "expected": { + "name": "SFP+ (10GBE)", + "devicetype_id": 1 + } + }, + { + "parent": "device_bay_template", + "module_data": { + "name": "Bay 1", + "device_type": 1 + }, + "expected": { + "name": "Bay 1", + "devicetype_id": 1 + } + }, + { + "parent": "console_port_template", + "module_data": { + "name": "CP 1", + "device_type": 1 + }, + "expected": { + "name": "CP 1", + "devicetype_id": 1 + } + }, + { + "parent": "console_server_port_template", + "module_data": { + "name": "CP - Server 1", + "device_type": 1 + }, + "expected": { + "name": "CP - Server 1", + "devicetype_id": 1 + } + }, + { + "parent": "interface_template", + "module_data": { + "name": "Dev Intf 1", + "device_type": 1 + }, + "expected": { + "name": "Dev Intf 1", + "devicetype_id": 1 + } + }, + { + "parent": "front_port_template", + "module_data": { + "name": "FP 1", + "device_type": 1 + }, + "expected": { + "name": "FP 1", + "devicetype_id": 1 + } + }, + { + "parent": "power_outlet_template", + "module_data": { + "name": "PO 1", + "device_type": 1 + }, + "expected": { + "name": "PO 1", + "devicetype_id": 1 + } + }, + { + "parent": "power_port_template", + "module_data": { + "name": "PP 1", + "device_type": 1 + }, + "expected": { + "name": "PP 1", + "devicetype_id": 1 + } + }, + { + "parent": "virtual_machine", + "module_data": { + "name": "Test VM 100", + "cluster": "Test Cluster" + }, + "expected": { + "name": "Test VM 100", + "cluster_id": 1 + } + } +]
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/build_query_params_user_query_params/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/build_query_params_user_query_params/data.json new file mode 100644 index 00000000..82160548 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/build_query_params_user_query_params/data.json @@ -0,0 +1,42 @@ +[ + { + "parent": "primary_ip4", + "module_data": { + "name": "test100", + "serial": "FXS1001", + "comments": "Temp device", + "primary_ip4": { + "address": "172.16.180.1/24", + "vrf": "Test VRF" + } + }, + "user_query_params": [ + "serial" + ], + "expected": { + "serial": "FXS1001" + } + }, + { + "parent": "primary_ip6", + "module_data": { + "name": "test100", + "serial": "FXS1001", + "comments": "Temp device", + "primary_ip4": { + "address": "2001::1:1/64", + "vrf": "Test VRF" + } + }, + "user_query_params": [ + "name", + "serial", + "comments" + ], + "expected": { + "name": "test100", + "serial": "FXS1001", + "comments": "Temp device" + } + } +]
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/choices_id/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/choices_id/data.json new file mode 100644 index 00000000..b99be50d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/choices_id/data.json @@ -0,0 +1,202 @@ +[ + { + "endpoint": "circuits", + "data": { + "status": "Active" + }, + "expected": { + "status": "temp" + } + }, + { + "endpoint": "circuits", + "data": { + "status": 1 + }, + "expected": { + "status": 1 + } + }, + { + "endpoint": "devices", + "data": { + "status": "Active", + "face": "Front" + }, + "expected": { + "status": "temp", + "face": "temp" + } + }, + { + "endpoint": "devices", + "data": { + "status": 5, + "face": 1 + }, + "expected": { + "status": 5, + "face": 1 + } + }, + { + "endpoint": "device_types", + "data": { + "subdevice_role": "Parent" + }, + "expected": { + "subdevice_role": "temp" + } + }, + { + "endpoint": "device_types", + "data": { + "subdevice_role": "Child" + }, + "expected": { + "subdevice_role": "temp" + } + }, + { + "endpoint": "interfaces", + "data": { + "form_factor": "1000base-t (1ge)", + "mode": "Access" + }, + "expected": { + "form_factor": "temp", + "mode": "temp" + } + }, + { + "endpoint": "interfaces", + "data": { + "mode": 100 + }, + "expected": { + "mode": 100 + } + }, + { + "endpoint": "ip_addresses", + "data": { + "status": "Active", + "role": "Loopback" + }, + "expected": { + "status": "temp", + "role": "temp" + } + }, + { + "endpoint": "ip_addresses", + "data": { + "status": 1, + "role": 30 + }, + "expected": { + "status": 1, + "role": 30 + } + }, + { + "endpoint": "prefixes", + "data": { + "status": "Active" + }, + "expected": { + "status": "temp" + } + }, + { + "endpoint": "prefixes", + "data": { + "status": 2 + }, + "expected": { + "status": 2 + } + }, + { + "endpoint": "racks", + "data": { + "status": "Active", + "outer_unit": "Inches", + "type": "2-post Frame" + }, + "expected": { + "status": "temp", + "outer_unit": "temp", + "type": "temp" + } + }, + { + "endpoint": "racks", + "data": { + "status": 0, + "type": 1100 + }, + "expected": { + "status": 0, + "type": 1100 + } + }, + { + "endpoint": "sites", + "data": { + "status": "Active" + }, + "expected": { + "status": "temp" + } + }, + { + "endpoint": "sites", + "data": { + "status": 2 + }, + "expected": { + "status": 2 + } + }, + { + "endpoint": "virtual_machines", + "data": { + "status": "Offline", + "face": "Front" + }, + "expected": { + "status": "temp", + "face": "temp" + } + }, + { + "endpoint": "virtual_machines", + "data": { + "status": 1, + "face": 0 + }, + "expected": { + "status": 1, + "face": 0 + } + }, + { + "endpoint": "vlans", + "data": { + "status": "Active" + }, + "expected": { + "status": "temp" + } + }, + { + "endpoint": "vlans", + "data": { + "status": 2 + }, + "expected": { + "status": 2 + } + } +]
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/find_app/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/find_app/data.json new file mode 100644 index 00000000..4484fb70 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/find_app/data.json @@ -0,0 +1,122 @@ +[ + { + "endpoint": "providers", + "app": "circuits" + }, + { + "endpoint": "circuits", + "app": "circuits" + }, + { + "endpoint": "circuit_types", + "app": "circuits" + }, + { + "endpoint": "circuit_terminations", + "app": "circuits" + }, + { + "endpoint": "device_roles", + "app": "dcim" + }, + { + "endpoint": "device_types", + "app": "dcim" + }, + { + "endpoint": "devices", + "app": "dcim" + }, + { + "endpoint": "interfaces", + "app": "dcim" + }, + { + "endpoint": "manufacturers", + "app": "dcim" + }, + { + "endpoint": "platforms", + "app": "dcim" + }, + { + "endpoint": "racks", + "app": "dcim" + }, + { + "endpoint": "rack_groups", + "app": "dcim" + }, + { + "endpoint": "rack_roles", + "app": "dcim" + }, + { + "endpoint": "regions", + "app": "dcim" + }, + { + "endpoint": "sites", + "app": "dcim" + }, + { + "endpoint": "aggregates", + "app": "ipam" + }, + { + "endpoint": "ip_addresses", + "app": "ipam" + }, + { + "endpoint": "prefixes", + "app": "ipam" + }, + { + "endpoint": "roles", + "app": "ipam" + }, + { + "endpoint": "rirs", + "app": "ipam" + }, + { + "endpoint": "services", + "app": "ipam" + }, + { + "endpoint": "vlans", + "app": "ipam" + }, + { + "endpoint": "vlan_groups", + "app": "ipam" + }, + { + "endpoint": "vrfs", + "app": "ipam" + }, + { + "endpoint": "tenants", + "app": "tenancy" + }, + { + "endpoint": "tenant_groups", + "app": "tenancy" + }, + { + "endpoint": "clusters", + "app": "virtualization" + }, + { + "endpoint": "cluster_groups", + "app": "virtualization" + }, + { + "endpoint": "cluster_types", + "app": "virtualization" + }, + { + "endpoint": "virtual_machines", + "app": "virtualization" + } +]
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/normalize_data/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/normalize_data/data.json new file mode 100644 index 00000000..be7f861d --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/normalize_data/data.json @@ -0,0 +1,348 @@ +[ + { + "before": { + "circuit": "Test-Circuit-1000" + }, + "after": { + "circuit": "Test-Circuit-1000" + } + }, + { + "before": { + "circuit_termination": "Test Circuit" + }, + "after": { + "circuit_termination": "Test Circuit" + } + }, + { + "before": { + "circuit_termination": "Test Circuit" + }, + "after": { + "circuit_termination": "Test Circuit" + } + }, + { + "before": { + "circuit_type": "Test Circuit Type" + }, + "after": { + "circuit_type": "test-circuit-type" + } + }, + { + "before": { + "cluster": "Test Cluster" + }, + "after": { + "cluster": "Test Cluster" + } + }, + { + "before": { + "cluster_group": "Test Cluster_group" + }, + "after": { + "cluster_group": "test-cluster_group" + } + }, + { + "before": { + "cluster_type": "Test Cluster Type" + }, + "after": { + "cluster_type": "test-cluster-type" + } + }, + { + "before": { + "device": "Test Device" + }, + "after": { + "device": "Test Device" + } + }, + { + "before": { + "device_role": "Core Switch" + }, + "after": { + "device_role": "core-switch" + } + }, + { + "before": { + "device_type": "Cisco Switch" + }, + "after": { + "device_type": "cisco-switch" + } + }, + { + "before": { + "group": "Test Group1" + }, + "after": { + "group": "test-group1" + } + }, + { + "before": { + "installed_device": "Test Device" + }, + "after": { + "installed_device": "Test Device" + } + }, + { + "before": { + "manufacturer": "Cisco" + }, + "after": { + "manufacturer": "cisco" + } + }, + { + "before": { + "nat_inside": "192.168.1.1/24" + }, + "after": { + "nat_inside": "192.168.1.1/24" + } + }, + { + "before": { + "nat_outside": "192.168.10.1/24" + }, + "after": { + "nat_outside": "192.168.10.1/24" + } + }, + { + "before": { + "platform": "Cisco IOS" + }, + "after": { + "platform": "cisco-ios" + } + }, + { + "before": { + "prefix_role": "TEst Role-1" + }, + "after": { + "prefix_role": "test-role-1" + } + }, + { + "before": { + "primary_ip": "192.168.1.1/24" + }, + "after": { + "primary_ip": "192.168.1.1/24" + } + }, + { + "before": { + "primary_ip4": "192.168.1.1/24" + }, + "after": { + "primary_ip4": "192.168.1.1/24" + } + }, + { + "before": { + "primary_ip6": "2001::1/128" + }, + "after": { + "primary_ip6": "2001::1/128" + } + }, + { + "before": { + "provider": "Test Provider" + }, + "after": { + "provider": "test-provider" + } + }, + { + "before": { + "rack": "Test Rack" + }, + "after": { + "rack": "Test Rack" + } + }, + { + "before": { + "rack_group": "RacK_group" + }, + "after": { + "rack_group": "rack_group" + } + }, + { + "before": { + "rack_role": "Test Rack Role" + }, + "after": { + "rack_role": "test-rack-role" + } + }, + { + "before": { + "region": "Test Region_1" + }, + "after": { + "region": "test-region_1" + } + }, + { + "before": { + "rir": "Test RIR_One" + }, + "after": { + "rir": "test-rir_one" + } + }, + { + "before": { + "prefix_role": "TEst Role-1" + }, + "after": { + "prefix_role": "test-role-1" + } + }, + { + "before": { + "slug": "Test to_slug" + }, + "after": { + "slug": "test-to_slug" + } + }, + { + "before": { + "tenant": "Test Tenant" + }, + "after": { + "tenant": "test-tenant" + } + }, + { + "before": { + "tenant_group": "Test Tenant Group" + }, + "after": { + "tenant_group": "test-tenant-group" + } + }, + { + "before": { + "time_zone": "America/Los Angeles" + }, + "after": { + "time_zone": "America/Los_Angeles" + } + }, + { + "before": { + "virtual_machine": "Test VM 100" + }, + "after": { + "virtual_machine": "Test VM 100" + } + }, + { + "before": { + "vlan": "Test VLAN" + }, + "after": { + "vlan": "Test VLAN" + } + }, + { + "before": { + "vlan_group": "Test VLAN Group" + }, + "after": { + "vlan_group": "test-vlan-group" + } + }, + { + "before": { + "vlan_role": "Access Role" + }, + "after": { + "vlan_role": "Access Role" + } + }, + { + "before": { + "vrf": "Test VRF" + }, + "after": { + "vrf": "Test VRF" + } + }, + { + "before": { + "interface": 1 + }, + "after": { + "interface": 1 + } + }, + { + "before": { + "interface": { + "id": "123" + } + }, + "after": { + "interface": 123 + } + }, + { + "before": { + "interface": { + "vrf": "Test VRF" + } + }, + "after": { + "interface": { + "vrf": "Test VRF" + } + } + }, + { + "before": { + "vlan": { + "vlan_group": "Test VLAN Group" + } + }, + "after": { + "vlan": { + "vlan_group": "test-vlan-group" + } + } + }, + { + "before": { + "description": "White space " + }, + "after": { + "description": "White space" + } + }, + { + "before": { + "mac_address": "aa:bb:cc:dd:ee:ff" + }, + "after": { + "mac_address": "AA:BB:CC:DD:EE:FF" + } + } +]
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/slug/data.json b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/slug/data.json new file mode 100644 index 00000000..47d956f6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_data/slug/data.json @@ -0,0 +1,26 @@ +[ + { + "non_slug": "Test device-1_2", + "expected": "test-device-1_2" + }, + { + "non_slug": "TEST_DEVICE_1_2", + "expected": "test_device_1_2" + }, + { + "non_slug": "TEST DEVICE 1 2", + "expected": "test-device-1-2" + }, + { + "non_slug": 1, + "expected": 1 + }, + { + "non_slug": null, + "expected": null + }, + { + "non_slug": "test1.example.com", + "expected": "test1-example-com" + } +] diff --git a/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_netbox_base_class.py b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_netbox_base_class.py new file mode 100644 index 00000000..510e35b7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/netbox/netbox/tests/unit/module_utils/test_netbox_base_class.py @@ -0,0 +1,376 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2019, Bruno Inec (@sweenu) <bruno@inec.fr> +# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) <mikhail.yohman@gmail.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import pytest +import os +from functools import partial +from unittest.mock import patch, MagicMock, Mock +from ansible.module_utils.basic import AnsibleModule + +try: + from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( + NetboxModule, + ) + from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import ( + NB_DEVICES, + ) + from ansible_collections.netbox.netbox.tests.test_data import load_test_data + + MOCKER_PATCH_PATH = "ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils.NetboxModule" +except ImportError: + import sys + + # Not installed as a collection + # Try importing relative to root directory of this ansible_modules project + + sys.path.append("plugins/module_utils") + sys.path.append("tests") + from netbox_utils import NetboxModule + from netbox_dcim import NB_DEVICES + from test_data import load_test_data + + MOCKER_PATCH_PATH = "netbox_utils.NetboxModule" + +load_relative_test_data = partial( + load_test_data, os.path.dirname(os.path.abspath(__file__)) +) + + +@pytest.fixture +def fixture_arg_spec(): + return { + "netbox_url": "http://netbox.local/", + "netbox_token": "0123456789", + "data": { + "name": "Test Device1", + "device_role": "Core Switch", + "device_type": "Cisco Switch", + "manufacturer": "Cisco", + "site": "Test Site", + "asset_tag": "1001", + }, + "state": "present", + "validate_certs": False, + } + + +@pytest.fixture +def normalized_data(): + return { + "name": "Test Device1", + "device_role": "core-switch", + "device_type": "cisco-switch", + "manufacturer": "cisco", + "site": "test-site", + "asset_tag": "1001", + } + + +@pytest.fixture +def mock_ansible_module(fixture_arg_spec): + module = MagicMock(name="AnsibleModule") + module.check_mode = False + module.params = fixture_arg_spec + + return module + + +@pytest.fixture +def find_ids_return(): + return { + "name": "Test Device1", + "device_role": 1, + "device_type": 1, + "manufacturer": 1, + "site": 1, + "asset_tag": "1001", + } + + +@pytest.fixture +def nb_obj_mock(mocker, normalized_data): + nb_obj = mocker.Mock(name="nb_obj_mock") + nb_obj.delete.return_value = True + nb_obj.update.return_value = True + nb_obj.update.side_effect = normalized_data.update + nb_obj.serialize.return_value = normalized_data + + return nb_obj + + +@pytest.fixture +def endpoint_mock(mocker, nb_obj_mock): + endpoint = mocker.Mock(name="endpoint_mock") + endpoint.create.return_value = nb_obj_mock + + return endpoint + + +@pytest.fixture +def on_creation_diff(mock_netbox_module): + return mock_netbox_module._build_diff( + before={"state": "absent"}, after={"state": "present"} + ) + + +@pytest.fixture +def on_deletion_diff(mock_netbox_module): + return mock_netbox_module._build_diff( + before={"state": "present"}, after={"state": "absent"} + ) + + +@pytest.fixture +def mock_netbox_module(mocker, mock_ansible_module, find_ids_return): + find_ids = mocker.patch("%s%s" % (MOCKER_PATCH_PATH, "._find_ids")) + find_ids.return_value = find_ids_return + nb_client = mocker.Mock(name="pynetbox.api") + nb_client.version = "2.10" + netbox = NetboxModule(mock_ansible_module, NB_DEVICES, nb_client=nb_client) + + return netbox + + +@pytest.fixture +def changed_serialized_obj(nb_obj_mock): + changed_serialized_obj = nb_obj_mock.serialize().copy() + changed_serialized_obj["name"] += " (modified)" + + return changed_serialized_obj + + +@pytest.fixture +def on_update_diff(mock_netbox_module, nb_obj_mock, changed_serialized_obj): + return mock_netbox_module._build_diff( + before={"name": "Test Device1"}, after={"name": "Test Device1 (modified)"} + ) + + +def test_init(mock_netbox_module, find_ids_return): + """Test that we can get a real mock NetboxModule.""" + assert mock_netbox_module.data == find_ids_return + + +@pytest.mark.parametrize("before, after", load_relative_test_data("normalize_data")) +def test_normalize_data_returns_correct_data(mock_netbox_module, before, after): + norm_data = mock_netbox_module._normalize_data(before) + + assert norm_data == after + + +@pytest.mark.parametrize("data, expected", load_relative_test_data("arg_spec_default")) +def test_remove_arg_spec_defaults(mock_netbox_module, data, expected): + new_data = mock_netbox_module._remove_arg_spec_default(data) + + assert new_data == expected + + +@pytest.mark.parametrize("non_slug, expected", load_relative_test_data("slug")) +def test_to_slug_returns_valid_slug(mock_netbox_module, non_slug, expected): + got_slug = mock_netbox_module._to_slug(non_slug) + + assert got_slug == expected + + +@pytest.mark.parametrize("endpoint, app", load_relative_test_data("find_app")) +def test_find_app_returns_valid_app(mock_netbox_module, endpoint, app): + assert app == mock_netbox_module._find_app(endpoint), "app: %s, endpoint: %s" % ( + app, + endpoint, + ) + + +@pytest.mark.parametrize( + "endpoint, data, expected", load_relative_test_data("choices_id") +) +def test_change_choices_id(mocker, mock_netbox_module, endpoint, data, expected): + fetch_choice_value = mocker.patch( + "%s%s" % (MOCKER_PATCH_PATH, "._fetch_choice_value") + ) + fetch_choice_value.return_value = "temp" + new_data = mock_netbox_module._change_choices_id(endpoint, data) + assert new_data == expected + + +@pytest.mark.parametrize( + "parent, module_data, expected", + load_relative_test_data("build_query_params_no_child"), +) +def test_build_query_params_no_child( + mock_netbox_module, mocker, parent, module_data, expected +): + get_query_param_id = mocker.patch( + "%s%s" % (MOCKER_PATCH_PATH, "._get_query_param_id") + ) + get_query_param_id.return_value = 1 + query_params = mock_netbox_module._build_query_params(parent, module_data) + assert query_params == expected + + +@pytest.mark.parametrize( + "parent, module_data, child, expected", + load_relative_test_data("build_query_params_child"), +) +def test_build_query_params_child( + mock_netbox_module, mocker, parent, module_data, child, expected +): + get_query_param_id = mocker.patch( + "%s%s" % (MOCKER_PATCH_PATH, "._get_query_param_id") + ) + get_query_param_id.return_value = 1 + # This will need to be updated, but attempting to fix issue quickly + fetch_choice_value = mocker.patch( + "%s%s" % (MOCKER_PATCH_PATH, "._fetch_choice_value") + ) + fetch_choice_value.return_value = 200 + + query_params = mock_netbox_module._build_query_params( + parent, module_data, child=child + ) + print(query_params) + assert query_params == expected + + +@pytest.mark.parametrize( + "parent, module_data, user_query_params, expected", + load_relative_test_data("build_query_params_user_query_params"), +) +def test_build_query_params_user_query_params( + mock_netbox_module, mocker, parent, module_data, user_query_params, expected +): + get_query_param_id = mocker.patch( + "%s%s" % (MOCKER_PATCH_PATH, "._get_query_param_id") + ) + get_query_param_id.return_value = 1 + # This will need to be updated, but attempting to fix issue quickly + fetch_choice_value = mocker.patch( + "%s%s" % (MOCKER_PATCH_PATH, "._fetch_choice_value") + ) + fetch_choice_value.return_value = 200 + + query_params = mock_netbox_module._build_query_params( + parent, module_data, user_query_params + ) + assert query_params == expected + + +def test_build_diff_returns_valid_diff(mock_netbox_module): + before = "The state before" + after = {"A": "more", "complicated": "state"} + diff = mock_netbox_module._build_diff(before=before, after=after) + + assert diff == {"before": before, "after": after} + + +def test_create_netbox_object_check_mode_false( + mock_netbox_module, endpoint_mock, normalized_data, on_creation_diff +): + return_value = endpoint_mock.create().serialize() + serialized_obj, diff = mock_netbox_module._create_netbox_object( + endpoint_mock, normalized_data + ) + assert endpoint_mock.create.called_once_with(normalized_data) + assert serialized_obj.serialize() == return_value + assert diff == on_creation_diff + + +def test_create_netbox_object_check_mode_true( + mock_netbox_module, endpoint_mock, normalized_data, on_creation_diff +): + mock_netbox_module.check_mode = True + serialized_obj, diff = mock_netbox_module._create_netbox_object( + endpoint_mock, normalized_data + ) + assert endpoint_mock.create.not_called() + assert serialized_obj == normalized_data + assert diff == on_creation_diff + + +def test_delete_netbox_object_check_mode_false( + mock_netbox_module, nb_obj_mock, on_deletion_diff +): + mock_netbox_module.nb_object = nb_obj_mock + diff = mock_netbox_module._delete_netbox_object() + assert nb_obj_mock.delete.called_once() + assert diff == on_deletion_diff + + +def test_delete_netbox_object_check_mode_true( + mock_netbox_module, nb_obj_mock, on_deletion_diff +): + mock_netbox_module.check_mode = True + mock_netbox_module.nb_object = nb_obj_mock + diff = mock_netbox_module._delete_netbox_object() + assert nb_obj_mock.delete.not_called() + assert diff == on_deletion_diff + + +def test_update_netbox_object_no_changes(mock_netbox_module, nb_obj_mock): + mock_netbox_module.nb_object = nb_obj_mock + unchanged_data = nb_obj_mock.serialize() + serialized_object, diff = mock_netbox_module._update_netbox_object(unchanged_data) + assert nb_obj_mock.update.not_called() + assert serialized_object == unchanged_data + assert diff is None + + +def test_update_netbox_object_with_changes_check_mode_false( + mock_netbox_module, nb_obj_mock, changed_serialized_obj, on_update_diff +): + mock_netbox_module.nb_object = nb_obj_mock + serialized_obj, diff = mock_netbox_module._update_netbox_object( + changed_serialized_obj + ) + assert nb_obj_mock.update.called_once_with(changed_serialized_obj) + assert serialized_obj == nb_obj_mock.serialize() + assert diff == on_update_diff + + +def test_update_netbox_object_with_changes_check_mode_true( + mock_netbox_module, nb_obj_mock, changed_serialized_obj, on_update_diff +): + mock_netbox_module.nb_object = nb_obj_mock + mock_netbox_module.check_mode = True + updated_serialized_obj = nb_obj_mock.serialize().copy() + updated_serialized_obj.update(changed_serialized_obj) + + serialized_obj, diff = mock_netbox_module._update_netbox_object( + changed_serialized_obj + ) + assert nb_obj_mock.update.not_called() + assert serialized_obj == updated_serialized_obj + assert diff == on_update_diff + + +@pytest.mark.parametrize("version", ["2.9", "2.8", "2.7"]) +def test_version_check_greater_true(mock_netbox_module, nb_obj_mock, version): + mock_netbox_module.nb_object = nb_obj_mock + assert mock_netbox_module._version_check_greater("2.10", version) + + +@pytest.mark.parametrize("version", ["2.13", "2.12", "2.11", "2.10"]) +def test_version_check_greater_false(mock_netbox_module, nb_obj_mock, version): + mock_netbox_module.nb_object = nb_obj_mock + assert not mock_netbox_module._version_check_greater("2.10", version) + + +@pytest.mark.parametrize("version", ["2.9", "2.8", "2.7"]) +def test_version_check_greater_equal_to_true(mock_netbox_module, nb_obj_mock, version): + mock_netbox_module.nb_object = nb_obj_mock + assert mock_netbox_module._version_check_greater( + version, "2.7", greater_or_equal=True + ) + + +@pytest.mark.parametrize("version", ["2.6", "2.5", "2.4"]) +def test_version_check_greater_equal_to_false(mock_netbox_module, nb_obj_mock, version): + mock_netbox_module.nb_object = nb_obj_mock + assert not mock_netbox_module._version_check_greater( + version, "2.7", greater_or_equal=True + ) |