-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathforeman_cli.sh
37 lines (34 loc) · 932 Bytes
/
foreman_cli.sh
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
echo ""
#echo -e "\033[1mForeman CLI...Initialization.\033 \033[0m";
echo -e "\033[0;33mForeman CLI...Initialization. \033[0m";
echo ""
echo "Choose any of the options to proceed :-"
echo ""
echo "1. Create New Host."
echo ""
echo "2. Delete Existing Hosts."
echo ""
echo -n "Select your choice [1 | or | 2]?"
read version
if [ $version = 1 ]
then
echo "Enter the hostname:"
read hostname
USER="admin"
PASS="redhat"
echo ""
hammer -u admin -p redhat hostgroup list
echo -e "\nPlease enter the host id: "
read hostid
hammer -u $USER -p $PASS host create --name $hostname --compute-resource-id=2 --hostgroup-id=$hostid
hammer -u $USER -p $PASS host start --name $hostname.testlab.local
elif [ $version = 2 ]
then
echo -e "\n\t\t\t\t\t===========Hosted vm's list=========="
echo ""
hammer -u admin -p redhat host list
echo ""
echo -e "Please enter the host id: "
read hostid
hammer -u admin -p redhat host delete --id $hostid
fi