diff --git a/vars/main.yml b/vars/main.yml index f2d7d7f..369e153 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -14,8 +14,9 @@ _netbox_storages_map: sftpstorage: [] netbox_superuser_script: | - from django.contrib.auth.models import User + from django.contrib.auth import get_user_model from base64 import b64decode + User = get_user_model() password = b64decode("{{ netbox_superuser_password | b64encode }}").decode("UTF-8") query = User.objects.filter(username="{{ netbox_superuser_username }}") if not query.exists(): @@ -33,7 +34,8 @@ netbox_superuser_script: | netbox_superuser_token: | from users.models import Token - from django.contrib.auth.models import User + from django.contrib.auth import get_user_model + User = get_user_model() user = User.objects.get(username="{{ netbox_superuser_username }}") query = Token.objects.filter(user=user) if not query.exists():