Skip to content

Commit a3d59dc

Browse files
authored
Testing fixes (#1248)
* Resolves #1247, Resolves #1245: Added CI * Resolves #1244: Update readme with minmimum Ansible version * Resolves #1241: Drop obsolete Ansible and Python versions * Fixes #1243: Add ansible-lint configuration * Fixes #1243: Remove yamllint config in favour of ansible-lint * Fixes #1247: Add requirements for CI pipeline * Fixes #1247: Remove yamllint from old test suite * Closes #1243: Test failures * Closes #1247: Add a changelog
1 parent 123cb02 commit a3d59dc

File tree

569 files changed

+9234
-8988
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

569 files changed

+9234
-8988
lines changed

.ansible-lint

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
profile: production
3+
4+
exclude_paths:
5+
- .cache/ # implicit unless exclude_paths is defined in config
6+
- .venv/
7+
- .github/
8+
9+
skip_list:
10+
- args[module]
11+
- no-handler
12+
- yaml[key-duplicates]
13+
- yaml[line-length]
14+
15+
offline: false

.ansible-lint-ignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file contains ignores rule violations for ansible-lint
2+
changelogs/fragments/housekeeping.yml yaml[comments]

.github/workflows/main.yml

-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ jobs:
1515
- name: Run black
1616
uses: psf/black@stable
1717

18-
- name: 'Yamllint'
19-
uses: karancode/yamllint-github-action@master
20-
21-
#- name: Run isort
22-
# uses: jamescurtin/isort-action@master
23-
24-
#- name: Run ruff
25-
# uses: chartboost/ruff-action@v1
26-
2718
unit_testing:
2819
runs-on: ubuntu-20.04
2920
needs: linting

.github/workflows/tests.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: "CI"
3+
4+
concurrency:
5+
group: ${{ github.head_ref || github.run_id }}
6+
cancel-in-progress: true
7+
8+
on: # yamllint disable-line rule:truthy
9+
pull_request:
10+
branches: [main, devel]
11+
workflow_dispatch:
12+
schedule:
13+
- cron: '0 0 * * *'
14+
15+
jobs:
16+
changelog:
17+
uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main
18+
if: github.event_name == 'pull_request'
19+
build-import:
20+
uses: ansible/ansible-content-actions/.github/workflows/build_import.yaml@main
21+
ansible-lint:
22+
uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main
23+
sanity:
24+
uses: ansible/ansible-content-actions/.github/workflows/sanity.yaml@main
25+
unit-galaxy:
26+
uses: ansible/ansible-content-actions/.github/workflows/unit.yaml@main
27+
unit-source:
28+
uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
29+
with:
30+
collection_pre_install: >-
31+
git+https://github.com/ansible-collections/ansible.utils.git
32+
all_green:
33+
if: ${{ always() }}
34+
needs:
35+
- changelog
36+
- sanity
37+
- ansible-lint
38+
- unit-galaxy
39+
- unit-source
40+
runs-on: ubuntu-latest
41+
steps:
42+
- run: >-
43+
python -c "assert 'failure' not in
44+
set([
45+
'${{ needs.changelog.result }}',
46+
'${{ needs.sanity.result }}',
47+
'${{ needs.unit-galaxy.result }}',
48+
'${{ needs.unit-source.result }}',
49+
'${{ needs.ansible-lint.result }}'
50+
])"

.readthedocs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
version: 2
3-
#sphinx:
4-
# configuration: docs/conf.py
3+
# sphinx:
4+
# configuration: docs/conf.py
55

66
build:
77
os: ubuntu-22.04

.yamllint

-32
This file was deleted.

CHANGELOG.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ v3.1.2
410410
Release Summary
411411
---------------
412412

413-
This release focuses on ansible-core 2.11 compatibility, general CI fixes for NetBox 2.10-2.11, and doc updates.
414-
This release works with NetBox 3.0, but needs further investigation with regards to idopmentcy (nothing really major) & some CI.
413+
This release focuses on ansible-core 2.11 compatibility, general CI fixes for NetBox 2.10-2.11, and doc updates.
414+
This release works with NetBox 3.0, but needs further investigation with regards to idopmentcy (nothing really major) & some CI.
415415
The next release will idenify and resolve any issues with NetBox 3.0.
416416

417417
Minor Changes

README.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Ansible Modules for NetBox
1+
# Ansible Modules for NetBox
22

33
## Description
4-
The NetBox Ansible project provides an Ansible collection for interacting with NetBox, the leading solution for modeling and documenting modern networks. By combining the traditional disciplines of IP address management (IPAM) and datacenter infrastructure management (DCIM) with powerful APIs and extensions, NetBox provides the ideal "source of truth" to power network automation.
4+
The NetBox Ansible project provides an Ansible collection for interacting with NetBox, the leading solution for modeling and documenting modern networks. By combining the traditional disciplines of IP address management (IPAM) and datacenter infrastructure management (DCIM) with powerful APIs and extensions, NetBox provides the ideal "source of truth" to power network automation.
55

6-
This Ansible collection consists of a set of modules to define the intended network state in NetBox, along with plugins to drive automation of the network using data from NetBox.
6+
This Ansible collection consists of a set of modules to define the intended network state in NetBox, along with plugins to drive automation of the network using data from NetBox.
77

88
## Requirements
99

1010
- You must be running one of the two most recent releases of NetBox
11-
- A NetBox write-enabled API token when using modules or a read-only token for the `nb_lookup ` and `nb_inventory` plugins.
12-
- Python 3.8+
11+
- A NetBox write-enabled API token when using modules or a read-only token for the `nb_lookup ` and `nb_inventory` plugins.
12+
- Python 3.10+
1313
- Python modules:
14-
- pytz
15-
- pynetbox
16-
- Ansible 2.12+
14+
- pytz
15+
- pynetbox
16+
- Ansible 2.15+
1717

1818
## Installation
1919

@@ -41,10 +41,10 @@ To upgrade the collection to the latest available version, run the following com
4141
```
4242
ansible-galaxy collection install netbox.netbox --upgrade
4343
```
44-
You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version 3.17.0:
44+
You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version 3.18.0:
4545

4646
```
47-
ansible-galaxy collection install netbox.netbox:==3.17.0
47+
ansible-galaxy collection install netbox.netbox:==3.18.0
4848
```
4949
See using [Ansible collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#installing-collections) for more details.
5050

@@ -75,13 +75,13 @@ This is useful to test code within PRs.
7575
## Use Cases
7676

7777
### Use Case 1 - Define Intended Network State in NetBox
78-
Define the intended state of your network in NetBox, by interacting with the NetBox database to define objects and their associated state in the following ways:
78+
Define the intended state of your network in NetBox, by interacting with the NetBox database to define objects and their associated state in the following ways:
7979

8080
- Make sure objects exit
8181
- Update objects if they do exist
8282
- Remove objects if they do not not exist
8383

84-
For example, to make sure a new aggregate network prefix exists:
84+
For example, to make sure a new aggregate network prefix exists:
8585
```
8686
tasks:
8787
- name: Create aggregate within NetBox with only required information
@@ -95,9 +95,9 @@ tasks:
9595
```
9696

9797
### Use Case 2 - NetBox as a Dynamic Inventory Source for Ansible
98-
Use the Inventory Plugin to dynamically generate Ansible inventory from device data in NetBox. Use query filters, groups and mappings to tailor the generated inventory to your specific needs.
98+
Use the Inventory Plugin to dynamically generate Ansible inventory from device data in NetBox. Use query filters, groups and mappings to tailor the generated inventory to your specific needs.
9999

100-
The following example builds an Ansible inventory that groups devices by `role`, and filters for only devices that have the `network-edge-router` role, have a primary IP address and belong to the `internal` tenant:
100+
The following example builds an Ansible inventory that groups devices by `role`, and filters for only devices that have the `network-edge-router` role, have a primary IP address and belong to the `internal` tenant:
101101
```
102102
# netbox_inventory.yml file in YAML format
103103
# Example command line: ansible-inventory -v --list -i netbox_inventory.yml
@@ -116,9 +116,9 @@ device_query_filters:
116116
```
117117

118118
### Use Case 3 - Query and Return Elements from NetBox
119-
Use the Lookup plugin to query NetBox and return data to drive network automation, such as lists of devices, device configurations, prefixes and IP addresses etc.
119+
Use the Lookup plugin to query NetBox and return data to drive network automation, such as lists of devices, device configurations, prefixes and IP addresses etc.
120120

121-
The following example returns a list of devices and their manufacturers, using an API filter to only return devices with the `management` role and the NetBox tag of `Dell`:
121+
The following example returns a list of devices and their manufacturers, using an API filter to only return devices with the `management` role and the NetBox tag of `Dell`:
122122
```
123123
tasks:
124124
# query a list of devices
@@ -134,13 +134,13 @@ tasks:
134134
135135
```
136136
## Testing
137-
Tested with Ansible Core v2.15.9. Ansible Core versions prior to 2.15.9 are not supported.
137+
Tested with Ansible Core v2.15+ Ansible Core versions prior to 2.15 are not supported.
138138

139139
## Contributing
140140
If you would to contribute to the project then you can find out how to get started [here](https://github.com/netbox-community/ansible_modules/blob/devel/CONTRIBUTING.md).
141141

142142
## Support
143-
There are various options to get support for the collection:
143+
There are various options to get support for the collection:
144144
- Search through previous [GitHub Discussions](https://github.com/netbox-community/ansible_modules/discussions) or start a new one.
145145
- Raise a [GitHub Issue](https://github.com/netbox-community/ansible_modules/issues)
146146
- Read the module [documentation](https://netbox-ansible-collection.readthedocs.io/en/latest/)
@@ -149,11 +149,11 @@ There are various options to get support for the collection:
149149
Customers of NetBox Labs and Ansible using the officially certified version of the collection can get support via the usual Ansible channels. Escalation to the NetBox Labs support team will be provided as needed.
150150

151151
## Release Notes
152-
The collection release notes and changelog can be found [here](https://github.com/netbox-community/ansible_modules/releases).
152+
The collection release notes and changelog can be found [here](https://github.com/netbox-community/ansible_modules/releases).
153153

154154
## Related Information
155-
Some extra resources you might find useful for both the Anisble collection and for NetBox itself:
156-
- [NetBox Zero to Hero](https://netboxlabs.com/zero-to-hero/) - free 12 part course that takes you from an empty NetBox through to a fully deployed branch site, using the Ansible collection extensively along the way.
155+
Some extra resources you might find useful for both the Anisble collection and for NetBox itself:
156+
- [NetBox Zero to Hero](https://netboxlabs.com/zero-to-hero/) - free 12 part course that takes you from an empty NetBox through to a fully deployed branch site, using the Ansible collection extensively along the way.
157157
- [Network Configuration Assurance with NetBox and Ansible](https://netboxlabs.com/blog/network-configuration-assurance-with-netbox-and-ansible/) - blog post featuring the Inventory plugin being used in a simple network automation use case to compare actual network state Vs intended state as defined in NetBox.
158158
- Official NetBox [documentation](https://docs.netbox.dev/en/stable/).
159159

@@ -162,4 +162,4 @@ GNU General Public License v3.0 or later.
162162

163163
See [LICENSE](https://github.com/netbox-community/ansible_modules/blob/devel/LICENSE) for the full text of the license.
164164

165-
Link to the license that the collection is published under.
165+
Link to the license that the collection is published under.

0 commit comments

Comments
 (0)