Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap ssot integration #541

Merged
merged 21 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ddb25f6
fix: 🐛 nautobot_ssot requires nautobot >= 2.1.0
bile0026 Sep 9, 2024
63fffc4
fix: 🐛 nautobot_ssot requires nautobot >= 2.1.0
bile0026 Sep 9, 2024
2550e86
feat: ✨ add bootstrap ssot code
bile0026 Sep 9, 2024
a80a0ca
fix: 🚨 Correct complaint from pylint
jdrew82 Sep 10, 2024
f9285f3
docs: 📝 Fix documentation
jdrew82 Sep 10, 2024
dd36475
chore: 📝 add change fragment
bile0026 Sep 10, 2024
b64457b
docs: 📝 Add changelog fragment for documentation changes.
jdrew82 Sep 10, 2024
69923d6
fix: 🐛 adjust data type
bile0026 Sep 10, 2024
435a758
fix: 🐛 logging debug messages obey debug toggle on job
bile0026 Sep 11, 2024
66ab39c
docs: 📝 update plugin options for combined app and some spelling fixes
bile0026 Sep 11, 2024
0f4436c
fix: 🐛 code cleanup
bile0026 Sep 11, 2024
ce1727b
fix: 🐛 fix indentation
bile0026 Sep 11, 2024
9f9636e
style: 📝 update spellings
bile0026 Sep 11, 2024
e5e68f9
fix: 📝 remove duplicate entry
bile0026 Sep 12, 2024
38e7281
docs: 📝 update documentation
bile0026 Sep 12, 2024
e210b2c
Update docs/admin/integrations/bootstrap_setup.md
bile0026 Sep 19, 2024
0b42e7b
fix: 🐛 fix bug tagging tenants
bile0026 Sep 27, 2024
c059e6e
Merge branch 'develop' into bootstrap_ssot_integration
bile0026 Oct 3, 2024
e889dc3
chore: 👷 add codeowner for bootstrap integration
bile0026 Oct 3, 2024
9b02f04
docs: 📝 update installation instructions
bile0026 Oct 3, 2024
23d4110
Merge branch 'bootstrap_ssot_integration' of github.com:nautobot/naut…
bile0026 Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* @nautobot/plugin-ssot
/nautobot_ssot/integrations/aci/ @chadell @nautobot/plugin-ssot
/nautobot_ssot/integrations/aristacv/ @qduk @jdrew82 @nautobot/plugin-ssot
/nautobot_ssot/integrations/bootstrap/ @bile0026 @nautobot/plugin-ssot
/nautobot_ssot/integrations/device42/ @jdrew82 @nautobot/plugin-ssot
/nautobot_ssot/integrations/infoblox/ @qduk @jdrew82 @nautobot/plugin-ssot
/nautobot_ssot/integrations/ipfabric/ @alhogan @nautobot/plugin-ssot
Expand Down
1 change: 1 addition & 0 deletions changes/541.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Bootstrap SSoT to Nautobot SSoT Nautobot application
1 change: 1 addition & 0 deletions changes/541.documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed documentation errors with 1.5 release notes and missing links to integration setup and user sections.
4 changes: 4 additions & 0 deletions development/creds.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ NAUTOBOT_APIC_VERIFY_DEVNET=False
SERVICENOW_PASSWORD="changeme"

IPFABRIC_API_TOKEN=secrettoken

NAUTOBOT_SSOT_ENABLE_BOOTSTRAP="False"
NAUTOBOT_BOOTSTRAP_SSOT_ENVIRONMENT_BRANCH=develop
NAUTOBOT_BOOTSTRAP_SSOT_LOAD_SOURCE=file # or git
34 changes: 34 additions & 0 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,42 @@
"atl01": "Atlanta",
},
"aristacv_verify": is_truthy(os.getenv("NAUTOBOT_ARISTACV_VERIFY", "true")),
"bootstrap_nautobot_environment_branch": os.getenv("NAUTOBOT_BOOTSTRAP_SSOT_ENVIRONMENT_BRANCH", "develop"),
"bootstrap_models_to_sync": {
"secret": True,
"secrets_group": True,
"git_repository": True,
"dynamic_group": True,
"computed_field": True,
"tag": True,
"graph_ql_query": True,
"software": False,
"software_image": False,
"validated_software": False,
"tenant_group": True,
"tenant": True,
"role": True,
"manufacturer": True,
"platform": True,
"location_type": True,
"location": True,
"team": True,
"contact": True,
"provider": True,
"provider_network": True,
"circuit_type": True,
"circuit": True,
"circuit_termination": True,
"namespace": True,
"rir": True,
"vlan_group": True,
"vlan": True,
"vrf": True,
"prefix": True,
},
"enable_aci": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_ACI")),
"enable_aristacv": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_ARISTACV")),
"enable_bootstrap": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_BOOTSTRAP", "false")),
"enable_device42": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_DEVICE42")),
"enable_dna_center": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_DNA_CENTER")),
"enable_infoblox": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_INFOBLOX")),
Expand Down
88 changes: 88 additions & 0 deletions docs/admin/integrations/bootstrap_setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Bootstrap


## Description

This App will sync data from YAML files into Nautobot to create baseline environments. Most items will receive a custom field associated with them called "System of Record", which will be set to "Bootstrap". These items are then the only ones managed by the Bootstrap SSoT App. Other items within the Nautobot instance will not be affected unless there's items with overlapping names. There is currently two exceptions to this and those are the ComputedField, and GraphQLQuery models since they can't have a custom field associated. If you choose to manage ComputedField or GraphQLQuery objects with the Bootstrap SSoT App, make sure to define them all within the YAML file, since any "locally defined" Computed Fields and GraphQL Queries within Nautobot will end up getting deleted when the job runs. If an item exists in Nautobot by it's identifiers but it does not have the "System of Record" custom field on it, the item will be updated with "Bootstrap" (or `SYSTEM_OF_RECORD` environment variable value) when the App runs. This way no duplicates are created, and the App will not delete any items that are not defined in the Bootstrap data but were manually created in Nautobot.

## Installation

Before configuring the integration, please ensure, that `nautobot-ssot` app was [installed with Bootstrap integration extra dependencies](../install.md#install-guide).

```shell
pip install nautobot-ssot[bootstrap]
```


### nautobot_config.py

The settings here are pretty straightforward, `nautobot_environment_branch` will be loaded from the environment variable `NAUTOBOT_BOOTSTRAP_SSOT_ENVIRONMENT_BRANCH`, or default to develop. The rest of the settings define which models/objects you want to have the App sync to Nautobot. There are a couple of caveats to these. For example, for DynamicGroup objects to sync, the filter criteria need to already exist in Nautobot. So, if you are going to have groups that are filtered on platforms/regions/sites/etc make sure not to include DynamicGroup objects in the "models_to_sync" until those items exist. Same for Git Repositories when you want to sync Golden Config-related repositories. The Golden Config App needs to be installed, for the `provided_contents` items to be able to be found. This also goes for the Lifecycle Management app with `Software/ValidatedSoftware` models.

```python
PLUGINS = ["nautobot_ssot"]

PLUGINS_CONFIG = {
"nautobot_ssot": {
# Other nautobot_ssot settings ommitted.
"bootstrap_nautobot_environment_branch": os.getenv("NAUTOBOT_BOOTSTRAP_SSOT_ENVIRONMENT_BRANCH", "develop"),
"bootstrap_models_to_sync": {
"secret": True,
"secrets_group": True,
"git_repository": True,
"dynamic_group": True,
"computed_field": True,
"tag": True,
"graph_ql_query": True,
"software": False,
"software_image": False,
"validated_software": False,
"tenant_group": True,
"tenant": True,
"role": True,
"manufacturer": True,
"platform": True,
"location_type": True,
"location": True,
"team": True,
"contact": True,
"provider": True,
"provider_network": True,
"circuit_type": True,
"circuit": True,
"circuit_termination": True,
"namespace": True,
"rir": True,
"vlan_group": True,
"vlan": True,
"vrf": True,
"prefix": True,
},
"enable_bootstrap": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_BOOTSTRAP", "false")),
}
}
```

## Configuration

### Bootstrap data

Bootstrap data can be stored in 2 fashions.

1. (Recommended) Bootstrap data can be stored in a Git Repository and referenced in the app as a Git Datasource. A user should create a Git Repository in Nautobot (including any necessary Secrets and SecretsGroups for access) with the word "Bootstrap" in the name, and with a provided content type of `config contexts`. This is how the App will locate the correct repository. The data structure is flat files, and there is a naming scheme to these files. The first one required is `global_settings.yml`. This contains the main data structures of what data can be loaded `Secrets,SecretsGroups,GitRepository,DynamicGroup,Tag,etc`. You can then create additional `.yml` files with naming of your CI environments, i.e. production, development, etc for default values for specific items. This is where the environment variables described below would be matched to pull in additional data from the other YAML files defined in the directory.

2. Bootstrap data can be stored within the `nautobot_ssot/bootstrap/fixtures` directory. Using local files is not recommended as this requires a fork of the plugin and locally editing the YAML data files in the fixtures folder.

A simple structure would look something like this:

```text
global_settings.yml
develop.yml
prod.yml
staging.yml
```

There are 2 environment variables that control how certain things are loaded in the app.

1. `NAUTOBOT_BOOTSTRAP_SSOT_LOAD_SOURCE` - defines whether to load from the local `fixtures` folder or a GitRepository already present in Nautobot. This setting will get overridden if the user selects something other than `env_var` in the job's GUI settings.
- Acceptable options are `file` or `git`.
2. `NAUTOBOT_BOOTSTRAP_SSOT_ENVIRONMENT_BRANCH` - Defines the environment and settings you want to import. I.e. production, develop, staging.
1 change: 1 addition & 0 deletions docs/admin/integrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This Nautobot app supports the following integrations:

- [Cisco ACI](./aci_setup.md)
- [Bootstrap](./bootstrap_setup.md)
- [Arista CloudVision](./aristacv_setup.md)
- [Device42](./device42_setup.md)
- [Cisco DNA Center](./dna_center_setup.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/release_notes/version_1.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
## Changed

- [206](https://github.com/nautobot/nautobot-app-ssot/pull/206) - Update docs pins for py3.7 compatibility by @cmsirbu
- [207](https://github.com/nautobot/nautobot-app-ssot/pull/207) - Drop Python 3.7 Support by @jdrew82
- [207](https://github.com/nautobot/nautobot-app-ssot/pull/207) Drop Python 3.7 Support by @jdrew82
Loading