#!/bin/bash # add user with project-admin role to all projects # # Before using this script, add yourself as user with i.e. # keystone user-create --name varac --pass NSACANTGUESSTHIS --email varacanero@leap.se --enabled true ROLEID=$(keystone role-list | grep -i projectadmin | awk '{print $2}') USERID=NULL declare -a PROJECTS=('playground' 'bitmask testing' LEAP 'Bitmask clientdev' 'Bitmask development' 'Bitmask production'); for (( i = 0; i < ${#PROJECTS[@]}; i++ )) do PROJECTID=$(keystone tenant-list | grep -i "${PROJECTS[$i]}" | awk '{print $2}') for user in drebs kwadronaut micah varac elijah do USERID=$(keystone user-list | grep -i $user | awk '{print $2}') keystone user-role-add --role-id $ROLEID --user-id $USERID --tenant-id $PROJECTID done done