Thursday, August 30, 2018

.::: How to Install Openstack Stein, Rocky, Quenns, Pike Using Bash Script one Push :::.

OpenStack is developed and released around 6-month cycles. After the initial release, additional stable point releases will be released in each release series. You can find the detail of the various release series here on their series page

1. Check new version openstack on this lab. openstack rocky <lastest version>
### yum install -y centos-release-openstack-rocky
### yum install -y centos-release-openstack-queens
### yum install -y centos-release-openstack-pike
https://youtu.be/NUWHKxGrjOM
2. Create file teguh_triharto_openstack.sh using vi editor and add and save
#!/bin/bash
INTERFACE_NAME=$(ip a | grep UP | grep BROADCAST | awk '{print $2}' | cut -d':' -f1 | head -n1)
IPADDRESS=$(ip r | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | tail -1)
HOST_NAME=$(hostname)
echo "$IPADDRESS   $HOST_NAME" >> /etc/hosts

echo $INTERFACE_NAME
echo $IPADDRESS

echo -e "LANG=en_US.utf-8 \nLC_ALL=en_US.utf-8" > /etc/environment
yum -y update
systemctl disable firewalld
systemctl stop firewalld
systemctl disable NetworkManager
systemctl stop NetworkManager
systemctl enable network
systemctl start network
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

echo " 2. Install Package "
yum install -y centos-release-openstack-rocky
yum update -y
yum install -y openstack-packstack
packstack --gen-answer-file=answerfile.txt

echo "3.  Configuration"
sed -i 's/CONFIG_PROVISION_DEMO=y/CONFIG_PROVISION_DEMO=n/g' answerfile.txt     # disable provisioning demo
#sed -i 's/CONFIG_CINDER_VOLUMES_SIZE=20G/CONFIG_CINDER_VOLUMES_SIZE=500G/g' answerfile.txt    # ganti 500G dengan alokasi disk untuk cinder volume sesuai kebutuhan
sed -i 's/CONFIG_HEAT_INSTALL=n/CONFIG_HEAT_INSTALL=y/g' answerfile.txt       # enable heat
sed -i 's/CONFIG_LBAAS_INSTALL=n/CONFIG_LBAAS_INSTALL=y/g' answerfile.txt     # enable lbaas
sed -i 's/CONFIG_NEUTRON_FWAAS=n/CONFIG_NEUTRON_FWAAS=y/g' answerfile.txt     # enable fwaas
sed -i 's/CONFIG_NEUTRON_VPNAAS=n/CONFIG_NEUTRON_VPNAAS=y/g' answerfile.txt   # enable vpnaas
sed -i 's/CONFIG_NEUTRON_OVS_BRIDGE_IFACES=/CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:'"$INTERFACE_NAME"'/g' answerfile.txt
sed -i 's/CONFIG_HEAT_CLOUDWATCH_INSTALL=n/CONFIG_HEAT_CLOUDWATCH_INSTALL=y/g' answerfile.txt   # enable cloudwatch

packstack --answer-file=answerfile.txt | tee progres

3. Verified script.
[root@teguht-openstack ~]# cat teguh_triharto_openstack.sh
INTERFACE_NAME=$(ip a | grep UP | grep BROADCAST | awk '{print $2}' | cut -d':' -f1 | head -n1)
IPADDRESS=$(ip r | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | tail -1)
HOST_NAME=$(hostname)
echo "$IPADDRESS   $HOST_NAME" >> /etc/hosts

echo $INTERFACE_NAME
echo $IPADDRESS

echo -e "LANG=en_US.utf-8 \nLC_ALL=en_US.utf-8" > /etc/environment
yum -y update
systemctl disable firewalld
systemctl stop firewalld
systemctl disable NetworkManager
systemctl stop NetworkManager
systemctl enable network
systemctl start network
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

echo " 2. Install Package "
yum install -y centos-release-openstack-rocky
yum update -y
yum install -y openstack-packstack
packstack --gen-answer-file=answerfile.txt

echo "3.  Configuration"
sed -i 's/CONFIG_PROVISION_DEMO=y/CONFIG_PROVISION_DEMO=n/g' answerfile.txt     # disable provisioning demo
#sed -i 's/CONFIG_CINDER_VOLUMES_SIZE=20G/CONFIG_CINDER_VOLUMES_SIZE=500G/g' answerfile.txt    # ganti 500G dengan alokasi disk untuk cinder volume sesuai kebutuhan
sed -i 's/CONFIG_HEAT_INSTALL=n/CONFIG_HEAT_INSTALL=y/g' answerfile.txt       # enable heat
sed -i 's/CONFIG_LBAAS_INSTALL=n/CONFIG_LBAAS_INSTALL=y/g' answerfile.txt     # enable lbaas
sed -i 's/CONFIG_NEUTRON_FWAAS=n/CONFIG_NEUTRON_FWAAS=y/g' answerfile.txt     # enable fwaas
sed -i 's/CONFIG_NEUTRON_VPNAAS=n/CONFIG_NEUTRON_VPNAAS=y/g' answerfile.txt   # enable vpnaas
sed -i 's/CONFIG_NEUTRON_OVS_BRIDGE_IFACES=/CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:'"$INTERFACE_NAME"'/g' answerfile.txt
sed -i 's/CONFIG_HEAT_CLOUDWATCH_INSTALL=n/CONFIG_HEAT_CLOUDWATCH_INSTALL=y/g' answerfile.txt   # enable cloudwatch

packstack --answer-file=answerfile.txt | tee progres

[root@teguht-openstack ~]#

4. Run script
# sh teguh_triharto_openstack.sh

5. Verify OpenStack status after packstack installation

# source /root/keystonerc_admin
# nova host-list
# nova service-list
# systemctl list-unit-files | grep openstack
# systemctl list-unit-files | grep openstack-heat
# openstack host list
# openstack compute service list

5. Open Browser after Installation

6. checking user login on cat /root/keystonerc_admin
[root@openstack-Teguht ~]# cat /root/keystonerc_admin
unset OS_SERVICE_TOKEN
    export OS_USERNAME=admin
    export OS_PASSWORD=3b6715f6d8f84c82
    export OS_AUTH_URL=http://10.10.10.10:5000/v2.0
    export PS1='[\u@\h \W(keystone_admin)]\$ '
  
export OS_TENANT_NAME=admin
export OS_REGION_NAME=RegionOne
    [root@openstack-Teguht ~]#
  
7. Change password admin for your request
[root@openstack-Teguht ~]# cat /root/keystonerc_admin
unset OS_SERVICE_TOKEN
    export OS_USERNAME=admin
#    export OS_PASSWORD=3b6715f6d8f84c82
export OS_PASSWORD=admin
    export OS_AUTH_URL=http://10.10.10.10:5000/v2.0
    export PS1='[\u@\h \W(keystone_admin)]\$ '
  
export OS_TENANT_NAME=admin
export OS_REGION_NAME=RegionOne
  
[root@openstack-Teguht ~]# 


No comments:

Post a Comment

Popular Posts