Netbox IPAM DCIM

for me, i really dont understand what ansible is, and what best describe its use cases, i have been reading, but still coming out blank.
can you shed some light

Ansible is a radically simple IT automation engine

Tried the steps to update netbox but get an error:

I think you need another “signal-event nethserver-docker-update” to restore the docker firewall rules…

Yes, looks good now. Testing the Autostart now…

1 Like

Would you please add it to the howto?

I can confirm this works :grinning: :+1: - Thank you…

1 Like

i see instructions for Ldap here 6. LDAP (Optional) - NetBox Documentation

Not in front of pc now but I wikified the howto so you should be able to edit too…

1 Like

OK, will do it…

1 Like

i think matrix synapse uses a similar ldap django module to enable ldap login, or am i wrong?
it htis case, would it be installed via the docker, or just in Nethserver, and it should work.

with the other netbox plugins too, should they be installed inside the docker, or just in Nethserver and they will be pulled into the docker image. not sure

no need for?

sorry forget it…

@mrmarkuz Can we also integrate/run ansible on Nethserver-docker together with netbox?

Please take a look: Ansible inside Docker for consistent running of ansible inside your local machine or CI/CD system.

Yes, just run use the “docker run” commands to get it.
The question is how to connect ansible with netbox…

Ansible should be able to connect the netbox API and get the inventory data from it… I dont know if this is possible from one docker-container to the other?

That should be possible if we add the ansible container to the aqua network too.

1 Like

OK this looks good:

I have to test a few playbooks and later on the connection to the netbox-API… Will do it on afternoon / evening. Thank you!

1 Like

I think this will be a problem because the container is created on the fly. After a disconnect I will lose all my customisation (playbooks)…

Is there another way to get a sustainable container?

Got a hint from the netbox-developer how to use Netbox data as a source of inventory information for Ansible; and/or how to trigger Ansible provisioning actions from Netbox:

To do the first of these, you’d install Ansible on some host somewhere (your management station), and configure it to use the Netbox Ansible inventory plugin. You don’t need to install Ansible on the same host or container as Netbox, because Ansible talks to Netbox over the network using its REST API.

Once you have Ansible installed on a host you can install the plugin using ansible-galaxy collection install netbox.netbox

Then you can create an inventory file netbox.yaml that might look something like this:

plugin: netbox.netbox.nb_inventory
api_endpoint: https://netbox.example.com/
token: XXXXXXXX
validate_certs: True
group_by:
  - sites
  - device_roles
  - tags
#query_filters:
#  - tag: ansible

Test this using ansible-inventory -v --list -i netbox.yaml, and when it’s working add the following to ansible.cfg:

[defaults]
inventory = netbox.yaml

[inventory]
enable_plugins = netbox, ini

At this point you should be able to do ansible -m ping all and it will take use the devices/VMs in Netbox as a list of hosts.

To take the second point: if you want to trigger dynamic provisioning actions from changes to Netbox, then you probably want to use Netbox webhooks. As a target for these you could look at Ansible Tower (a.k.a. AWX), which is basically a web frontend to Ansible.

I haven’t tried integrating the two; I expect you’d have to write a webhook template. Again, because Tower runs on its own server, there’s no need for it to be installed on the same host as Netbox.

1 Like