diff --git a/initializers/secret_roles.yml b/initializers/secret_roles.yml new file mode 100644 index 0000000..d85e719 --- /dev/null +++ b/initializers/secret_roles.yml @@ -0,0 +1,4 @@ +# - name: Super Secret Passwords +# slug: super-secret +# - name: SNMP Communities +# slug: snmp \ No newline at end of file diff --git a/initializers/tags.yml b/initializers/tags.yml new file mode 100644 index 0000000..1cbe3be --- /dev/null +++ b/initializers/tags.yml @@ -0,0 +1,12 @@ +# - name: Tag 1 +# slug: tag-1 +# color: Pink +# - name: Tag 2 +# slug: tag-2 +# color: Cyan +# - name: Tag 3 +# slug: tag-3 +# color: Grey +# - name: Tag 4 +# slug: tag-4 +# color: Teal diff --git a/startup_scripts/020_tags.py b/startup_scripts/020_tags.py new file mode 100644 index 0000000..2939e75 --- /dev/null +++ b/startup_scripts/020_tags.py @@ -0,0 +1,23 @@ +from extras.models import Tag +from utilities.choices import ColorChoices + +from startup_script_utils import load_yaml +import sys + +tags = load_yaml('/opt/netbox/initializers/tags.yml') + +if tags is None: + sys.exit() + +for params in tags: + if 'color' in params: + color = params.pop('color') + + for color_tpl in ColorChoices: + if color in color_tpl: + params['color'] = color_tpl[0] + + tag, created = Tag.objects.get_or_create(**params) + + if created: + print("🎨 Created Tag", tag.name) diff --git a/startup_scripts/310_secret_roles.py b/startup_scripts/310_secret_roles.py new file mode 100644 index 0000000..9b0e816 --- /dev/null +++ b/startup_scripts/310_secret_roles.py @@ -0,0 +1,14 @@ +from secrets.models import SecretRole +from startup_script_utils import load_yaml +import sys + +secret_roles = load_yaml('/opt/netbox/initializers/secret_roles.yml') + +if secret_roles is None: + sys.exit() + +for params in secret_roles: + secret_role, created = SecretRole.objects.get_or_create(**params) + + if created: + print("🔑 Created Secret Role", secret_role.name)