Ansible role for deploying NetBox

1,087 views
Skip to first unread message

Musee Ullah

unread,
Aug 2, 2017, 5:50:40 PM8/2/17
to NetBox
Hi all,

A while back I wrote an Ansible role for deploying NetBox/keeping NetBox updated. You can find it on Galaxy as lae.netbox:

https://galaxy.ansible.com/lae/netbox/

For those who might be relatively new to Ansible and/or want a quick way of deploying a demo instance, there's a playbook for quickly getting started:

https://github.com/lae/ansible-role-netbox#quickstart

The role is tested to work on CentOS 7/Debian 8/Ubuntu 16 (others probably work fine too if they're using systemd) and uses a separate virtualenv/release directory for each release (which was eventually going to be used for rollback capabilities). I had to skip on config validation because of an Ansible bug I ran into, but I have an idea how to get around it so that might make it to a release soon. While the defaults are mostly sane, it's very configurable (toggles for LDAP/NAPALM integration for example).

It's been working great for the past 2 months for my department's NetBox instance (apart from the defaults, we have LDAP authentication enabled). Haven't had any issues updating at all, even to 2.1.1 today.

That said, there's probably room for improvement. I'm open to pull requests/feedback in the repository linked above if y'all have any.

Please try it out and let me know what you think. Thanks!

Ajinkya Wadekar

unread,
Jan 8, 2018, 3:51:03 PM1/8/18
to NetBox
Hi Musee,

I am using lae.netbox role to install netbox via ansible. I am successfully able to install it but I am facing an issue in migrating database from netbox-2.0.7 to the latest 2.2.8. 

Musee Ullah

unread,
Jan 9, 2018, 5:15:33 AM1/9/18
to NetBox
What's the exact error you're getting?

Musee Ullah

unread,
Jan 26, 2018, 8:02:55 AM1/26/18
to NetBox
0.4.17-beta1 deploys the 2.3-beta1 release if anyone wants to use this to test it out.

Musee Ullah

unread,
Feb 21, 2018, 6:22:58 PM2/21/18
to NetBox
Galaxy release is out for 2.2.10.

If any of y'all are using this, I'd appreciate a +1 on this PR. :P
https://github.com/digitalocean/netbox/pull/1902


On Thursday, August 3, 2017 at 6:50:40 AM UTC+9, Musee Ullah wrote:

Musee Ullah

unread,
Mar 28, 2018, 9:07:32 PM3/28/18
to NetBox
A very important v0.5.4 release has been published to Galaxy. Release notes: https://github.com/lae/ansible-role-netbox/releases/tag/v0.5.4 (0.5.x releases were cut over the past month for 2.3.x releases)

Ansible 2.5.0 brought about a change that breaks configuring permissions correctly in this role - if you've upgraded Ansible already please update this role to the latest before deploying.

If you have already run an older version of this role (<0.5.3) after updating to Ansible 2.5.0, please run a recursive `chown` on your NetBox user's home directory. If you've stuck with the defaults, running the following should resolve permission issues (most notably with the virtualenv):

    chown -R netbox: /srv/netbox/

If you're running into any problems, please open an issue in that repository.

Musee Ullah

unread,
May 29, 2018, 5:43:28 PM5/29/18
to NetBox
If anyone's interested in trying out a deployment of the develop-2.4 branch or otherwise a deployment on Ubuntu 18/Bionic, I've pushed a branch to track any changes required.


Python 2 support is dropped (it'll be unsupported in NetBox 2.5 anyway) since it's not the default and I don't think anyone is using it, but feel free to inform me otherwise and I'll reconsider.

Stephen Eaton

unread,
May 29, 2018, 8:13:21 PM5/29/18
to NetBox
Thanks for that, Ive been using this role successfully deploying to centos and looking forward to the next release. 

Musee Ullah

unread,
Oct 26, 2018, 10:24:06 AM10/26/18
to NetBox
80 days late, but - v0.6.0 is finally out!


I ended up not implementing a database backup feature since I think many environments would have a separate DB server, and having the NetBox role do setup to get a backup from that is not trivial (would basically have to reimplement a postgres role).

That being the case, be sure to backup your database before upgrading!

As usual, please report issues on Github if you run into any.

Stephen Eaton

unread,
Oct 28, 2018, 3:23:24 AM10/28/18
to Musee Ullah, NetBox

Nice one!  Thanks for your work

--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
To post to this group, send email to netbox-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/3db7d109-4e2f-43e0-8610-13f0db0afa06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Musee Ullah

unread,
Dec 11, 2018, 8:06:52 AM12/11/18
to NetBox
v0.7.0 is out to commemorate NetBox 2.5.0.


Users on CentOS or RHEL, please note the Python interpreter change from 3.4 to 3.6.

As usual, please report issues on Github if you run into any (and if anyone wants to tackle any of the open issues, let me know!).

On Wednesday, August 2, 2017 at 2:50:40 PM UTC-7, Musee Ullah wrote:

Musee Ullah

unread,
Sep 6, 2019, 11:33:28 AM9/6/19
to NetBox
A bit late due to school and all that, but v0.8.0 is out, supporting NetBox 2.6.3.

Release notes: https://github.com/lae/ansible-role-netbox/releases/tag/v0.8.0 (you may also want to check the notes for 0.7.2 and 0.7.8)

I haven't quite tested that the scripts upload via ansible feature works, but my quick perusal of that change in NetBox indicates to me that it probably does. Testers would be appreciated.

If you haven't already, I'd suggest watching for new releases on GitHub.

(On a side note, I'm thinking the role's been stable enough for a while now? Maybe it's time to bump that version up to v1.0.)
Reply all
Reply to author
Forward
0 new messages