Skip to content

Commit

Permalink
NetBox 2.5 release (#40)
Browse files Browse the repository at this point in the history
Merge branch 'feature/netbox-2.5' into master
  • Loading branch information
lae committed Dec 11, 2018
2 parents 61a2c89 + b841044 commit 5305ecb
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 45 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Deploys and configures DigitalOcean's [NetBox].
This role will deploy NetBox within its own virtualenv either by release tarball
or via git using uWSGI as the application server.

Tested and supported against CentOS 7/Debian 8 and 9/Ubuntu 16.
Tested and supported against CentOS 7/Debian 9/Ubuntu 16 and 18.

Note that this role is slightly opinionated and differs from installation
instructions from the NetBox documentation. The main differences are:
Expand Down Expand Up @@ -74,7 +74,7 @@ tells the role to deploy by extracting tarball releases from GitHub, while
`netbox_git` tells the role to clone a NetBox git repository - they're mutually
exclusive.

netbox_stable_version: 2.4.7
netbox_stable_version: 2.5.0
netbox_stable_uri: "https://github.com/digitalocean/netbox/archive/v{{ netbox_stable_version }}.tar.gz"

These can be configured to pin a version (e.g. increment to trigger an upgrade)
Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# defaults file for lae.netbox
netbox_stable: false
netbox_stable_version: 2.4.7
netbox_stable_version: 2.5.0
netbox_stable_uri: "https://github.com/digitalocean/netbox/archive/v{{ netbox_stable_version }}.tar.gz"

netbox_git: false
Expand Down
2 changes: 2 additions & 0 deletions examples/netbox_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ netbox_config:
- console
level: INFO
LOGIN_REQUIRED: yes
LOGIN_TIMEOUT: 1209600
MAINTENANCE_MODE: False
MAX_PAGE_SIZE: 500
MEDIA_ROOT: /srv/netbox_media
Expand All @@ -63,6 +64,7 @@ netbox_config:
PASSWORD: redisisfun
DATABASE: 0
DEFAULT_TIMEOUT: 300
SESSION_FILE_PATH: "{{ netbox_shared_path }}/sessions"
# quotes aren't necessary as you can see - but in my opinion quotes make this more readable
SHORT_DATE_FORMAT: 'Y-m-d'
SHORT_DATETIME_FORMAT: 'Y-m-d H:i'
Expand Down
1 change: 0 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ galaxy_info:
- name: Debian
versions:
- stretch
- jessie
- name: EL
versions:
- 7
Expand Down
3 changes: 1 addition & 2 deletions tasks/deploy_netbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
requirements: "{{ netbox_current_path }}/requirements.txt"
extra_args: "-c {{ netbox_current_path }}/constraints.txt"
virtualenv: "{{ netbox_virtualenv_path }}"
virtualenv_python: "{{ netbox_python_binary }}"
virtualenv_command: "{{ netbox_python_binary }} -m venv"
become: True
become_user: "{{ netbox_user }}"

- name: Install django-rq if webhooks enabled
pip:
name: "django-rq"
virtualenv: "{{ netbox_virtualenv_path }}"
virtualenv_python: "{{ netbox_python_binary }}"
become: True
become_user: "{{ netbox_user }}"
when:
Expand Down
16 changes: 16 additions & 0 deletions tasks/install_packages_yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,19 @@
- "{{ netbox_ldap_packages if netbox_ldap_enabled else [] }}"
- "{{ 'git' if netbox_git else [] }}"
- "{{ 'acl' if ('SUDO_USER' in ansible_env and ansible_env.SUDO_USER != 'root') else [] }}"

# python3 pip package not available on EPEL.
- name: Ensure pip is available on Red Hat-based distros
shell: "{{ netbox_python_binary }} -m pip -V || {{ netbox_python_binary }} -m ensurepip"
register: _existence_of_pip
changed_when: "'Successfully installed pip' in _existence_of_pip.stdout"

# python3 psycopg2 packages are not available on EPEL.
- name: Install psycopg2 via pip on Red Hat-based distros
pip:
name: psycopg2
state: latest
vars:
ansible_python_interpreter: "{{ netbox_python_binary }}"
environment:
PATH: "/usr/local/bin:{{ _path }}"
10 changes: 7 additions & 3 deletions tasks/load_variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
netbox_ldap_packages: "{{ _netbox_ldap_packages | list }}"
when: netbox_ldap_packages is not defined

- name: Determine whether to switch Ansible's interpreter
- name: Identify current execution PATH
shell: "echo $PATH"
register: _path_exec
changed_when: false

- name: Set a fact for current execution PATH
set_fact:
netbox_switch_ansible_python: "{{ _netbox_switch_ansible_python | default(True) }}"
when: netbox_switch_ansible_python is not defined
_path: "{{ _path_exec.stdout }}"
10 changes: 2 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
- name: Switch Ansible's Python interpreter to Python 3
set_fact:
ansible_python_interpreter: "{{ netbox_python_binary }}"
when: netbox_switch_ansible_python

- name: Install virtualenv via pip
pip:
name: virtualenv
state: latest
executable: /usr/bin/pip3

- name: Create NetBox user group
group:
Expand Down Expand Up @@ -55,7 +48,8 @@
pip:
name: uwsgi
state: latest
executable: /usr/bin/pip3
environment:
PATH: "/usr/local/bin:{{ _path }}"
notify:
- reload netbox.service

Expand Down
20 changes: 0 additions & 20 deletions vars/debian-8.yml

This file was deleted.

1 change: 1 addition & 0 deletions vars/debian-9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ _netbox_packages:
_netbox_python_packages:
- python3.5
- python3.5-dev
- python3-venv
- python3-pip
- python3-psycopg2 # used by ansible's postgres modules
_netbox_python_binary: /usr/bin/python3.5
Expand Down
12 changes: 4 additions & 8 deletions vars/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ _netbox_packages:
- graphviz
- openssl-devel
_netbox_python_packages:
- python34
- python34-devel
- python34-setuptools
- python34-pip
- python-setuptools # used by ansible's pip module
- python-psycopg2 # used by ansible's postgres modules
_netbox_switch_ansible_python: False
_netbox_python_binary: /usr/bin/python3.4
- python36
- python36-devel
- python36-setuptools
_netbox_python_binary: /usr/bin/python3.6
_netbox_ldap_packages:
- openldap-devel
1 change: 1 addition & 0 deletions vars/ubuntu-16.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ _netbox_python_packages:
- python3.5
- python3.5-dev
- python3-pip
- python3-venv
- python3-psycopg2 # used by ansible's postgres modules
_netbox_python_binary: /usr/bin/python3.5
_netbox_ldap_packages:
Expand Down
1 change: 1 addition & 0 deletions vars/ubuntu-18.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ _netbox_python_packages:
- python3.6
- python3.6-dev
- python3-pip
- python3-venv
- python3-psycopg2 # used by ansible's postgres modules
_netbox_python_binary: /usr/bin/python3.6
_netbox_ldap_packages:
Expand Down

0 comments on commit 5305ecb

Please sign in to comment.