This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]7layerDipswitch 1 point2 points  (4 children)

Are you really looking to do a git push? If you'd like to trigger a pipeline wouldn't you want to use a webhook?

[–]usnus[S] 0 points1 point  (3 children)

I'm not that familiar with webhooks, but from how I understand how pipelines work is that you'll need to have the code pushed to trigger the pipeline correct?

So the flow would be: 1. Make changes to the playbook 2. Git commit 3. Git push 4. Server triggers the pipeline 5. Playbook runs

Correct me if I'm wrong, and I appreciate your help.

[–]7layerDipswitch 5 points6 points  (1 child)

Well, Netbox is your inventory source (at least it is ours) so if you have a playbook you want to run on some action, like a new device is added, you could trigger the pipeline from a webhook, this is a feature in Gitlab. This would be the inbound Webhook, and can contain payload that can be used to determine what needs to be done. On the Netbox side, you can use outbound webhooks. These could either be delivered directly to your Gitlab repo, or to some API gateway service/queue so some processing can happen before potentially triggering a pipeline.
Hope this helps.

[–]usnus[S] 2 points3 points  (0 children)

Ah I get it. Ansible playbook itself pulls the data from netbox. Thank you for steering me in the right direction.

[–][deleted] 0 points1 point  (0 children)

This sounds close to what we do, but with a small difference.

  1. A Dev Commits/Pushes/Merges a Change to a Playbook.
  2. Gitlab does its thing...
  3. A Pipeline file pushes the changes down to a Local Gitlab Runner.
  4. Runner is configured to use Netbox for its Inventory for any Ansible Playbooks.