Introduction : This article provides a script and steps to create multiple users that need to login to Airwave.
This article uses a CSV file to accomplish the task.
Create a CSV file with the rows and columns as mentioned in the image below.
The role ID can be determined by navigating to the AMP Setup-->Roles page and clicking on a particular role.
On the role page look into the URL for the role ID.
For example: By clicking on the pencil symbol for admin role I get the following URL information.
Here the role ID for admin role is 9.
This same ID is to be used in the CSV file.
Copy the CSV file to the /tmp directory.
Below is a script that needs to copied to /tmp directory using winScp or filezilla.
while read line
password=$(echo $line | cut -d, -f2)
hashpassword=$(echo -n "dgc$password" | md5sum | cut -d ' ' -f1)
newline=$(echo $line | sed -e 's/'$password'/'$hashpassword'/')
/opt/airwave/pgsql/bin/psql -Uairwave airwave -c "insert into users(username,password,role_id,full_name,email,phone,notes,password_format) values ('$(echo $newline | sed -e "s/,/','/g")');"
Run the script using following command:
# ./script < <Name of imported csv file>
This script has been tested on Airwave version 7.7.4
Please consult with Aruba TAC before executing the script.