gmazoyer.netbox

CI Ansible Galaxy

Ansible 角色:NetBox

一个在 Debian/Ubuntu 上安装的 Ansible 角色。

该角色安装 NetBox 所需的所有依赖项,包括 PostgreSQL 数据库。因此,它可以用来在同一台机器上设置一个完整的 NetBox 设备。

如果您已有自己的后台和前台处理方式,可以禁用它们的设置。

依赖项

无。

角色变量

可用变量如下所示,连同默认值:

PostgreSQL 数据库的设置:

netbox_database: netbox
netbox_database_user: netbox
netbox_database_password: netbox
netbox_database_host: localhost # 这将强制设置 PostgreSQL

获取 NetBox 的位置和版本:

netbox_version: latest
netbox_git_url: https://github.com/netbox-community/netbox.git

默认情况下,它将始终获取最新的稳定版本。可以使用特定版本,例如 v3.5.1 来强制指定版本。

NetBox 的安装位置:

netbox_install_directory: /opt/netbox

超级用户的用户名、密码和邮箱。

netbox_superuser_username: admin
netbox_superuser_password: admin
netbox_superuser_email: admin@example.com

LDAP 可以用作认证机制。必须启用,并且整个 LDAP 配置必须在以下变量中提供(参见 NetBox 文档):

netbox_setup_ldap_auth: false
netbox_ldap_config: ""

其他 Python 包可以通过 local_requirements.txt 安装,这对安装 NAPALM 或插件等包很有用:

netbox_local_requirements:
  - napalm

NetBox 的配置必须作为 key: value 键值对提供,如下所示,请注意,不需要给出密钥,因为它会自动生成:

netbox_config:
  ALLOWED_HOSTS:
    - localhost
    - 127.0.0.1
  TIME_ZONE: "Europe/Paris"

清理命令使用在 UTC 时间每天早上 4:30 配置的 systemd 定时器运行。您可以使用 on_unit_active_sec: 12h 替代 on_calendar ,例如每 12 小时运行一次清理命令。

netbox_systemd_timers:
  netbox-housekeeping:
    enabled: true
    command: "{{ netbox_virtualenv_path }}/bin/python {{ netbox_install_directory }}/netbox/manage.py housekeeping"
    on_calendar: "*-*-* 4:30:00 UTC"

后端 Web 服务器和 systemd 的配置:

netbox_setup_systemd: false
netbox_gunicorn_address: 127.0.0.1
netbox_gunicorn_port: 8001
netbox_gunicorn_workers_number: 5

是否配置前端 Web 服务器:

netbox_setup_web_frontend: false

前端 Web 服务器的 SSL/TLS 配置:

netbox_web_tls: false
netbox_web_tls_port: 443
# netbox_web_tls_crt: /etc/pki/server.crt
# netbox_web_tls_key: /etc/pki/server.key
# netbox_web_tls_chain:
netbox_web_tls_redirect: false

示例 Playbook

- hosts: netboxes
  roles:
    - { role: gmazoyer.netbox }

许可证

该 Ansible 角色基于 GNU GPLv3 的条款发布。有关更多信息,请阅读 LICENSE 文件。

该角色的部分内容包括 MIT 许可证的代码(见 7c400dd),在头部有标记。有关更多信息,参见 LICENSE-MIT

作者信息

该角色由 Guillaume Mazoyer 于 2017 年创建。

安装
ansible-galaxy install gmazoyer.netbox
许可证
gpl-3.0
下载
825
拥有者
Network/Automation Engineer (AS201281, former AS35280, AS29467, AS2602). Former 3 times GSoC student. IPv6 lover, FLOSS enthusiast and Gamer.