You are on page 1of 10

Automation of

OpenStack
Ing. Ruben Cordova
Pontifical Catholic University of Peru

1
Outline

1. Bash tools
1. awk
2. Python
1. ‘os’ library
2. ‘subprocess’ library
3. Heat
1. Architecture
2. HOT format

2
Bash Tools: awk

1. Print line
openstack server list | awk ‘NR==4’
2. Print column
openstack network list | awk ‘{print $4}’
3. Match pattern
openstack service list | awk '($6=="identity")'

3
Python Scripting

 ‘os’ library
 Execute command in a subshell and get return code
 Example
p = os.system (‘ls -lh’)
 ‘subprocess’ library
 Newer module, intended to replace os
 Allows to capture ‘stdout’ and ‘stderr’
 Example
p = subprocess.Popen(“ls –lh”, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = p.communicate()
exit_code = p.wait()
4
Activity 1

 Create a script in python that do the following


1. Create internal (tenant) network
2. Create subnets (per network)
3. Create routers, and assign interface and gateway
4. (Opt.) Create volumes
5. Create instances
6. (Opt.) Assign volume (nova volume-attach INSTANCE_ID VOLUME_ID auto)
7. Delete all created elements (by our script)

5
Heat

 Allows to launch different composite cloud applications


 Based on templates
 Support for Heat Orchestration Template (HOT) and AWS CloudFormation template
 HOT written in YAML (notation)
 Automatically configures and deploys resources (networks, instances, etc.) in
stacks

6
Heat: Architecture [2]

7
Heat: Architecture

 Heat-api
 OpenStack-native REST API
 Processes API requests by sending them to heat-engine
 Heat-api-cfn
 AWS Query API compatible with AWS CloudFormation
 Processes API requests and send them to heat-engine
 Heat-engine
 Orchestrates the launching of templates
 Provides events back to API consumer

8
Heat: HOT Format

9
Bibliography

1. OpenStack Documentation. OpenStack Installation Tutorial for Ubuntu


https://docs.openstack.org/newton/install-guide-ubuntu/
2. OpenStack Documentation. OpenStack Administrator Guide
https://docs.openstack.org/newton/admin-guide/identity-management.html
3. Andrey Markelov. Certified OpenStack Administrator Guide
4. OpenStack Documentation. Template Guide
https://docs.openstack.org/heat/pike/template_guide/index.html

10

You might also like