Mudahnya Installasi OpenStack menggunakan PackStack secara Automatisasi



Packstack is a utility that uses Puppet modules to deploy various parts of OpenStack on multiple pre-installed servers over SSH automatically. Currently only CentOS, Red Hat Enterprise Linux (RHEL) and compatible derivatives of both are supported. (https://wiki.openstack.org/wiki/Packstack)

Pada kesempatan kali ini, Saya akan menginstall openstack versi ocata mengunakan tool deployment PackStack. Packstack adalah salah satu tool yang sangat simple untuk mendeploy openstack, namun kali ini Saya akan membuat script bash untuk proses installasinya, supaya lebih cepat dan tidak mengulangi pekerjaan yang sama secara berulangkali, maka Saya mencoba untuk membuat tool script automation untuk installasi Packstack.

Konfigurasi Dasar mesin AIO Openstack
Hostname = openstack
IP address
eth0 = 192.168.74.74/24 (network Management )
eth1 = 192.168.93.74/24 (network publik untuk instance)
File bash script untuk deployment openstack dengan nama aio-openstack.sh, kalian tinggal copy-paste saja script ini.

#!/usr/bin/env bash

##### Host Resolver #####
grep openstack /etc/hosts > /dev/null 2>&1 || echo "192.168.74.74 openstack" >> /etc/hosts



##### Repositories #####
echo -n "Installing repo openstack ocata.... " && yum -y install centos-release-openstack-ocata.noarch > /dev/null 2>&1 && echo "done"
echo -n "installing repo epel-7... " && yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm > /dev/null 2>&1 && echo "done"
echo -n "Update Repo... " && yum -y update > /dev/null 2>&1 && echo "done"


##### NTP #####
echo -n "Installing chrony for NTP..." && yum -y install chrony > /dev/null 2>&1 && echo "done"
systemctl enable chronyd.service
systemctl restart chronyd.service
systemctl status chronyd.service


##### Firewall #####
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service


##### Disable NetworkManager #####
systemctl disable NetworkManager.service
systemctl stop NetworkManager.service
systemctl status NetworkManager.service
systemctl enable network.service
systemctl restart network.service
systemctl status network.service

##### Paket Utilities #####
echo -n "Installing Packet Utilities" && yum -y install vim wget screen crudini htop > /dev/null 2>&1 && echo "done"


##### Paket Packstack #####
echo -n "Installing Packstack... " && yum -y install openstack-packstack > /dev/null 2>&1 && echo "done"
rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc

##### Generate Answer File Packstack #####
echo -n "Generate answer file... " && packstack --gen-answer-file=aio-openstack.txt > /dev/null 2>&1 && echo "done"

sed -i 's/CONFIG_CINDER_INSTALL\=y/CONFIG_CINDER_INSTALL\=n/g' aio-openstack.txt
sed -i 's/CONFIG_SWIFT_INSTALL\=y/CONFIG_SWIFT_INSTALL\=n/g' aio-openstack.txt
sed -i 's/CONFIG_HEAT_INSTALL\=n/CONFIG_HEAT_INSTALL\=y/g' aio-openstack.txt
sed -i 's/CONFIG_LBAAS_INSTALL\=n/CONFIG_LBAAS_INSTALL\=y/g' aio-openstack.txt
sed -i 's/CONFIG_NEUTRON_FWAAS\=n/CONFIG_NEUTRON_FWAAS\=y/g' aio-openstack.txt
sed -i 's/CONFIG_NEUTRON_ML2_TYPE_DRIVERS\=vxlan,flat/CONFIG_NEUTRON_ML2_TYPE_DRIVERS\=vxlan,vlan,flat/g' aio-openstack.txt
sed -i 's/CONFIG_NEUTRON_ML2_FLAT_NETWORKS\=\*/CONFIG_NEUTRON_ML2_FLAT_NETWORKS\=extnet/g' aio-openstack.txt
sed -i 's/CONFIG_NEUTRON_OVS_BRIDGE_IFACES\=/CONFIG_NEUTRON_OVS_BRIDGE_IFACES\=br-ex:eth1/g' aio-openstack.txt
sed -i 's/CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE\=/CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE\=br-ex/g' aio-openstack.txt
sed -i 's/CONFIG_PROVISION_DEMO\=y/CONFIG_PROVISION_DEMO\=n/g' aio-openstack.txt
sed -i 's/CONFIG_KEYSTONE_ADMIN_PW/#CONFIG_KEYSTONE_ADMIN_PW/g' aio-openstack.txt
sed -i '338 i CONFIG_KEYSTONE_ADMIN_PW=rahasia' aio-openstack.txt

packstack --answer-file=aio-openstack.txt


#change enable_isolated_metadata dhcp agent with True
sed -i 's/enable_isolated_metadata\ \=\ False/enable_isolated_metadata\ \=\ True/g' /etc/neutron/dhcp_agent.ini
systemctl restart neutron-dhcp-agent
systemctl status neutron-dhcp-agent


#avtivated service virtlogd
systemctl status virtlogd
systemctl enable virtlogd
systemctl restart virtlogd
systemctl status virtlogd


#change hypervisor to KVM if value vmx/svm on /proc/cpuinfo is greater 0
sed -i 's/virt_type\=qemu/virt_type\=kvm/g' /etc/nova/nova.conf
systemctl restart openstack-nova-compute
systemctl status openstack-nova-compute
#!/usr/bin/env bash

##### Host Resolver #####
grep openstack /etc/hosts > /dev/null 2>&1 || echo "192.168.74.74 openstack" >> /etc/hosts



##### Repositories #####
echo -n "Installing repo openstack ocata.... " && yum -y install centos-release-openstack-ocata.noarch > /dev/null 2>&1 && echo "done"
echo -n "installing repo epel-7... " && yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm > /dev/null 2>&1 && echo "done"
echo -n "Update Repo... " && yum -y update > /dev/null 2>&1 && echo "done"


##### NTP #####
echo -n "Installing chrony for NTP..." && yum -y install chrony > /dev/null 2>&1 && echo "done"
systemctl enable chronyd.service
systemctl restart chronyd.service
systemctl status chronyd.service


##### Firewall #####
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service


##### Disable NetworkManager #####
systemctl disable NetworkManager.service
systemctl stop NetworkManager.service
systemctl status NetworkManager.service
systemctl enable network.service
systemctl restart network.service
systemctl status network.service

##### Paket Utilities #####
echo -n "Installing Packet Utilities" && yum -y install vim wget screen crudini htop > /dev/null 2>&1 && echo "done"


##### Paket Packstack #####
echo -n "Installing Packstack... " && yum -y install openstack-packstack > /dev/null 2>&1 && echo "done"
rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc

##### Generate Answer File Packstack #####
echo -n "Generate answer file... " && packstack --gen-answer-file=aio-openstack.txt > /dev/null 2>&1 && echo "done"

sed -i 's/CONFIG_CINDER_INSTALL\=y/CONFIG_CINDER_INSTALL\=n/g' aio-openstack.txt
sed -i 's/CONFIG_SWIFT_INSTALL\=y/CONFIG_SWIFT_INSTALL\=n/g' aio-openstack.txt
sed -i 's/CONFIG_HEAT_INSTALL\=n/CONFIG_HEAT_INSTALL\=y/g' aio-openstack.txt
sed -i 's/CONFIG_LBAAS_INSTALL\=n/CONFIG_LBAAS_INSTALL\=y/g' aio-openstack.txt
sed -i 's/CONFIG_NEUTRON_FWAAS\=n/CONFIG_NEUTRON_FWAAS\=y/g' aio-openstack.txt
sed -i 's/CONFIG_NEUTRON_ML2_TYPE_DRIVERS\=vxlan,flat/CONFIG_NEUTRON_ML2_TYPE_DRIVERS\=vxlan,vlan,flat/g' aio-openstack.txt
sed -i 's/CONFIG_NEUTRON_ML2_FLAT_NETWORKS\=\*/CONFIG_NEUTRON_ML2_FLAT_NETWORKS\=extnet/g' aio-openstack.txt
sed -i 's/CONFIG_NEUTRON_OVS_BRIDGE_IFACES\=/CONFIG_NEUTRON_OVS_BRIDGE_IFACES\=br-ex:eth1/g' aio-openstack.txt
sed -i 's/CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE\=/CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE\=br-ex/g' aio-openstack.txt
sed -i 's/CONFIG_PROVISION_DEMO\=y/CONFIG_PROVISION_DEMO\=n/g' aio-openstack.txt
sed -i 's/CONFIG_KEYSTONE_ADMIN_PW/#CONFIG_KEYSTONE_ADMIN_PW/g' aio-openstack.txt
sed -i '338 i CONFIG_KEYSTONE_ADMIN_PW=rahasia' aio-openstack.txt

packstack --answer-file=aio-openstack.txt


#change enable_isolated_metadata dhcp agent with True
sed -i 's/enable_isolated_metadata\ \=\ False/enable_isolated_metadata\ \=\ True/g' /etc/neutron/dhcp_agent.ini
systemctl restart neutron-dhcp-agent
systemctl status neutron-dhcp-agent


#avtivated service virtlogd
systemctl status virtlogd
systemctl enable virtlogd
systemctl restart virtlogd
systemctl status virtlogd


#change hypervisor to KVM if value vmx/svm on /proc/cpuinfo is greater 0
sed -i 's/virt_type\=qemu/virt_type\=kvm/g' /etc/nova/nova.conf
systemctl restart openstack-nova-compute
systemctl status openstack-nova-compute

Tampilan ketika proses installasi sudah selesai




Semoga Bermanfaat …
Salam TKJ … TKJ Sukses …

Syarif Muhammad Abdillah
Manusia sederhana yang baru mengenal linux pada tahun 2017, menyukai hal yang berhubungan dengan server, cloud dan virtualisasi.

Related Posts

Subscribe Our Newsletter