Skip to content

Commit

Permalink
Merge pull request #55 from jvoss/feb23_updates
Browse files Browse the repository at this point in the history
Update testing to latest NetBox and resolve GitHub action issues
  • Loading branch information
jvoss authored Feb 18, 2023
2 parents 760ada8 + bc59673 commit a34c73d
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 109 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
skip_list:
- name[casing]
- no-changed-when
- package-latest # Package installs should not use latest
- schema[meta] # Amazon Linux 2 version: 'any' is valid

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: 'jvoss.netbox'

- name: Set up Python 3.
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'

Expand All @@ -39,12 +39,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: 'jvoss.netbox'

- name: Set up Python 3.
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'

Expand All @@ -61,7 +61,7 @@ jobs:
strategy:
matrix:
distro:
- amazonlinux2
# - amazonlinux2
- centos8
- debian11
- rockylinux8
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/netbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ jobs:
strategy:
matrix:
distro:
- amazonlinux2
# - amazonlinux2
- centos8
- debian10
- debian11
- rockylinux8
- ubuntu2004
- ubuntu2204
netbox:
- v3.3.7
- v3.4.4
- v3.3.10
- v3.2.9
- v3.1.11
- v3.0.12
Expand Down Expand Up @@ -64,12 +65,12 @@ jobs:
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: 'jvoss.netbox'

- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.9'

Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Ansible Role: Netbox

[![Netbox](
https://img.shields.io/badge/Netbox-v3.3.7-blue)](https://github.com/netbox-community/netbox)
https://img.shields.io/badge/Netbox-v3.4.4-blue)](https://github.com/netbox-community/netbox)
[![CI](https://github.com/jvoss/ansible-role-netbox/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/jvoss/ansible-role-netbox/actions/workflows/ci.yml)
[![Netbox](https://github.com/jvoss/ansible-role-netbox/actions/workflows/netbox.yml/badge.svg)](https://github.com/jvoss/ansible-role-netbox/actions/workflows/netbox.yml)
[![Ansible Galaxy](https://img.shields.io/badge/galaxy-jvoss.netbox-blue.svg)](https://galaxy.ansible.com/jvoss/netbox)
Expand All @@ -12,17 +12,19 @@ Installs, configures and maintains [NetBox](https://github.com/netbox-community/
on a variety of popular Linux distributions.

## Contents
1. [General Information](#general-information)
1. [Supported Platforms](#supported-platforms)
2. [Role variables](#role-variables)
3. [User accounts](#user-accounts)
1. [External Authentication](#external-authentication)
4. [Plugins](#plugins)
1. [Removing Plugins](#removing-plugins)
5. [Version Locking](#version-locking)
6. [Dependencies](#dependencies)
7. [Example Playbook](#example-playbook)
8. [Contributing](#contributing)
- [Ansible Role: Netbox](#ansible-role-netbox)
- [Contents](#contents)
- [General Information](#general-information)
- [Supported Platforms](#supported-platforms)
- [Role variables](#role-variables)
- [User accounts](#user-accounts)
- [External Authentication](#external-authentication)
- [Plugins](#plugins)
- [Removing Plugins](#removing-plugins)
- [Version locking](#version-locking)
- [Dependencies](#dependencies)
- [Example Playbook](#example-playbook)
- [Contributing](#contributing)

## General Information

Expand Down
23 changes: 23 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ netbox_redis_port: 6379
netbox_redis_tasks_db: 0
netbox_redis_cache_db: 1
netbox_redis_tls_insecure: False
# Set a path to a certificate authority, typically used with a self signed certificate.
# Netbox >= 3.4.3
# netbox_redis_ca_cert_path: /etc/ssl/certs/ca.crt

# This key is used for secure generation of random numbers and strings. It must never be exposed outside of this file.
# For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and
Expand Down Expand Up @@ -109,6 +112,10 @@ netbox_allowed_url_schemes:
- vnc
- xmpp

# Permit the retrieval of API tokens after their creation.
# Netbox >= 3.4.0
# netbox_allow_token_retrieval: False

# Enforce password validation for local accounts
# Netbox >= 3.2 (https://github.com/netbox-community/netbox/issues/7650)
# https://docs.djangoproject.com/en/4.0/topics/auth/passwords/#password-validation
Expand Down Expand Up @@ -178,6 +185,10 @@ netbox_cors_origin_regex_whitelist: [
# https://github.com/netbox-community/netbox/issues/8509
netbox_csrf_trusted_origins: []

# Set the default preferred language/locale
# Netbox >= 3.4.1
# netbox_default_language: en-us

# Set to True to enable server debugging. WARNING: Debugging introduces a substantial
# performance penalty and may reveal sensitive information about your installation.
# Only enable debugging while performing testing. Never enable debugging on a production
Expand Down Expand Up @@ -247,6 +258,10 @@ netbox_login_required: False
# before being prompted to re-authenticate. (Default: 1209600 [14 days])
netbox_login_timeout: None

# The view name or URL to which users are redirected after logging out.
# Introducted in v3.3.10
# netbox_logout_redirect_url: home

# Setting this to True will display a "maintenance mode" banner at the top of every page.
# Note: Moved to Dynamic Configuration (see netbox_override_dynamic_config)
netbox_maintenance_mode: False
Expand Down Expand Up @@ -315,6 +330,14 @@ netbox_plugins: []
# Note: Moved to Dynamic Configuration (see netbox_override_dynamic_config)
netbox_prefer_ipv4: False

# Allows changing which queues are used internally for background tasks.
# If no queue is defined the queue named `default` will be used.
# Netbox >= 3.4.0
netbox_queue_mappings:
webhook: low
report: high
script: high

# Rack elevation size defaults, in pixels. For best results, the ratio of width
# to height should be roughly 10:1.
# Note: Moved to Dynamic Configuration (see netbox_override_dynamic_config)
Expand Down
4 changes: 2 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ galaxy_info:
platforms:
- name: Amazon Linux 2
versions:
- any
- all
- name: EL
versions:
- 8
- "8"
- name: Ubuntu
versions:
- focal
Expand Down
7 changes: 4 additions & 3 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ lint: |
platforms:
- name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
cgroupns_mode: host
network_mode: host
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw

provisioner:
name: ansible
2 changes: 1 addition & 1 deletion molecule/default/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ roles:
- name: geerlingguy.postgresql
scm: git
src: 'git+https://github.com/geerlingguy/ansible-role-postgresql'
version: 3.2.1
version: 3.4.2

- name: geerlingguy.redis
32 changes: 0 additions & 32 deletions molecule/demo/converge.yml

This file was deleted.

41 changes: 0 additions & 41 deletions molecule/demo/molecule.yml

This file was deleted.

7 changes: 0 additions & 7 deletions molecule/demo/requirements.yml

This file was deleted.

7 changes: 5 additions & 2 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
- name: configure | add tzdata fix to local_requirements.txt when NetBox <= 3.2.9
ansible.builtin.lineinfile:
path: "{{ netbox_current_path }}/local_requirements.txt"
line: "tzdata==2022.2"
regexp: "^tzdata"
line: "{{ item }}"
regexp: "^{{ item }}"
owner: "{{ netbox_user }}"
mode: '0644'
create: yes
loop:
- tzdata==2022.1
- pytz==2022.1
when: netbox_version_tag <= 'v3.2.9'

# version 3.0.10 started throwing a warning during superuser creation
Expand Down
22 changes: 22 additions & 0 deletions templates/configuration.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ REDIS = {
# Set this to True to skip TLS certificate verification
# This can expose the connection to attacks, be careful
'INSECURE_SKIP_TLS_VERIFY': {{ netbox_redis_tls_insecure }},
{%- if netbox_redis_ca_cert_path is defined +%}
'CA_CERT_PATH': {{ netbox_redis_ca_cert_path }},
{%- endif +%}
},
'caching': {
'HOST': '{{ netbox_redis_host }}',
Expand All @@ -45,6 +48,9 @@ REDIS = {
# Set this to True to skip TLS certificate verification
# This can expose the connection to attacks, be careful
'INSECURE_SKIP_TLS_VERIFY': {{ netbox_redis_tls_insecure }},
{%- if netbox_redis_ca_cert_path is defined +%}
'CA_CERT_PATH': {{ netbox_redis_ca_cert_path }},
{%- endif +%}
}
}

Expand All @@ -63,6 +69,10 @@ ADMINS = {{ netbox_admins|to_json }}
ADMINS = []
{% endif %}

{% if netbox_allow_token_retrieval is defined %}
ALLOW_TOKEN_RETRIEVAL = {{ netbox_allow_token_retrieval }}
{% endif %}

{% if netbox_auth_password_validators is defined %}
AUTH_PASSWORD_VALIDATORS = {{ netbox_auth_password_validators|to_json }}
{% endif %}
Expand Down Expand Up @@ -121,6 +131,10 @@ CUSTOM_VALIDATORS = {

DEBUG = {{ netbox_debug }}

{% if netbox_default_language is defined %}
DEFAULT_LANGUAGE = '{{ netbox_default_language }}'
{% endif %}

{% if netbox_default_user_preferences is defined %}
DEFAULT_USER_PREFERENCES = {{ netbox_default_user_preferences|to_json }}
{% endif %}
Expand Down Expand Up @@ -176,6 +190,10 @@ LOGIN_REQUIRED = {{ netbox_login_required }}

LOGIN_TIMEOUT = {{ netbox_login_timeout }}

{% if netbox_logout_redirect_url is defined %}
LOGOUT_REDIRECT_URL = '{{ netbox_logout_redirect_url }}'
{% endif %}

{% if netbox_override_dynamic_config %}
MAINTENANCE_MODE = {{ netbox_maintenance_mode }}
{% endif %}
Expand Down Expand Up @@ -230,6 +248,10 @@ PLUGINS_CONFIG = json.loads('{{ plugins_config | to_json }}')
PREFER_IPV4 = {{ netbox_prefer_ipv4 }}
{% endif %}

{% if netbox_queue_mappings is defined %}
QUEUE_MAPPINGS = {{ netbox_queue_mappings | to_json }}
{% endif %}

{% if netbox_override_dynamic_config %}
RACK_ELEVATION_DEFAULT_UNIT_HEIGHT = {{ netbox_rack_elevation_default_unit_height }}
RACK_ELEVATION_DEFAULT_UNIT_WIDTH = {{ netbox_rack_elevation_default_unit_width }}
Expand Down

0 comments on commit a34c73d

Please sign in to comment.