diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 717147f..4c3ff86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,6 +63,7 @@ jobs: distro: - amazonlinux2 - centos8 + - debian11 - rockylinux8 - ubuntu2004 diff --git a/.github/workflows/netbox.yml b/.github/workflows/netbox.yml index f674c91..7d8a8ee 100644 --- a/.github/workflows/netbox.yml +++ b/.github/workflows/netbox.yml @@ -19,13 +19,21 @@ jobs: distro: - amazonlinux2 - centos8 + - debian10 + - debian11 - rockylinux8 - ubuntu2004 netbox: - v3.2.1 - - v3.2.0 - v3.1.11 - v3.0.12 + exclude: + - distro: debian10 + include: + - distro: debian10 + netbox: v3.1.11 + - distro: debian10 + netbox: v3.0.12 services: postgres: diff --git a/EXAMPLE.md b/EXAMPLE.md index 00aee2d..610f38e 100644 --- a/EXAMPLE.md +++ b/EXAMPLE.md @@ -12,53 +12,57 @@ At the completion of this play netbox will be available at: `http://:80 ## Host variables - # netbox.example.com.yml - - netbox_home: /opt/netbox - netbox_version_tag: v3.0.9 - netbox_db_username: netbox - netbox_db_password: password - netbox_secret_key: "-nit@y=2#)u2dz-e(de1$t*4mxpy4d9o(b4j5xf@6!ql=r-14o" - - netbox_superusers: - - username: admin - password: admin - email: admin@example.com - - # caddy_ansible.caddy_ansible configuration - caddy_config: | - :8080 { - route /static* { - uri strip_prefix /static - root * /opt/netbox/current/netbox/static - file_server - } - - reverse_proxy http://127.0.0.1:8001 - } - - # geerlingguy.postgresql configuration - postgresql_users: - - name: "{{ netbox_db_username }}" - password: "{{ netbox_db_password }}" - db: "{{ netbox_db_name }}" - postgresql_databases: - - name: "{{ netbox_db_name }}" - owner: "{{ netbox_db_username }}" +```yaml +# netbox.example.com.yml + +netbox_home: /opt/netbox +netbox_version_tag: v3.0.9 +netbox_db_username: netbox +netbox_db_password: password +netbox_secret_key: "-nit@y=2#)u2dz-e(de1$t*4mxpy4d9o(b4j5xf@6!ql=r-14o" + +netbox_superusers: + - username: admin + password: admin + email: admin@example.com + +# caddy_ansible.caddy_ansible configuration +caddy_config: | + :8080 { + route /static* { + uri strip_prefix /static + root * /opt/netbox/current/netbox/static + file_server + } + + reverse_proxy http://127.0.0.1:8001 + } + +# geerlingguy.postgresql configuration +postgresql_users: + - name: "{{ netbox_db_username }}" + password: "{{ netbox_db_password }}" + db: "{{ netbox_db_name }}" +postgresql_databases: + - name: "{{ netbox_db_name }}" + owner: "{{ netbox_db_username }}" +``` ## Playbook - # playbook-netbox.yml +```yaml +# playbook-netbox.yml - - hosts: netbox.example.com - gather_facts: yes - become: yes +- hosts: netbox.example.com + gather_facts: yes + become: yes - roles: - - role: geerlingguy.postgresql - - role: geerlingguy.redis - - role: jvoss.netbox - - role: caddy_ansible.caddy_ansible + roles: + - role: geerlingguy.postgresql + - role: geerlingguy.redis + - role: jvoss.netbox + - role: caddy_ansible.caddy_ansible +``` ## Notes diff --git a/README.md b/README.md index 2c5e27f..227a368 100644 --- a/README.md +++ b/README.md @@ -8,33 +8,38 @@ https://img.shields.io/badge/Netbox-v3.2.1-blue)](https://github.com/netbox-comm [![Ansible Quality Score](https://img.shields.io/ansible/quality/56786?color=blue)](https://galaxy.ansible.com/jvoss/netbox) [![Version](https://img.shields.io/github/release/jvoss/ansible-role-netbox.svg)](https://github.com/jvoss/ansible-role-netbox/releases/) -Installs and configures [Netbox](https://github.com/netbox-community/netbox) on -RHEL/CentOS or Ubuntu servers. +Installs, configures and maintains [NetBox](https://github.com/netbox-community/netbox) ## Requirements -This role manages the installation and configuration of Netbox. This role +This role manages the installation and configuration of NetBox. This role does not provide PostgreSQL or Redis services that are required dependencies of the application. Those tasks are intentionally left to allow the user to manage those services within their own roles and playbooks. Tested on the following platforms: * Amazon Linux 2 -* CentOS 8 +* CentOS 8 +* Debian Buster (up to v3.1.11) +* Debian Bullseye * Rocky Linux 8 / Red Hat Enterprise Linux (RHEL) 8.2+ * Ubuntu 20.04 This role will require root access (via sudo) to manage system dependencies and actions on behalf of netbox. +Supports NetBox versions 3+ + ## Role variables Minimum required variables assuming `localhost` PostgreSQL and Redis services are available: - netbox_db_username: netbox - netbox_db_password: netbox - netbox_secret_key: "lnvRn_5Bypl8hBV4mMwgsMuHxr6uZvGwJyDqB7fcKqo" +```yaml +netbox_db_username: netbox +netbox_db_password: netbox +netbox_secret_key: "lnvRn_5Bypl8hBV4mMwgsMuHxr6uZvGwJyDqB7fcKqo" +``` If the `netbox_secret_key` is omitted a new one will be automatically generated on each playbook run. @@ -54,10 +59,12 @@ parameters unless `netbox_override_dynamic_config` is set to `True`. See The following variables can be defined to create users during initial installation only: - netbox_superusers: - - username: admin - password: admin - email: changeme@example.com +```yaml +netbox_superusers: + - username: admin + password: admin + email: changeme@example.com +``` Each user requires a username, password and email address defined. The role will attempt to create the defined users only once during initial installation. If @@ -77,7 +84,9 @@ Coming soon. A specific version of netbox can be configured using the variable: - netbox_version_tag: v3.0.9 +```yaml +netbox_version_tag: v3.0.9 +``` This tag should match the Github tag name for the release to be installed. It will ensure that a specific target is maintained. If not set, each run will @@ -88,9 +97,11 @@ installation is maintained. Another option is to deploy from a specifc branch and optionally a specific commit SHA - netbox_install_method: git - netbox_git_branch: master - netbox_git_sha: 8f1acb700d72467ffe7ae5c8502422a1eac0693d # optional +```yaml +netbox_install_method: git +netbox_git_branch: master +netbox_git_sha: 8f1acb700d72467ffe7ae5c8502422a1eac0693d # optional +``` ## Dependencies diff --git a/tasks/install.debian.yml b/tasks/install.debian.yml index b1e4557..293dbc9 100644 --- a/tasks/install.debian.yml +++ b/tasks/install.debian.yml @@ -11,6 +11,7 @@ loop: - git - build-essential + - cron - libxml2-dev - libxslt1-dev - libffi-dev