The error message you're receiving, "The user admin in the administrators group is required," seems to indicate that the user account making the POST request doesn't have the necessary administrative privileges to perform the actions in the script. You mentioned that the user account has the "Account Administrator" role, but it appears that there might be additional roles or permissions required to create templates and perform related actions in the Aruba Central environment.
Here are a few steps you can take to address this issue:
-
Verify Administrative Privileges: Double-check whether the "Account Administrator" role has all the necessary permissions for creating templates and performing related actions. There might be specific permissions related to templates or device configuration that need to be enabled.
-
Check API Permissions: Verify whether the user account's role has API permissions enabled. Some actions might require specific API permissions to be granted in addition to role-based permissions.
-
Contact Aruba Support: If you're certain that the user account's role and permissions are configured correctly, it might be helpful to reach out to Aruba support. They can provide specific guidance on the required permissions and roles for the actions you're trying to perform using the API.
-
Debugging the Error Message: Sometimes, error messages can be a bit misleading or not entirely informative. If possible, try to dig deeper into the API response and see if there's more detailed information about the specific permission that's missing or the context of the error.
-
Documentation and Examples: Review the official Aruba Central API documentation and examples related to creating templates. They might provide insights into any additional requirements or permissions needed for successful template creation.
-
Testing with Different Role: As a troubleshooting step, you could temporarily elevate the user account's role to a higher administrative level (if possible) to see if the script works with those additional privileges. This can help narrow down whether it's a permissions issue or if there might be a configuration problem specific to the "Account Administrator" role.
Ultimately, Aruba support or documentation will likely provide the most accurate guidance for resolving this issue, as they would have insights into the specific permissions and roles required for the actions you're trying to perform.
Original Message:
Sent: Jul 26, 2023 03:42 PM
From: Gonzo
Subject: Creating template in Aruba Central with Pycentral
In the variable file I included _sys_serial
and _sys_lan_mac
, and have been receiving the following error:
'code': 400, 'msg': ['The user admin in the administrators group is required.']
Confirmed the user account that is sending the POST has the following role configured:
'role': 'Account Administrator'
Is there a separate role that needs to be configured for the below script to succeed?
from pycentral.base import ArubaCentralBasefrom pycentral.configuration import Templatescentral = ArubaCentralBase(central_info=central_info, ssl_verify=True)# Create Templates instancetemplates = Templates()# Parameters for creating a new templategroup_name = "new-group"template_name = "test-temp"template_filename = ".\Template_vars.csv"device_type = "CX" # Default is 'IAP'version = "<version>" # Default is 'ALL'model = "<model>" # Default is 'ALL'# Create a new templateresponse = templates.create_template( conn=central, group_name=group_name, template_name=template_name, template_filename=template_filename, device_type=device_type,)# Check the responseif 'code' in response and response['code'] == 'SUCCESS': print(f"Template {template_name} created successfully.")else: print(f"Failed to create template {template_name}. Response: {response}")