@@ -57,7 +57,7 @@ This ensures stale objects are removed from NetBox keeping an accurate current s
5757yum install python36-pip
5858```
5959
60- ## Ubuntu 18.04 & 20.04
60+ ## Ubuntu 18.04 & 20.04 && 22.04
6161``` shell
6262apt-get update && apt-get install python3-venv
6363```
@@ -83,52 +83,14 @@ The `vsphere-automation-sdk` must be installed if tags should be synced from vCe
8383pip install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git
8484```
8585
86- ## Docker
87-
88- Run the application in a docker container. You can build it yourself or use the ones from docker hub.
89-
90- Available here: [ bbricardo/netbox-sync] ( https://hub.docker.com/r/bbricardo/netbox-sync )
91-
92- * The application working directory is ``` /app ```
93- * Required to mount your ``` settings.ini ```
94-
95- To build it by yourself just run:
96- ``` shell
97- docker build -t bbricardo/netbox-sync:latest .
98- ```
99-
100- To start the container just use:
101- ``` shell
102- docker run --rm -it -v $( pwd) /settings.ini:/app/settings.ini bbricardo/netbox-sync:latest
103- ```
104-
105- ## Kubernetes
106-
107- Run the containerized application in a kubernetes cluster
108-
109- * Build the container image
110- * Tag and push the image to a container registry you have access to
111- * Create a secret from the settings.ini
112- * Update the image field in the manifest
113- * Deploy the manifest to your k8s cluster and check the job is running
114-
115- ``` shell
116- docker build -t netbox-vsphere-sync .
117- docker image tag netbox-vsphere-sync your-registry.host/netbox-vsphere-sync:latest
118- docker image push your-registry.host/netbox-vsphere-sync:latest
119-
120- kubectl create secret generic netbox-vsphere-sync --from-file=settings.ini
121- kubectl apply -f netbox-vsphere-sync-cronjob.yaml
122- ```
123-
12486## NetBox API token
12587In order to updated data in NetBox you need a NetBox API token.
12688* API token with all permissions (read, write) except:
12789 * auth
12890 * secrets
12991 * users
13092
131- A short description can be found [ here] ( https://netbox.readthedocs.io /en/stable/rest-api/authentication/ )
93+ A short description can be found [ here] ( https://docs. netbox.dev /en/stable/integrations/ rest-api/# authentication )
13294
13395# Running the script
13496
@@ -138,7 +100,7 @@ usage: netbox-sync.py [-h] [-c settings.ini [settings.ini ...]] [-g]
138100
139101Sync objects from various sources to NetBox
140102
141- Version: 1.4.0-beta2 (2023-02-19 )
103+ Version: 1.5.0 (2023-03-20 )
142104Project URL: https://github.com/bb-ricardo/netbox-sync
143105
144106options:
@@ -252,6 +214,64 @@ In Order to sync all items regularly you can add a cron job like this one
252214 23 */2 * * * /opt/netbox-sync/.venv/bin/python3 /opt/netbox-sync/netbox-sync.py >/dev/null 2>&1
253215```
254216
217+ ## Docker
218+
219+ Run the application in a docker container. You can build it yourself or use the ones from docker hub.
220+
221+ Available here: [ bbricardo/netbox-sync] ( https://hub.docker.com/r/bbricardo/netbox-sync )
222+
223+ * The application working directory is ``` /app ```
224+ * Required to mount your ``` settings.ini ```
225+
226+ To build it by yourself just run:
227+ ``` shell
228+ docker build -t bbricardo/netbox-sync:latest .
229+ ```
230+
231+ To start the container just use:
232+ ``` shell
233+ docker run --rm -it -v $( pwd) /settings.ini:/app/settings.ini bbricardo/netbox-sync:latest
234+ ```
235+
236+ ## Kubernetes
237+
238+ Run the containerized application in a kubernetes cluster
239+
240+ * Create a config map with the default settings
241+ * Create a secret witch only contains the credentials needed
242+ * Adjust the provided [ cronjob resource] ( https://github.com/bb-Ricardo/netbox-sync/blob/main/k8s-netbox-sync-cronjob.yaml ) to your needs
243+ * Deploy the manifest to your k8s cluster and check the job is running
244+
245+ config example saved as ` settings.yaml `
246+ ``` yaml
247+ netbox :
248+ host_fqdn : netbox.example.com
249+
250+ source :
251+ my-vcenter-example :
252+ type : vmware
253+ host_fqdn : vcenter.example.com
254+ permitted_subnets : 172.16.0.0/12, 10.0.0.0/8, 192.168.0.0/16, fd00::/8
255+ cluster_site_relation : Cluster_NYC = New York, Cluster_FFM.* = Frankfurt, Datacenter_TOKIO/.* = Tokio
256+ ` ` `
257+
258+ secrets example saved as ` secrets.yaml`
259+ ` ` ` yaml
260+ netbox:
261+ api_token: XYZXYZXYZXYZXYZXYZXYZXYZ
262+ source:
263+ my-vcenter-example:
264+ username: vcenter-readonly
265+ password: super-secret
266+ ` ` `
267+
268+ Create resource in your k8s cluster
269+ ` ` ` shell
270+ kubectl create configmap netbox-sync-config --from-file=settings.yaml
271+ kubectl create secret generic netbox-sync-secrets --from-file=secrets.yaml
272+ kubectl apply -f k8s-netbox-sync-cronjob.yaml
273+ ` ` `
274+
255275# How it works
256276**READ CAREFULLY**
257277
0 commit comments