File: Add_User.sh

package info (click to toggle)
ilorest 7.0.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,884 kB
  • sloc: python: 36,313; sh: 2,853; javascript: 482; makefile: 189; ansic: 186; lisp: 137
file content (56 lines) | stat: -rw-r--r-- 2,135 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash

#    RESTful Interface Tool Sample Script for HPE iLO Products    #
#  Copyright 2014, 2020 Hewlett Packard Enterprise Development LP #

#      Description: This is a sample bash script to add an iLO    #
#                   account to the server either locally or       #
#                   remotely using the RESTful Interface Tool.    #

#      Note: In order to use this script remotely include the     #
#            iLO URL you wish to perform the operation on along   #
#            with valid iLO credentials for that system in the    #
#            command line otherwise it will be ran locally.       #
#            Usage: Add_User.bat 10.0.0.100 username password     #
#                                                                 #
#            You will need to replace NEWUSERNAME,                #
#            NEWACCOUNTNAME, and PASSWORD with values that are    #
#            appropriate for your environment.                    #
#                                                                 #
#            This script was designed to be ran with iLOREST 2.0  #
#            or greater. Note some account privileges are only    #
#            available on later iLO firmware versions.            #

#      Firmware supported for iLOREST 2.3 and greater:            #
#          iLO 4 version 2.10 and greater                         #
#          iLO 5 all versions                                     #
#      Firmware supported for iLOREST 2.0 to 2.2:                 #
#          iLO 4 version 2.00 and greater                         #
#          iLO 5 all versions                                     #

runLocal()
{
  ilorest iloaccounts add NEWUSERNAME NEWACCOUNTNAME PASSWORD
  ilorest logout
}

runRemote()
{
  ilorest iloaccounts add NEWUSERNAME NEWACCOUNTNAME PASSWORD --url=$1 --user $2 --password $3
  ilorest logout
}

error()
{
  echo "Usage:"
  echo        "remote: Add_User.sh ^<iLO url^> ^<iLO username^>  ^<iLO password^>"
  echo        "local:  Add_User.sh"
}

if [ "$#" -eq "3" ]; then 
    runRemote "$1" "$2" "$3"
elif [ "$#" -eq "0" ]; then
    runLocal
else
    error
fi