Skip to content

Commit 2ee4654

Browse files
Merge pull request #8 from netboxlabs/doc-branch
Doc branch
2 parents e31e4eb + 5d90fa5 commit 2ee4654

File tree

58 files changed

+538
-587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+538
-587
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,6 @@ vms.yml.*
171171

172172
inventory
173173
tests/
174+
175+
app_config.yml
176+

README.md

Lines changed: 523 additions & 582 deletions

example-netbox-webhook-flask-app/app.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525
description="NetBox-Proxmox Webhook Listener")
2626
ns = api.namespace(app_config['netbox_webhook_name'])
2727

28+
# set debug (enabled/disabled)
29+
DEBUG = False
30+
31+
if app.debug:
32+
DEBUG = True
33+
34+
2835
APP_NAME = "netbox-proxmox-webhook-listener"
2936

3037
logger = logging.getLogger(APP_NAME)
@@ -58,9 +65,10 @@ def post(self):
5865
if not webhook_json_data or "model" not in webhook_json_data or "event" not in webhook_json_data:
5966
return {"result":"invalid input"}, 400
6067

61-
print("INCOMING DATA FOR WEBHOOK", webhook_json_data)
68+
if DEBUG:
69+
print("INCOMING DATA FOR WEBHOOK", webhook_json_data)
6270

63-
tc = NetBoxProxmoxHelper(app_config)
71+
tc = NetBoxProxmoxHelper(app_config, webhook_json_data['data']['custom_fields']['proxmox_node'])
6472

6573
if webhook_json_data['event'] == 'created' and webhook_json_data['model'] == 'virtualmachine' and webhook_json_data['data']['status']['value'] == 'staged':
6674
tc.proxmox_clone_vm(webhook_json_data)

example-netbox-webhook-flask-app/app_config.yml-sample

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
netbox_webhook_name: "netbox-proxmox-webhook"
22

33
proxmox_api_config:
4-
node: proxmox-ve
54
api_host: proxmox-ip-or-hostname
65
api_port: 8006
76
api_user: proxmox_api_user

example-netbox-webhook-flask-app/helpers/netbox_proxmox.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from proxmoxer import ProxmoxAPI
66

77
class NetBoxProxmoxHelper:
8-
def __init__(self, cfg_data):
8+
def __init__(self, cfg_data, proxmox_node):
99
self.netbox_api_config = {
1010
'api_proto': cfg_data['netbox_api_config']['api_proto'],
1111
'api_host': cfg_data['netbox_api_config']['api_host'],
@@ -15,7 +15,7 @@ def __init__(self, cfg_data):
1515
}
1616

1717
self.proxmox_api_config = {
18-
'node': cfg_data['proxmox_api_config']['node'],
18+
'node': proxmox_node,
1919
'api_host': cfg_data['proxmox_api_config']['api_host'],
2020
'api_port': cfg_data['proxmox_api_config']['api_port'],
2121
'api_user': cfg_data['proxmox_api_config']['api_user'],

images/awx-ansible-build-ee.png

258 KB

images/awx-create-project.png

178 KB

images/awx-default-inventory.png

135 KB
930 KB
756 KB

0 commit comments

Comments
 (0)