0% found this document useful (0 votes)
449 views

Cl210v10 Exam

The document contains commands to create OpenStack projects, users, flavors, images, networks, routers, security groups, instances, volumes, containers, heat stacks, and customization of images. It demonstrates how to perform essential administration and configuration tasks in OpenStack such as creating projects, users, networks, launching instances, attaching volumes, and more.

Uploaded by

Padmanabhan Mani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
449 views

Cl210v10 Exam

The document contains commands to create OpenStack projects, users, flavors, images, networks, routers, security groups, instances, volumes, containers, heat stacks, and customization of images. It demonstrates how to perform essential administration and configuration tasks in OpenStack such as creating projects, users, networks, launching instances, attaching volumes, and more.

Uploaded by

Padmanabhan Mani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

openstack

Q1> Create the two projects named Engineering and Production.

Create user named Robert as an admin of Engineering project with email id


Robert@example.com
Create user named George as a member of Engineering project with email id
George@example.com
Create user named William as an admin of Production project with
William@example.com
Create user named John as a member of Production project with email id
John@example.com

password created for all user must be redhat.

ANS :

openstack project create Engineering


openstack project create Production

openstack user create --project Engineering --email Robert@example.com --password


redhat Robert
openstack role add --project Engineering --user Robert admin

##########################################################

Q2> Create a flavor named m1.petite for Engineering project. It should have 1 cpu,
1024MB ram.
Create two security group for Engineering with name "ssh" for allowing ssh
port and "web" for allowing http port to make it accessible from public.
Create a key pair named webkey which should be stored inside /home/stack
directory.

ANS:

openstack flavor create --vcpus 1 --ram 1024 --project Engineering m1.petite


openstack security group create web
openstack security group rule create --protocol tcp --dst-port 80 web
openstack security group create ssh
openstack security group rule create --protocol tcp --dst-port 22 ssh

openstack keypair create webkey > /home/stack/webkey.pem

chmod 600 webkey.pem

##########################################################

Q3> Upload an image to your image registry (glance) osp-small.qcow2, Image name
should be 'web'.
( download from classroom.example.com )

ANS:
wget http://classroom.example.com/osp-small.qcow2

openstack image create --disk-format qcow2 --file osp.small.qcow2 web

#########################################################################

Q4> Create a container named container1. Download the file from url
http://materials.example.com/data.tar.bz2.
upload the file dowloaded to the container1 as the same name.

stack $ source overcloud-robertrc


( username=robert,password=redhat,project/tenant=Engineering )
( for this create a file which includes robertrc credentials )

stack $ openstack container create container1

stack $ wget http://materials.example.com/data.tar.bz2

stack $ openstack object create container1 data.tar.bz2

##############################################################

Q5> Configure the network for Engineering project:

Network1: Private subnet: internal

Create a network named private. It should have a subnet


named as internal with network segment 192.168.1.0/24

stack$ source overcloud-robertc

$ openstack network create private

$ openstack subnet create --network private internal --dhcp


--subnet-range 192.168.1.0/24 --dns-nameserver 172.25.250.254

Network2: Public subnet: external

Create a network named public. It should have a subnet


named as external with network segment 172.25.250.0/24

$ source overcloud-rebortc

$ openstack network create public --external --provider-network-


type flat --provider-physical-network datacentre

$ openstakc subnet create --network public external --no-dhcp


--subnet-range 172.25.250.0/24 --allocation-pool \
start=172.25.250.100,end=172.25.250.120 --gateway 172.25.250.254
--dns-nameserver 172.25.250.254
Router:

create a router with name Router1. Attach both thecnetworks to this


router so that an instance can be accesible from public.

$ openstack router create Router1

$ openstack router add subnet Router1 internal ( Private


network )

$ neutron router-gateway-set Router1 public ( Public network )

################################################################3

Q6> Launch an instance with name webserver under Engineering project.


It should use m1.petite flavor, web image, webkey keypair and two security groups
ssh and web in private network.

$ source overcloud-robertrc

$ openstack server create --flavor m1.petite --image web


--keypair webkey --security-group ssh --security-group web \
--nic net-id=private --wait webserver

*add one floating ip to your instance ( floating ip must be from 172.25.250.100-


172.25.250.120 Range ) and
make sure it in the limit of what has been asked before.

##########################################################

Q7> Create a block storage for Engineering named storage with size of 2gb and
attach it to webserver instance as /dev/vdb.

$ openstack volume create --size 2 storage

$ openstack server add volume webserver storage

$ openstack console url show webserver

#################################################################

Q8> Create a heat stack template from command line. The template file will be
broken, fix the issue and run the template to install the instances.
Add a new group named stckgroup in to instance.
Create the environment file which contains following parameters:

stack name: heat-stack


template file: /home/stack/materials/web_server.yaml

*Use the following Parameters to launch Stack: ( this will be given in exam )

image_name: web
instance_name: webserver01
flavor_name: m1.small
keypair_name: webkey
public_net: public
private_net: private
private_subnet: internal

$ sudo chattr -i ~/materials/web_server.yaml

stack@direcotr ~]$ vi /home/stack/materials/web_server.yaml

$ vi /home/stack/materials/environment.yaml

parameters:
image_name: web
instance_name: webserver01
flavor_name: m1.small
keypair_name: webkey
public_net: public
private_net: private
private_subnet: internal

$ openstack stack create -t


~/materials/web_server.yaml -e ~/materials/environment.yaml --dry-run heat-
stack

$ openstack stack create -t ~/materials/web_server.yaml


-e ~/materials/envrionment.yaml --enable-rollback heat-stack

$ openstack stack list

$ openstakc stack event list heat-stack(stack-name)

#################################################

Q9> Create a rabbitmq user name ash who can configure, exchange messages and
generate queues.
user password should be Ablerate9.
Create a message queue named openstack_install.queue. then publish a message to a
queue.
ANS:

*must have root access

# rabbitmqctl add_user ash redhat


# rabbitmqctl set_permissions ash ".*" ".*" ".*"
# rabbitmqctl set_user_tags ash administrator
# rabbitmqctl list_users
# rabbitmqctl list_user_permissions
# vi ~/.rabbitmqadmin.conf
[default]
port = 15672
hostname = 172.24.1.1
username = ash
password = redhat
#rabbitmqadmin -c ~/.rabbitmqadmin.conf declare queue name=openstack_install.queue

#rabbitmqctl list_queues | grep install


#rabbitmqadmin -c .rabbitmqadmin.conf publish routing_key=openstack_install.queue
test message
#rabbitmqctl list_queues | grep install

###################################################################################
#####

Q10> Customise the image which is stored in /root directory on


director.lab.example.com. It should install httpd and enable the respective
service.
Create index page under webroot /var/www/html that should contain REDHAT STACK
DEVOPS. Ensure the Selinux context is correct.

guestfish -i --network -a osp_webserver.qcow2


<fs> command 'yum install httpd -y'
<fs> command 'systemctl enable httpd'
3. command 'systemctl start httpd'
4. touch /var/www/html/index.html
5. edit /var/www/html/index.html
6. selinux-relabel /etc/selinux/targeted/contexts/files/file_contexts /

Under Engineering project create a new OpenStack image named webimage the
osp_webserver.qcow2 image, with a minimum disk requirement of 10 GB of disk and
2048 RAM.

$ openstack image create --file osp_webserver.qcow2 --min-ram 2048


--min-disk 10 webimage

Now create an instance named production1 using webimage image , flavor


m1.small(provided in exam), keypair webkey, network private, security group ssh and
web
and finally attach one floating ip to this.

###################################################################################
#######

Q11> Create a snapshot of stoarge with name "strgsnap".

$ openstack server remove volume webserver storage

$ openstack snapshot create

#########################################################

Q12> Add a one more node to the existing overcloud. Commands used to install
overcloud is stored in overcloud_install.sh file.
After installation overcloudrc file will be updated with wrong password that you
need to correct as previous.

$ source stackrc

$ openstack baremetal import --json instackenv-onenode.json

$ openstack baremetal node manage compute1

$ openstack overcloud node introspect --all-manageable --provide

$ openstack baremetal node set compute1 --property


"capabilities=profile:compute,boot_option:local"

$ openstack overcloud deploy --templates ~/templates --environment-


directory ~/templates/cl210-00/

Deploy:

$ sudo chattr -i overcloud_install.sh < ~/materials


+i >
$ vi overlcoud_install.sh

compute 1(2)

esc : wq

$ chmod +x overcloud_install.sh

$ ./overcloud_install.sh

$ source stackrc

$ openstack hypervisor list Postroll9 ( overcloudrc )

###################################################################################
########################

Q13> Create an instance named fileserver on a newly created compute node


which must use new flaver named m1.file with 512MB of RAM.
use webserver keypair.

$ source overcloudrc

$ openstack server create

$ openstack server show <instance-name>

##################################################################

Q14> Move the fileserver instance to the another compute node.


$ source overcloudrc

$ openstack compute service list

$ openstack host show compute1

$ openstack server migrate --live <compute2-node-name> <instance-name>

#########################################################################

Q15> Create a ceilometer report to list all the available resources.

$ openstack metric resource list > path\file.txt

You might also like