Skip to content
Snippets Groups Projects
Commit b8eed86e authored by Fabian Herbert's avatar Fabian Herbert
Browse files

fix makefile, Netbox starts now

parent 7885d6be
Branches
No related tags found
1 merge request!1258Inventory Manager with Netbox
Pipeline #283631 failed
...@@ -8,7 +8,8 @@ TARGET_DIR=../../../gosdn/internal/netboxapi ...@@ -8,7 +8,8 @@ TARGET_DIR=../../../gosdn/internal/netboxapi
NETBOX_VERSION=4.2.8 NETBOX_VERSION=4.2.8
NETBOX_DOCKER_VERSION=3.2.0 NETBOX_DOCKER_VERSION=3.2.0
GOIMPORTS := $(shell go env GOPATH)/bin/goimports GOIMPORTS := $(shell go env GOPATH)/bin/goimports
USER_NAME := fabii USER_NAME := fabi
CONFIG_DIR=../../applications/inventory-manager-netbox/config/configNetbox.yaml
.PHONY: reset .PHONY: reset
...@@ -95,7 +96,6 @@ build: ...@@ -95,7 +96,6 @@ build:
goimports -w $$(find . -name '*.go') goimports -w $$(find . -name '*.go')
.PHONY: copy .PHONY: copy
copy: copy:
@echo ">> Copying generated API to $(TARGET_DIR)..." @echo ">> Copying generated API to $(TARGET_DIR)..."
...@@ -116,9 +116,9 @@ clean: ...@@ -116,9 +116,9 @@ clean:
.PHONY: netboxstarten .PHONY: netboxstarten
netboxstarten: netboxstarten:
@echo ">> PULL NetBox Docker with..." @echo ">> PULL NetBox Docker with..."
cd ../../../netbox-docker && docker compose pull -d cd ../../../netbox-docker && docker compose pull
@echo ">> UP NetBox Docker with..." @echo ">> UP NetBox Docker with..."
cd ../../../netbox-docker && docker compose up -d cd ../../../netbox-docker && docker compose up
@echo ">> NetBox Docker started." @echo ">> NetBox Docker started."
@echo ">> http://127.0.0.1:8000/ @echo ">> http://127.0.0.1:8000/
...@@ -129,7 +129,7 @@ netboxsuperuser: ...@@ -129,7 +129,7 @@ netboxsuperuser:
cd ../../../netbox-docker && docker compose exec netbox /opt/netbox/netbox/manage.py createsuperuser --username $(USER_NAME) --email $(USER_NAME)@example.com cd ../../../netbox-docker && docker compose exec netbox /opt/netbox/netbox/manage.py createsuperuser --username $(USER_NAME) --email $(USER_NAME)@example.com
.PHONY: netboxToken .PHONY: netboxToken
netboxToken: netboxToken:
@echo ">> Creating API token for user '$(USER_NAME)'..." @echo ">> Creating API token for user '$(USER_NAME)'..."
docker compose -f ../../../netbox-docker/docker-compose.yml exec netbox /opt/netbox/netbox/manage.py shell -c "\ docker compose -f ../../../netbox-docker/docker-compose.yml exec netbox /opt/netbox/netbox/manage.py shell -c "\
...@@ -142,6 +142,7 @@ print(token.key)" > .tmp_token.txt && \ ...@@ -142,6 +142,7 @@ print(token.key)" > .tmp_token.txt && \
TOKEN=$$(tail -n1 .tmp_token.txt) && \ TOKEN=$$(tail -n1 .tmp_token.txt) && \
rm .tmp_token.txt && \ rm .tmp_token.txt && \
mkdir -p ../../applications/inventory-manager-netbox/config && \ mkdir -p ../../applications/inventory-manager-netbox/config && \
echo "NetboxAddress: \"127.0.0.1:8000\"" > ../../applications/inventory-manager-netbox/config/configNetbox.yaml && \ echo "NetboxAddress: \"127.0.0.1:8000\"" > $(CONFIG_DIR) && \
echo "ApiToken: \"$$TOKEN\"" >> ../../applications/inventory-manager-netbox/config/configNetbox.yaml && \ echo "ApiToken: \"$$TOKEN\"" >> $(CONFIG_DIR) && \
echo "✅ Token written to configNetbox.yaml" echo "Token written to configNetbox.yaml complete"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment