Skip to content

Commit f0628d3

Browse files
Change Ansible Collection Namespace & Collection Name (#122)
1 parent 5288031 commit f0628d3

Some content is hidden

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

50 files changed

+163
-144
lines changed

.travis.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ sudo: false
77

88
env:
99
global:
10-
- COLLECTION_NAMESPACE: netbox_community
11-
- COLLECTION_NAME: ansible_modules
12-
- COLLECTION_VERSION: 0.1.8
10+
- COLLECTION_NAMESPACE: netbox
11+
- COLLECTION_NAME: netbox
12+
- COLLECTION_VERSION: 0.1.9
1313
- secure: "tE6GtwrRU+Kjobx/94xqR2MqM20pHCnrLcHgPzIHA3npdwuA+GjCBiBLTkEEQM4fUWIfzUTyjSr9bZErm1PTI1GcIRdniTgJ3ZzSSkE7tgeYALB/7xsusB57SlmbBQm2SGwU558uWZ3NHEsi0WTgD8GKZo77OpGX72FZKsVXOz6k2wve51sOtoSVjgCsvWTmZHx4ynGdiA5wFkZfaEcjXECahKtunW+MlB5kpJzkVeLRUEXFMhWlsIYiA5nj8OI/X3Nk9ugh1ribENX9LrjpgrqQ9YariZ8G6py1ONuKZIn2g7xs5kNQ3qL6HL6N7SoUxiwH16CfSyugFaYiMfaxQ4NUVGGRHS4vSGbNIf+gLHcYvP40miI1f/+pntCzqygZMhW73FX2o+KH2OGv09khOl8k1nDg2/XvW0kCc/FU6l+Jp5wCC8H9X2uiULtQpRqts5TzIonlPEzGIpfGFgJ5m54Emhv9gjG1Z5OOyL/qae1Wr+L/uhiFafcglZYh8NHEMWCUCkeqFqR2kDmUMtdgYLD7Q7NdwlL/PSVVs1l7UPiQHlnecQKEHN7CvR3eKByTEmkCKafRYh/JQ9rBt9sZc7aAPVu+w3wWUwbHS4o4vVnmyXvJb1PeJSiuynF7CBo4Qd6qj4YwX8gLK6PylGyaMOp169u6xw1mo5/CX0pJ3x4="
1414

1515
matrix:
@@ -50,7 +50,7 @@ matrix:
5050

5151
before_script:
5252
- mkdir -p ~/ansible_collections/$COLLECTION_NAMESPACE
53-
- cp -R $COLLECTION_NAME ~/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
53+
- cp -R ansible_modules ~/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
5454
- cd ~/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
5555
- ansible-galaxy collection build .
5656
- ansible-galaxy collection install $COLLECTION_NAMESPACE-$COLLECTION_NAME-$COLLECTION_VERSION.tar.gz -p /home/travis/.ansible/collections
@@ -63,12 +63,13 @@ script:
6363
- ansible-playbook tests/integration/regression-tests.yml -vvvv
6464
- ansible-playbook tests/integration/integration-tests.yml -vvvv
6565

66+
before_deploy:
67+
- pip install ansible
68+
- ansible-galaxy collection build .
69+
6670
deploy:
6771
provider: script
6872
skip_cleanup: true
69-
script:
70-
- pip install ansible
71-
- ansible-galaxy collection build .
72-
- ansible-galaxy collection publish $COLLECTION_NAMESPACE-$COLLECTION_NAME-$COLLECTION_VERSION.tar.gz --api-key="$GALAXY_API_TOKEN"
73+
script: ansible-galaxy collection publish $COLLECTION_NAMESPACE-$COLLECTION_NAME-$COLLECTION_VERSION.tar.gz --api-key="$GALAXY_API_TOKEN"
7374
on:
7475
tags: true

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## v0.1.9
4+
5+
### Overview
6+
7+
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:
8+
`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.
9+
10+
I renamed the lookup plugin to `nb_lookup` so it will be used with the FQCN `netbox.netbox.nb_lookup`.
11+
12+
The inventory plugin will now be called within an inventory file by `netbox.netbox.nb_inventory`
13+
14+
### Bug Fixes
15+
16+
- [#120](https://github.com/netbox-community/ansible_modules/pull/120) - 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
17+
318
## v.1.8
419

520
### Bug Fixes
@@ -14,7 +29,6 @@
1429
- [#62](https://github.com/netbox-community/ansible_modules/issues/62) - Change lookups to property for subclassing of inventory plugin
1530
- [#60](https://github.com/netbox-community/ansible_modules/issues/60) - Added option for interfaces and IP addresses of interfaces to be fetched via inventory plugin
1631

17-
1832
### Bug Fixes
1933

2034
- [#95](https://github.com/netbox-community/ansible_modules/issues/95) - Updated _to_slug to follow same constructs NetBox uses

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ Copying an existing module that has close to the same options is typically the p
261261
- Update the module_util, module, and endpoint variable for the endpoint
262262
263263
```python
264-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_dcim import (
264+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_dcim import (
265265
NetboxDcimModule,
266266
NB_DEVICE_ROLES,
267267
)

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44

55
# Netbox modules for Ansible using Ansible Collections
66

7+
We have moved this collection to a different namespace and collection name on Ansible Galaxy. The new versions will be at `netbox.netbox`.
8+
9+
To keep the code simple, we only officially support the two latesst 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.
10+
711
## Requirements
812

9-
- Netbox 2.5+
13+
- NetBox 2.5+ or the two latest NetBox releases
1014
- **pynetbox 4.2.5+**
1115
- Python 3.6+
1216
- Ansible 2.9+
@@ -55,12 +59,12 @@
5559
## How to Use
5660

5761
- Install via Galaxy
58-
- `ansible-galaxy collection install netbox_community.ansible_modules`
62+
- `ansible-galaxy collection install netbox.netbox`
5963
- Install via source
6064
- `git clone git@github.com:netbox-community/ansible_modules.git`
6165
- `cd ansible_modules`
6266
- `ansible-galaxy collection build .`
63-
- `ansible-galaxy collection install netbox_community-ansible_modules-X.X.X.tar.gz`
67+
- `ansible-galaxy collection install netbox-netbox-X.X.X.tar.gz`
6468
- Can add `-p` to provide a different path other than the default path, but it must be within your `ansible.cfg` or provided via an environment variable.
6569

6670
### Example playbooks
@@ -73,7 +77,7 @@ Using the **collections** at the play level
7377
hosts: localhost
7478
gather_facts: False
7579
collections:
76-
- netbox_community.ansible_modules
80+
- netbox.netbox
7781

7882
tasks:
7983
- name: Create device within Netbox with only required information
@@ -99,7 +103,7 @@ Using the **collections** at the task level
99103

100104
tasks:
101105
- name: Create device within Netbox with only required information
102-
netbox_community.ansible_modules.netbox_device:
106+
netbox.netbox.netbox_device:
103107
netbox_url: http://netbox-demo.org:32768
104108
netbox_token: 0123456789abcdef0123456789abcdef01234567
105109
data:
@@ -116,7 +120,7 @@ Using the **collections** in a role's task files
116120
```yaml
117121
---
118122
- name: Create device within Netbox with only required information
119-
netbox_community.ansible_modules.netbox_device:
123+
netbox.netbox.netbox_device:
120124
netbox_url: http://netbox-demo.org:32768
121125
netbox_token: 0123456789abcdef0123456789abcdef01234567
122126
data:
@@ -132,7 +136,7 @@ OR
132136
---
133137
- name: Create device within Netbox with only required information
134138
collections:
135-
- netbox_community.ansible_modules:
139+
- netbox.netbox
136140
netbox_device:
137141
netbox_url: http://netbox-demo.org:32768
138142
netbox_token: 0123456789abcdef0123456789abcdef01234567
@@ -158,7 +162,7 @@ Using the **collections** lookup plugin at the task level
158162
assert:
159163
that: "{{ query_result|count }} == 3"
160164
vars:
161-
query_result: "{{ query('netbox_community.ansible_modules.netbox', 'sites', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}"
165+
query_result: "{{ query('nb_lookup', 'sites', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}"
162166
```
163167
164168
## How to Contribute

galaxy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
44
# content lives. May only contain alphanumeric characters and underscores. Additionally namespaces cannot start with
55
# underscores or numbers and cannot contain consecutive underscores
6-
namespace: netbox_community
6+
namespace: netbox
77

88
# The name of the collection. Has the same character restrictions as 'namespace'
9-
name: ansible_modules
9+
name: netbox
1010

1111
# The version of the collection. Must be compatible with semantic versioning
12-
version: 0.1.8
12+
version: 0.1.9
1313

1414
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
1515
readme: README.md

plugins/inventory/netbox.py renamed to plugins/inventory/nb_inventory.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
__metaclass__ = type
77

88
DOCUMENTATION = """
9-
name: netbox
9+
name: nb_inventory
1010
plugin_type: inventory
1111
author:
1212
- Remy Leone (@sieben)
@@ -23,7 +23,7 @@
2323
plugin:
2424
description: token that ensures this is a source file for the 'netbox' plugin.
2525
required: True
26-
choices: ['netbox_community.ansible_modules.netbox']
26+
choices: ['netbox.netbox.nb_inventory']
2727
api_endpoint:
2828
description: Endpoint of the NetBox API
2929
required: True
@@ -85,7 +85,7 @@
8585
# netbox_inventory.yml file in YAML format
8686
# Example command line: ansible-inventory -v --list -i netbox_inventory.yml
8787
88-
plugin: netbox_community.ansible_modules.netbox
88+
plugin: netbox.netbox.nb_inventory
8989
api_endpoint: http://localhost:8000
9090
validate_certs: True
9191
config_context: False
@@ -113,7 +113,7 @@
113113
# NetBox inventory plugin also supports Constructable semantics
114114
# You can fill your hosts vars using the compose option:
115115
116-
plugin: netbox_community.ansible_modules.netbox
116+
plugin: netbox.netbox.nb_inventory
117117
compose:
118118
foo: last_updated
119119
bar: display_name
@@ -198,7 +198,7 @@
198198

199199

200200
class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
201-
NAME = "netbox_community.ansible_modules.netbox"
201+
NAME = "netbox.netbox.netbox"
202202

203203
def _fetch_information(self, url):
204204
results = None

plugins/lookup/netbox.py renamed to plugins/lookup/nb_lookup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
__metaclass__ = type
2424

2525
DOCUMENTATION = """
26-
lookup: netbox
26+
lookup: nb_lookup
2727
author: Chris Mills (@cpmills1975)
2828
version_added: "2.9"
2929
short_description: Queries and returns elements from Netbox
@@ -64,7 +64,7 @@
6464
msg: >
6565
"Device {{ item.value.display_name }} (ID: {{ item.key }}) was
6666
manufactured by {{ item.value.device_type.manufacturer.name }}"
67-
loop: "{{ query('netbox', 'devices',
67+
loop: "{{ query('nb_lookup', 'devices',
6868
api_endpoint='http://localhost/',
6969
token='<redacted>') }}"
7070
@@ -77,7 +77,7 @@
7777
msg: >
7878
"Device {{ item.value.display_name }} (ID: {{ item.key }}) was
7979
manufactured by {{ item.value.device_type.manufacturer.name }}"
80-
loop: "{{ query('netbox', 'devices',
80+
loop: "{{ query('nb_lookup', 'devices',
8181
api_endpoint='http://localhost/',
8282
api_filter='role=management tag=Dell'),
8383
token='<redacted>') }}"
@@ -86,7 +86,7 @@
8686
tasks:
8787
- name: "Obtain secrets for R1-Device"
8888
debug:
89-
msg: "{{ query('netbox', 'secrets', api_filter='device=R1-Device', api_endpoint='http://localhost/', token='<redacted>', key_file='~/.ssh/id_rsa') }}"
89+
msg: "{{ query('nb_lookup', 'secrets', api_filter='device=R1-Device', api_endpoint='http://localhost/', token='<redacted>', key_file='~/.ssh/id_rsa') }}"
9090
"""
9191

9292
RETURN = """

plugins/module_utils/netbox_circuits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# This should just be temporary once 2.9 is relased and tested we can remove this
99
try:
10-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
10+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
1111
NetboxModule,
1212
ENDPOINT_NAME_MAPPING,
1313
SLUG_REQUIRED,

plugins/module_utils/netbox_dcim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from ansible.module_utils.basic import missing_required_lib
1111

1212
try:
13-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
13+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
1414
NetboxModule,
1515
ENDPOINT_NAME_MAPPING,
1616
SLUG_REQUIRED,

plugins/module_utils/netbox_extras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# This should just be temporary once 2.9 is relased and tested we can remove this
99
try:
10-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
10+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
1111
NetboxModule,
1212
ENDPOINT_NAME_MAPPING,
1313
)

plugins/module_utils/netbox_ipam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ansible.module_utils.basic import missing_required_lib
1313

1414
try:
15-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
15+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
1616
NetboxModule,
1717
ENDPOINT_NAME_MAPPING,
1818
SLUG_REQUIRED,

plugins/module_utils/netbox_secrets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# This should just be temporary once 2.9 is relased and tested we can remove this
99
try:
10-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
10+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
1111
NetboxModule,
1212
ENDPOINT_NAME_MAPPING,
1313
)

plugins/module_utils/netbox_tenancy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# This should just be temporary once 2.9 is relased and tested we can remove this
99
try:
10-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
10+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
1111
NetboxModule,
1212
ENDPOINT_NAME_MAPPING,
1313
SLUG_REQUIRED,

plugins/module_utils/netbox_virtualization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# This should just be temporary once 2.9 is relased and tested we can remove this
99
try:
10-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
10+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
1111
NetboxModule,
1212
ENDPOINT_NAME_MAPPING,
1313
SLUG_REQUIRED,

plugins/modules/netbox_aggregate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@
122122
type: str
123123
"""
124124

125-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
125+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
126126
NetboxAnsibleModule,
127127
NETBOX_ARG_SPEC,
128128
)
129-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_ipam import (
129+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_ipam import (
130130
NetboxIpamModule,
131131
NB_AGGREGATES,
132132
)

plugins/modules/netbox_circuit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@
147147
type: str
148148
"""
149149

150-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
150+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
151151
NetboxAnsibleModule,
152152
NETBOX_ARG_SPEC,
153153
)
154-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_circuits import (
154+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_circuits import (
155155
NetboxCircuitsModule,
156156
NB_CIRCUITS,
157157
)

plugins/modules/netbox_circuit_termination.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@
135135
type: str
136136
"""
137137

138-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
138+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
139139
NetboxAnsibleModule,
140140
NETBOX_ARG_SPEC,
141141
)
142-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_circuits import (
142+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_circuits import (
143143
NetboxCircuitsModule,
144144
NB_CIRCUIT_TERMINATIONS,
145145
)

plugins/modules/netbox_circuit_type.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@
9191
type: str
9292
"""
9393

94-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
94+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
9595
NetboxAnsibleModule,
9696
NETBOX_ARG_SPEC,
9797
)
98-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_circuits import (
98+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_circuits import (
9999
NetboxCircuitsModule,
100100
NB_CIRCUIT_TYPES,
101101
)

plugins/modules/netbox_cluster.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@
134134
type: str
135135
"""
136136

137-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
137+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
138138
NetboxAnsibleModule,
139139
NETBOX_ARG_SPEC,
140140
)
141-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_virtualization import (
141+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_virtualization import (
142142
NetboxVirtualizationModule,
143143
NB_CLUSTERS,
144144
)

plugins/modules/netbox_cluster_group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@
9191
type: str
9292
"""
9393

94-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_utils import (
94+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
9595
NetboxAnsibleModule,
9696
NETBOX_ARG_SPEC,
9797
)
98-
from ansible_collections.netbox_community.ansible_modules.plugins.module_utils.netbox_virtualization import (
98+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_virtualization import (
9999
NetboxVirtualizationModule,
100100
NB_CLUSTER_GROUP,
101101
)

0 commit comments

Comments
 (0)