-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tfindley/initial
WIP: Initial push
- Loading branch information
Showing
37 changed files
with
804 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# .github/workflows/ansible-lint.yml | ||
name: ansible-lint | ||
on: | ||
pull_request: | ||
branches: ["main", "stable", "release/v*", "dev"] | ||
jobs: | ||
build: | ||
name: Ansible Lint # Naming the build is important to use it as a status check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run ansible-lint | ||
uses: ansible/[email protected] | ||
# optional (see below): | ||
with: | ||
args: " -c .ansible-lint" | ||
setup_python: "true" | ||
requirements_file: requirements.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# ---> Ansible | ||
*.retry | ||
|
||
# ---> VisualStudioCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
!.vscode/*.code-snippets | ||
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
|
||
# Built Visual Studio Code Extensions | ||
*.vsix | ||
|
||
# ---> macOS | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# ---> Windows | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Netbox Configuration | ||
|
||
[](https://github.com/tfindley/Ansible-Role-NetboxInventory/actions/workflows/ansible-lint.yml) | ||
|
||
A brief description of the role goes here. | ||
|
||
Execution order | ||
|
||
- preflight | ||
- extras::custom_fields | ||
- extras::tags | ||
- tenenacy::tenants | ||
- tenancy::contacts | ||
- dcim::manufacturers | ||
- dcim::rack_roles | ||
- dcim::racks | ||
- dcim::device_type | ||
- dcim::device_roles | ||
- virtualization::cluster_type | ||
- extras::config_contexts | ||
|
||
## Requirements | ||
|
||
In order to run this role you will require: | ||
|
||
- A working installation of Netbox with a reachable API from your Ansible Host machine (the machine you wish to run Ansible on) | ||
|
||
The following variables will also need to be set: | ||
|
||
| Variable Name | Type | Required | Default | Example | Playbook Env example | | ||
| -------------------------- | ---- | -------- | -------------------------------------------- | ---------------------------- | --------------------------------------------------------- | | ||
| nbconfig_netbox_api | str | true | `{{ netbox_api }}` | https://netboxurl.domain.tld | `netbox_api: "{{ lookup('env', 'NETBOX_API') }}"` | | ||
| nbconfig_netbox_api_key | str | true | `{{ netbox_api_key }}` | abcdef1234567890 | `netbox_api_key: "{{ lookup('env', 'NETBOX_API_KEY') }}"` | | ||
| nbconfig_netbox_validcert | bool | false | `{{ netbox_validcert }} \| default(true) }}` | true | | | ||
|
||
|
||
## Role Variables | ||
|
||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. | ||
|
||
## Dependencies | ||
|
||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. | ||
|
||
## Example Playbook | ||
|
||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: | ||
|
||
```yaml | ||
--- | ||
- name: Apply changes & configuration to Netbox | ||
hosts: localhost # No inventory required - only your localhost is required to run this | ||
connection: local | ||
become: false # privilaged access is not required | ||
gather_facts: false | ||
|
||
roles: | ||
- nbconfig | ||
|
||
vars: | ||
# Standard variables for Netbox integration | ||
nbconfig_netbox_api: "{{ lookup('env', 'NETBOX_API') }}" # This must be defined in your environmental variables. | ||
nbconfig_netbox_api_key: "{{ lookup('env', 'NETBOX_API_KEY') }}" # This must be defined in your environmental variables. DO NOT HARD CODE! | ||
nbconfig_netbox_validcert: false # Change this variable to true if your Netbox server is using untrusted (i.e: self-signed) certificates | ||
|
||
``` | ||
|
||
## License | ||
|
||
BSD | ||
|
||
## Author Information | ||
|
||
**Tristan Findley** | ||
|
||
Find out more about me [here](https://about.me/tfindley). | ||
|
||
If you're fan of my work and would like to show your support: | ||
|
||
[](https://www.buymeacoffee.com/tristan) | ||
|
||
[](https://ko-fi.com/Z8Z016573P) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
|
||
nbconfig_dcim_roles: | ||
- name: "Virtual Machine" | ||
slug: "vm" | ||
color: 'ffc107' | ||
tags: | ||
- ansible_managed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
|
||
nbconfig_dcim_device_type: | ||
- manufacturer: test_manufacturer | ||
model: "Test Device" | ||
part_number: "TEST-Man-DEv01" | ||
slug: test-man-dev01 | ||
is_full_depth: true | ||
u_height: '2' | ||
airflow: "front-to-rear" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
|
||
nbconfig_dcim_manufacturers: | ||
- name: "Test Manufacturer" | ||
slug: "test_manufacturer" | ||
tags: | ||
- ansible_managed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
|
||
nbconfig_dcim_platforms: | ||
- name: "Test Manufacturer Devices" | ||
slug: "test_man_devices" | ||
manufacturer: "test_manufacturer" | ||
tags: | ||
- ansible_managed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
|
||
nbconfig_dcim_rack_roles: | ||
- name: "CoLoc Hosted" | ||
slug: "coloc_host" | ||
color: "cddc39" | ||
description: "Colocation rack hosting third-party tenants" | ||
|
||
- name: "Unprovisioned" | ||
slug: "unprovisioned" | ||
color: "c0c0c0" | ||
description: "Unprovisioned rack" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
|
||
nbconfig_dcim_racks: | ||
- name: "Room1Rack1" | ||
site: "test_tenant_site_1" | ||
type: "4-post cabinet" | ||
u_height: 42 | ||
width: 19 | ||
role: "unprovisioned" | ||
tenant: "test_tenant" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
# defaults file for nbconfig | ||
|
||
nbconfig_netbox_api: | ||
nbconfig_netbox_api_key: | ||
nbconfig_netbox_validcert: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
nbconfig_extras_config_contexts: | ||
- name: "OS: Linux - CentOS 9" | ||
description: "Configuration data CentOS Linux 9" | ||
data: "{{ lookup('ansible.builtin.file', 'config_contexts/os/linux/centos_9.json') }}" | ||
is_active: true | ||
tags: | ||
- os_linux_centos_9 | ||
|
||
- name: "OS: Linux - Rocky 8" | ||
description: "Configuration data Rocky Linux 8" | ||
data: "{{ lookup('ansible.builtin.file', 'config_contexts/os/linux/rocky_8.json') }}" | ||
is_active: true | ||
tags: | ||
- os_linux_rocky_8 | ||
|
||
- name: "OS: Linux - Rocky 9" | ||
description: "Configuration data Rocky Linux 9" | ||
data: "{{ lookup('ansible.builtin.file', 'config_contexts/os/linux/rocky_9.json') }}" | ||
is_active: true | ||
tags: | ||
- os_linux_rocky_9 | ||
|
||
- name: "OS: Linux - Ubuntu 20.04" | ||
description: "Configuration data Ubuntu 20.04 LTS" | ||
data: "{{ lookup('ansible.builtin.file', 'config_contexts/os/linux/ubuntu_20_04.json') }}" | ||
is_active: true | ||
tags: | ||
- os_linux_ubuntu_20_04 | ||
|
||
- name: "OS: Linux - Ubuntu 22.04" | ||
description: "Configuration data Ubuntu 22.04 LTS" | ||
data: "{{ lookup('ansible.builtin.file', 'config_contexts/os/linux/ubuntu_22_04.json') }}" | ||
is_active: true | ||
tags: | ||
- os_linux_ubuntu_22_04 | ||
|
||
- name: "OS: Linux - Ubuntu 24.04" | ||
description: "Configuration data Ubuntu 24.04 LTS" | ||
data: "{{ lookup('ansible.builtin.file', 'config_contexts/os/linux/ubuntu_24_04.json') }}" | ||
is_active: true | ||
tags: | ||
- os_linux_ubuntu_24_04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
|
||
nbconfig_extras_custom_fields: | ||
- name: "ssh_host_key_ecdsa" | ||
label: "ECDSA Host key" | ||
type: "longtext" | ||
group_name: "SSH Host Keys" | ||
ui_visibility: "read-only" | ||
content_types: | ||
- dcim.device | ||
- virtualization.virtualmachine | ||
|
||
- name: "ssh_host_key_ed25519" | ||
label: "ED25519 Host key" | ||
type: "longtext" | ||
group_name: "SSH Host Keys" | ||
ui_visibility: "read-only" | ||
content_types: | ||
- dcim.device | ||
- virtualization.virtualmachine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
nbconfig_extras_tags: | ||
- name: 'Terraformed' | ||
slug: terraformed | ||
color: 673ab7 | ||
description: "Created using Hashicorp Terraform" | ||
|
||
- name: 'Ansible Managed' | ||
slug: ansible_managed | ||
color: FF2D00 | ||
description: "Created and Managed using Ansible" | ||
|
||
- name: 'Ansible Inventoried' | ||
slug: ansible_inventoried | ||
color: AA1409 | ||
description: "Device/VM/Interface has been inventoried using Ansible" | ||
|
||
- name: 'OS: Linux - CentOS 9' | ||
slug: 'os_linux_centos_9' | ||
color: 03A9F0 | ||
description: "Operating System: Linux - CentOS 9" | ||
|
||
- name: 'OS: Linux - Rocky 8' | ||
slug: 'os_linux_rocky_8' | ||
color: 03A9F0 | ||
description: "Operating System: Linux - Rocky 8" | ||
|
||
- name: 'OS: Linux - Rocky 9' | ||
slug: 'os_linux_rocky_9' | ||
color: 03A9F0 | ||
description: "Operating System: Linux - Rocky 9" | ||
|
||
- name: 'OS: Linux - Ubuntu 20.04' | ||
slug: 'os_linux_ubuntu_20_04' | ||
color: 03A9F0 | ||
description: "Operating System: Linux - Ubuntu 20.04 LTS" | ||
|
||
- name: 'OS: Linux - Ubuntu 22.04' | ||
slug: 'os_linux_ubuntu_22_04' | ||
color: 03A9F0 | ||
description: "Operating System: Linux - Ubuntu 22.04 LTS" | ||
|
||
- name: 'OS: Linux - Ubuntu 24.04' | ||
slug: 'os_linux_ubuntu_24_04' | ||
color: 03A9F0 | ||
description: "Operating System: Linux - Ubuntu 24.04 LTS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
|
||
nbconfig_tenancy_contacts: | ||
- name: 'Tristan Findley' | ||
title: 'Automation Engineer' | ||
email: "[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
|
||
nbconfig_tenancy_tenants: | ||
- name: 'Test Tenant' | ||
slug: test-tenant | ||
tenant_group: test_tenant_group | ||
description: "Test Tenant as demo data" | ||
tags: | ||
- ansible_managed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
|
||
nbconfig_virtualization_cluster_types: | ||
- name: "VXRail" | ||
slug: "vxrail" | ||
description: "Dell VXRail Hyper Converged cluster running VMWare hypervisor, vsphere and managed storage" | ||
tags: | ||
- ansible_managed | ||
|
||
- name: "Proxmox" | ||
slug: "proxmox" | ||
description: "Proxmox Hypervisor. Lower cost alternative to VMWare" | ||
tags: | ||
- ansible_managed | ||
|
||
- name: "vSphere" | ||
slug: "vsphere" | ||
description: "vSphere Managed group of ESXi devices" | ||
tags: | ||
- ansible_managed | ||
|
||
- name: "ESXi" | ||
slug: "esxi" | ||
description: "Stand alone ESXI hosts not managed under a single vCenter instance. Typically these are used for small standalone virtual deployments for development purposes." # noqa: yaml[line-length] | ||
tags: | ||
- ansible_managed |
Oops, something went wrong.