SlideShare una empresa de Scribd logo
1 de 28
Descargar para leer sin conexión
Just one Shade of OpenStack
Cloud applications are simple!
Who? What? Why?
Roberto Polli - Solutions Architect @ par-tec.it. Loves writing in C,
Java and Python. RHC{E,VA}, MySQL|MongoDB Certified DBA.
Par-Tec – Proud sponsor of this talk ;) provides expertise in IT
Infrastructure & Services and Business Intelligence solutions +
Vertical Applications for the financial market. Contributes to various
FLOSS.
Manage OpenStack with python Shade library to simplify
automation.
Agenda
⬝ Intro to OpenStack
⬝ The day I met Shade (Quickstart)
⬝ Building the cloud
⬝ Shade in Ansible Modules
⬝ A contribution story
OpenStack is Programmable Infrastructure
Programmable Infrastructure made open
- Amazon Web Services like (IaaS)
- Deploy Virtual {Machines,Network,...} on the internet
- REST interface
API Specs + python implementation
Industry backed (Red Hat, Rackspace, HP, Cisco, Oracle, ..)
OpenStack Architecture
OpenStack Workflows
Web Interface
API Endpoint
Queues
Datastores
OpenStack but... what's a Stack?
Virtualized infrastructure made of multiple components:
- load balancers
- web servers
- networks and routers
- datastores
- ...
OpenStack but... what's a Stack?
Deploy OpenStack Applications - CLIent API
$ openstack server create --image centos-7 --flavor m1.tiny web-1
$ openstack network create my-dmz
$ openstack subnet create --network my-dmz ...
$ openstack volume create --size 50 my-disk
$ openstack server add volume web-1 my-disk
https://docs.openstack.org/user-guide/cli-cheat-sheet.html
Deploy OpenStack Applications: Heat Templates
Heat is the Orchestration component.
- group resources into a HOT
- Heat Orchestration Template
- reuse them
Stacks can be updated and deleted,
Heat takes care of them.
You can compose templates specifying
a filename or an URI
Stacks are *persistent*
heat_template_version: 2016-04-08
description: >
A Template is a yaml file describing resources
and getting parameters in input.
parameters:
service_name:
type: string
...
resources:
web-1:
type: OS::Nova::Server
properties:
name: { get_param: service_name }
...
network:
type: https://git.it/network_template.yaml
properties:
...
Deploy OpenStack Applications: Heat Templates
Deploy OpenStack Applications: Ansible
OpenStack Modules
- more flexible than HOT
- removing a stack won't remove
created resources
- requires an external orchestrator
- can invoke heat (eg. for testing
HOTs)
HOT Quota is planned only in Ocata.
Older versions can't do it
- name: Yes, you can
hosts: localhost
...
tasks:
- name: Create and configure
os_project:
state: present
name: a_project
description: with Ansible
domain: default
enabled: true
wait: yes
-name: Create a user
os_user: name="joe" default_project="a_project"
-name: Manage ACL
os_user_role:
user: joe
role: admin
project: a_project
Meet Shade
I was working with various OpenStack projects when at EP16 in Bilbao I followed
a training on Cloud Applications
Goals:
- simplify openstack usage
- manage multiple openstack clouds
- more interaction
JOIN
EUROPYTHON
2017
OpenStack Applications
Use Shade directly:
- flexibility
- custom workflow
Apache libcloud:
- multi-cloud
- more generic
Shade Quickstart - 1/3
$ pip install shade # Install Shade
$ vim clouds.yml # Store credentials
$ ipython # Run (i)python
import shade
# Connect to the first cloud
mycloud = shade.operator_cloud(cloud='mycloud')
# List virtual servers
servers = mycloud.list_servers()
# List server names
[x.name for x in servers]
[
u'os3-node1',
u'os3-master0',
u'os3-master1',
...
]
# clouds.yml is the credential file
identity_api_version: '3.0'
clouds:
# Insert here your credentials.
mycloud:
verify: true # or false
auth:
username: admin
password: secret
auth_url: 'https://mycloud.com/v3'
project_name: 'admin'
domain_id: 'default'
interface: public
Shade Quickstart - 2/3
import shade
# Connect to the first cloud
site_a = shade.operator_cloud(cloud='mycloud')
# Connect to the second cloud
site_b = shade.operator_cloud(cloud=rackspace)
get_servers=lambda site: {x.name: x
for x in site.list_servers() }
# List virtual servers
servers_a = get_servers(site_a)
servers_b = get_servers(site_b)
# Check servers not highly available.
set(servers_a.keys()) - set(servers_b.keys())
# Get doppelgangers ip ;)
for k,v in servers_a.items():
v.doppelganger_ip = servers_b[k].interface_ip
# Add many clouds to your config
#
# Known cloud providers can be
# referenced via eg. "profile: rackspace"
identity_api_version: '3.0'
clouds:
mycloud:
...
rackspace:
auth:
cloud: rackspace
project_id: 275610
username: openstack
password: xyzpdq!lazydog
region_name: DFW,ORD,IAD
interface: internal
Shade Quickstart - 3/3
# Use logging for troubleshooting issues, eventually dumping to a file.
import shade
import logging
logging.basicConfig(level=logging.DEBUG, filename="client.log")
shade.simple_logging(debug=100, http_debug=0)
# Trace python-requests logging here or with http_debug=1
import httplib as http_client
http_client.HTTPConnection.debuglevel = 1
requests_log=logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
# Cloud configs are read with os-client-config
mycloud = shade.operator_cloud(cloud='mycloud')
Some more Shade - 1/2
# You can access every entry as an
object
server.image
{u'id': u'42c26768-0edf-...'}
# or as a dict (eg for complex attrsa)
server['OS-SRV-USG:launched_at']
u'2017-02-18T09:42:19.000000'
# Shade retains custom properties
# in the properties attribute
server.properties # a dict!
{
'OS-EXT-AZ:availability_zone':
u'nova',
'OS-EXT-STS:power_state': 1,
...
}
# The model.rst document,
# describes shade entries
Server = dict(
location=Location(),
id=str(),
name=str(),
image=dict() or str(),
flavor=dict(),
volumes=list(), # Volume
interface_ip=str(),
...
)
Some more Shade - 2/2
# Pandas creates wonderful reports
import pandas as pd
# Get your data
servers_a = cloud_a.list_servers()
servers_b = cloud_c.list_servers()
all_servers = servers_a + servers_b
# dump them into a pandas.DataFrame
df = pd.DataFrame(data=all_servers)
report = df[['name', 'status',
'cloud', 'interface_ip']]
# then to Excel
writer = ExcelWriter('cloud.xlsx')
report.to_excel(writer,'servers')
writer.save()
#
# The report outcome!
#
name status cloud interface_ip
0 os3-node1 ACTIVE mycloud
10.168.176.124
1 os3-master0 ACTIVE mycloud
10.168.176.125
...
8 os3-master0 ACTIVE rackspace
172.23.176.125
9 os3-master2 ACTIVE rackspace
172.23.176.123
Shade and Ansible
Provisioning projects on a
multi-datacenter OpenStack
Create projects with Heat:
- the project remains as a stack
- accidental removal risk
- can't manage quotas & co with HOT*
- update a quota may trigger a full
stack-update
"Projects represent
the base unit of
ownership in
OpenStack, in that all
resources in OpenStack
should be owned by a
specific project."
docs.openstack.org
Implement an Ansible module with Shade
Many policies for creating and updating
OpenStack objects
Testing/checking differences between
expected and actual settings
Trigger custom actions depending on
os_project status
# developing the os_project_access module
# grant access on various resources to
# a given project
- name: ansible provisioning a project
os_project_access:
...
resource_type: nova_flavor
resource_name: x1.medium
project_id: 0000-ffff-0000
- name: with iterations
os_project_access:
resource_type: cinder_volume_type
state: "{{item.state}}"
resource_name: "{{item.name}}"
project_id: 000-fff-000
with_items:
- {name: "sas", state: present }
- {name: "ssd", state: absent }
Writing Ansible Modules
PLEASE, DO NOT
write complex modules
accessing directly {nova,cinder,..}-api
Writing Ansible modules
# Implement a general workflow!
resource = _get_resource(resource_name_or_id)
allowed_projects = _get_resource_access(resource_id) # get acls
if state == 'present':
_add_resource_access(resource_id, target_project_id)
elif state == 'absent' and target_project_id in allowed_projects:
_remove_resource_access(resource_id, target_project_id)
Contributing to Shade
# Implement missing methods in shade
if resource_type == 'nova_flavor':
_get_resource = cloud.get_flavor
_list_resource_access = cloud.list_flavor_access # <- write this!
_add_resource_access = cloud.add_flavor_access # <- write this!
_remove_resource_access = cloud.remove_flavor_access # <- write this!
...
elif resource_type == 'your_resource_type':
def __not_general_enough_to_be_in_shade(resource_id): # <- if patch refused ;)
...
_list_resource_access = __not_general_enough_to_be_in_shade
else: raise NotImplementedError("Resource %r not implemented" % resource_type)
Contributing to Shade
⬝ Join #openstack-shade on irc
⬝ Sign Up https://launchpad.net/openstack
⬝ Install git-review
⬝ Write functional tests
⬝ Install devstack and test there before submitting for review
Contributing to Shade
Check your progresses and give feedback on other's patches
https://review.openstack.org/#/q/is:watched is:open
The Hardest Part
Where is my git-review password? No, it's not your account one ;)
1
2
Questions?
Thank You
roberto.polli@par-tec.it

Más contenido relacionado

La actualidad más candente

Libcloud and j clouds
Libcloud and j cloudsLibcloud and j clouds
Libcloud and j clouds
DaeMyung Kang
 
Orchestration & provisioning
Orchestration & provisioningOrchestration & provisioning
Orchestration & provisioning
buildacloud
 

La actualidad más candente (20)

Using OpenStack With Fog
Using OpenStack With FogUsing OpenStack With Fog
Using OpenStack With Fog
 
Apache LibCloud - Keeping up with the cloud market in 2016
Apache LibCloud - Keeping up with the cloud market in 2016Apache LibCloud - Keeping up with the cloud market in 2016
Apache LibCloud - Keeping up with the cloud market in 2016
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with Git
 
(DEV301) Automating AWS with the AWS CLI
(DEV301) Automating AWS with the AWS CLI(DEV301) Automating AWS with the AWS CLI
(DEV301) Automating AWS with the AWS CLI
 
Apache Libcloud
Apache LibcloudApache Libcloud
Apache Libcloud
 
Declarative & workflow based infrastructure with Terraform
Declarative & workflow based infrastructure with TerraformDeclarative & workflow based infrastructure with Terraform
Declarative & workflow based infrastructure with Terraform
 
Best Practices of IoT in the Cloud
Best Practices of IoT in the CloudBest Practices of IoT in the Cloud
Best Practices of IoT in the Cloud
 
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
 
Introduction openstack horizon
Introduction openstack horizonIntroduction openstack horizon
Introduction openstack horizon
 
Getting Started with ElastiCache for Redis
Getting Started with ElastiCache for RedisGetting Started with ElastiCache for Redis
Getting Started with ElastiCache for Redis
 
Deep Dive - Infrastructure as Code
Deep Dive - Infrastructure as CodeDeep Dive - Infrastructure as Code
Deep Dive - Infrastructure as Code
 
Infrastructure as Code - Terraform - Devfest 2018
Infrastructure as Code - Terraform - Devfest 2018Infrastructure as Code - Terraform - Devfest 2018
Infrastructure as Code - Terraform - Devfest 2018
 
Libcloud and j clouds
Libcloud and j cloudsLibcloud and j clouds
Libcloud and j clouds
 
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
 
Deep Dive: Infrastructure as Code
Deep Dive: Infrastructure as CodeDeep Dive: Infrastructure as Code
Deep Dive: Infrastructure as Code
 
AWS CloudFormation Intrinsic Functions and Mappings
AWS CloudFormation Intrinsic Functions and Mappings AWS CloudFormation Intrinsic Functions and Mappings
AWS CloudFormation Intrinsic Functions and Mappings
 
Infrastructure as Code for Beginners
Infrastructure as Code for BeginnersInfrastructure as Code for Beginners
Infrastructure as Code for Beginners
 
Hands-on Lab: Amazon ElastiCache
Hands-on Lab: Amazon ElastiCacheHands-on Lab: Amazon ElastiCache
Hands-on Lab: Amazon ElastiCache
 
Cloud Computing Open Stack Compute Node
Cloud Computing Open Stack Compute NodeCloud Computing Open Stack Compute Node
Cloud Computing Open Stack Compute Node
 
Orchestration & provisioning
Orchestration & provisioningOrchestration & provisioning
Orchestration & provisioning
 

Similar a Just one-shade-of-openstack

Puppetpreso
PuppetpresoPuppetpreso
Puppetpreso
ke4qqq
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStack
ke4qqq
 
Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStack
ke4qqq
 

Similar a Just one-shade-of-openstack (20)

Introduction to Apache CloudStack by David Nalley
Introduction to Apache CloudStack by David NalleyIntroduction to Apache CloudStack by David Nalley
Introduction to Apache CloudStack by David Nalley
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpreso
 
Workshop - Openstack, Cloud Computing, Virtualization
Workshop - Openstack, Cloud Computing, VirtualizationWorkshop - Openstack, Cloud Computing, Virtualization
Workshop - Openstack, Cloud Computing, Virtualization
 
Openstack workshop @ Kalasalingam
Openstack workshop @ KalasalingamOpenstack workshop @ Kalasalingam
Openstack workshop @ Kalasalingam
 
Kolla talk at OpenStack Summit 2017 in Sydney
Kolla talk at OpenStack Summit 2017 in SydneyKolla talk at OpenStack Summit 2017 in Sydney
Kolla talk at OpenStack Summit 2017 in Sydney
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStack
 
Dockerization of Azure Platform
Dockerization of Azure PlatformDockerization of Azure Platform
Dockerization of Azure Platform
 
Immutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS LambdaImmutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS Lambda
 
Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to production
 
Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStack
 
Play framework
Play frameworkPlay framework
Play framework
 
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 Cloud-native applications with Java and Kubernetes - Yehor Volkov Cloud-native applications with Java and Kubernetes - Yehor Volkov
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 
Cloud State of the Union for Java Developers
Cloud State of the Union for Java DevelopersCloud State of the Union for Java Developers
Cloud State of the Union for Java Developers
 
Cutting through the fog of cloud
Cutting through the fog of cloudCutting through the fog of cloud
Cutting through the fog of cloud
 
OpenStack for VMware Administrators
OpenStack for VMware AdministratorsOpenStack for VMware Administrators
OpenStack for VMware Administrators
 
MySQL on Docker and Kubernetes
MySQL on Docker and KubernetesMySQL on Docker and Kubernetes
MySQL on Docker and Kubernetes
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modules
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
 
2013 05-openstack-israel-heat
2013 05-openstack-israel-heat2013 05-openstack-israel-heat
2013 05-openstack-israel-heat
 

Más de Roberto Polli

Pysmbc Python C Modules are Easy
Pysmbc Python C Modules are EasyPysmbc Python C Modules are Easy
Pysmbc Python C Modules are Easy
Roberto Polli
 

Más de Roberto Polli (20)

Ratelimit Headers for HTTP
Ratelimit Headers for HTTPRatelimit Headers for HTTP
Ratelimit Headers for HTTP
 
Interoperability rules for an European API ecosystem: do we still need SOAP?
Interoperability rules for an European API ecosystem: do we still need SOAP?Interoperability rules for an European API ecosystem: do we still need SOAP?
Interoperability rules for an European API ecosystem: do we still need SOAP?
 
Docker - virtualizzazione leggera
Docker - virtualizzazione leggeraDocker - virtualizzazione leggera
Docker - virtualizzazione leggera
 
Test Drive Deployment with python and nosetest
Test Drive Deployment with python and nosetestTest Drive Deployment with python and nosetest
Test Drive Deployment with python and nosetest
 
Tox as project descriptor.
Tox as project descriptor.Tox as project descriptor.
Tox as project descriptor.
 
Python for System Administrators
Python for System AdministratorsPython for System Administrators
Python for System Administrators
 
Scaling mysql with python (and Docker).
Scaling mysql with python (and Docker).Scaling mysql with python (and Docker).
Scaling mysql with python (and Docker).
 
Orchestrating MySQL with Python and Docker
Orchestrating MySQL with Python and DockerOrchestrating MySQL with Python and Docker
Orchestrating MySQL with Python and Docker
 
Statistics 101 for System Administrators
Statistics 101 for System AdministratorsStatistics 101 for System Administrators
Statistics 101 for System Administrators
 
Will iPython replace bash?
Will iPython replace bash?Will iPython replace bash?
Will iPython replace bash?
 
Pysmbc Python C Modules are Easy
Pysmbc Python C Modules are EasyPysmbc Python C Modules are Easy
Pysmbc Python C Modules are Easy
 
Git gestione comoda del repository
Git   gestione comoda del repositoryGit   gestione comoda del repository
Git gestione comoda del repository
 
Testing with my sql embedded
Testing with my sql embeddedTesting with my sql embedded
Testing with my sql embedded
 
Servizi di messaging & collaboration in mobilità: Il panorama open source
Servizi di messaging & collaboration in mobilità: Il panorama open sourceServizi di messaging & collaboration in mobilità: Il panorama open source
Servizi di messaging & collaboration in mobilità: Il panorama open source
 
Funambol al Linux Day 2009
Funambol al Linux Day 2009Funambol al Linux Day 2009
Funambol al Linux Day 2009
 
ICalendar RFC2445 - draft1
ICalendar RFC2445 - draft1ICalendar RFC2445 - draft1
ICalendar RFC2445 - draft1
 
Presenting CalDAV (draft 1)
Presenting CalDAV (draft 1)Presenting CalDAV (draft 1)
Presenting CalDAV (draft 1)
 
Integrating Funambol with CalDAV and LDAP
Integrating Funambol with CalDAV and LDAPIntegrating Funambol with CalDAV and LDAP
Integrating Funambol with CalDAV and LDAP
 
ultimo-miglio-v3
ultimo-miglio-v3ultimo-miglio-v3
ultimo-miglio-v3
 
Ultimo Miglio v2
Ultimo Miglio v2Ultimo Miglio v2
Ultimo Miglio v2
 

Último

VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
nilamkumrai
 
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
nirzagarg
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 

Just one-shade-of-openstack

  • 1. Just one Shade of OpenStack Cloud applications are simple!
  • 2. Who? What? Why? Roberto Polli - Solutions Architect @ par-tec.it. Loves writing in C, Java and Python. RHC{E,VA}, MySQL|MongoDB Certified DBA. Par-Tec – Proud sponsor of this talk ;) provides expertise in IT Infrastructure & Services and Business Intelligence solutions + Vertical Applications for the financial market. Contributes to various FLOSS. Manage OpenStack with python Shade library to simplify automation.
  • 3. Agenda ⬝ Intro to OpenStack ⬝ The day I met Shade (Quickstart) ⬝ Building the cloud ⬝ Shade in Ansible Modules ⬝ A contribution story
  • 4. OpenStack is Programmable Infrastructure Programmable Infrastructure made open - Amazon Web Services like (IaaS) - Deploy Virtual {Machines,Network,...} on the internet - REST interface API Specs + python implementation Industry backed (Red Hat, Rackspace, HP, Cisco, Oracle, ..)
  • 6. OpenStack Workflows Web Interface API Endpoint Queues Datastores
  • 7. OpenStack but... what's a Stack? Virtualized infrastructure made of multiple components: - load balancers - web servers - networks and routers - datastores - ...
  • 9. Deploy OpenStack Applications - CLIent API $ openstack server create --image centos-7 --flavor m1.tiny web-1 $ openstack network create my-dmz $ openstack subnet create --network my-dmz ... $ openstack volume create --size 50 my-disk $ openstack server add volume web-1 my-disk https://docs.openstack.org/user-guide/cli-cheat-sheet.html
  • 10. Deploy OpenStack Applications: Heat Templates Heat is the Orchestration component. - group resources into a HOT - Heat Orchestration Template - reuse them Stacks can be updated and deleted, Heat takes care of them. You can compose templates specifying a filename or an URI Stacks are *persistent* heat_template_version: 2016-04-08 description: > A Template is a yaml file describing resources and getting parameters in input. parameters: service_name: type: string ... resources: web-1: type: OS::Nova::Server properties: name: { get_param: service_name } ... network: type: https://git.it/network_template.yaml properties: ...
  • 12. Deploy OpenStack Applications: Ansible OpenStack Modules - more flexible than HOT - removing a stack won't remove created resources - requires an external orchestrator - can invoke heat (eg. for testing HOTs) HOT Quota is planned only in Ocata. Older versions can't do it - name: Yes, you can hosts: localhost ... tasks: - name: Create and configure os_project: state: present name: a_project description: with Ansible domain: default enabled: true wait: yes -name: Create a user os_user: name="joe" default_project="a_project" -name: Manage ACL os_user_role: user: joe role: admin project: a_project
  • 13. Meet Shade I was working with various OpenStack projects when at EP16 in Bilbao I followed a training on Cloud Applications Goals: - simplify openstack usage - manage multiple openstack clouds - more interaction JOIN EUROPYTHON 2017
  • 14. OpenStack Applications Use Shade directly: - flexibility - custom workflow Apache libcloud: - multi-cloud - more generic
  • 15. Shade Quickstart - 1/3 $ pip install shade # Install Shade $ vim clouds.yml # Store credentials $ ipython # Run (i)python import shade # Connect to the first cloud mycloud = shade.operator_cloud(cloud='mycloud') # List virtual servers servers = mycloud.list_servers() # List server names [x.name for x in servers] [ u'os3-node1', u'os3-master0', u'os3-master1', ... ] # clouds.yml is the credential file identity_api_version: '3.0' clouds: # Insert here your credentials. mycloud: verify: true # or false auth: username: admin password: secret auth_url: 'https://mycloud.com/v3' project_name: 'admin' domain_id: 'default' interface: public
  • 16. Shade Quickstart - 2/3 import shade # Connect to the first cloud site_a = shade.operator_cloud(cloud='mycloud') # Connect to the second cloud site_b = shade.operator_cloud(cloud=rackspace) get_servers=lambda site: {x.name: x for x in site.list_servers() } # List virtual servers servers_a = get_servers(site_a) servers_b = get_servers(site_b) # Check servers not highly available. set(servers_a.keys()) - set(servers_b.keys()) # Get doppelgangers ip ;) for k,v in servers_a.items(): v.doppelganger_ip = servers_b[k].interface_ip # Add many clouds to your config # # Known cloud providers can be # referenced via eg. "profile: rackspace" identity_api_version: '3.0' clouds: mycloud: ... rackspace: auth: cloud: rackspace project_id: 275610 username: openstack password: xyzpdq!lazydog region_name: DFW,ORD,IAD interface: internal
  • 17. Shade Quickstart - 3/3 # Use logging for troubleshooting issues, eventually dumping to a file. import shade import logging logging.basicConfig(level=logging.DEBUG, filename="client.log") shade.simple_logging(debug=100, http_debug=0) # Trace python-requests logging here or with http_debug=1 import httplib as http_client http_client.HTTPConnection.debuglevel = 1 requests_log=logging.getLogger("requests.packages.urllib3") requests_log.setLevel(logging.DEBUG) requests_log.propagate = True # Cloud configs are read with os-client-config mycloud = shade.operator_cloud(cloud='mycloud')
  • 18. Some more Shade - 1/2 # You can access every entry as an object server.image {u'id': u'42c26768-0edf-...'} # or as a dict (eg for complex attrsa) server['OS-SRV-USG:launched_at'] u'2017-02-18T09:42:19.000000' # Shade retains custom properties # in the properties attribute server.properties # a dict! { 'OS-EXT-AZ:availability_zone': u'nova', 'OS-EXT-STS:power_state': 1, ... } # The model.rst document, # describes shade entries Server = dict( location=Location(), id=str(), name=str(), image=dict() or str(), flavor=dict(), volumes=list(), # Volume interface_ip=str(), ... )
  • 19. Some more Shade - 2/2 # Pandas creates wonderful reports import pandas as pd # Get your data servers_a = cloud_a.list_servers() servers_b = cloud_c.list_servers() all_servers = servers_a + servers_b # dump them into a pandas.DataFrame df = pd.DataFrame(data=all_servers) report = df[['name', 'status', 'cloud', 'interface_ip']] # then to Excel writer = ExcelWriter('cloud.xlsx') report.to_excel(writer,'servers') writer.save() # # The report outcome! # name status cloud interface_ip 0 os3-node1 ACTIVE mycloud 10.168.176.124 1 os3-master0 ACTIVE mycloud 10.168.176.125 ... 8 os3-master0 ACTIVE rackspace 172.23.176.125 9 os3-master2 ACTIVE rackspace 172.23.176.123
  • 20. Shade and Ansible Provisioning projects on a multi-datacenter OpenStack Create projects with Heat: - the project remains as a stack - accidental removal risk - can't manage quotas & co with HOT* - update a quota may trigger a full stack-update "Projects represent the base unit of ownership in OpenStack, in that all resources in OpenStack should be owned by a specific project." docs.openstack.org
  • 21. Implement an Ansible module with Shade Many policies for creating and updating OpenStack objects Testing/checking differences between expected and actual settings Trigger custom actions depending on os_project status # developing the os_project_access module # grant access on various resources to # a given project - name: ansible provisioning a project os_project_access: ... resource_type: nova_flavor resource_name: x1.medium project_id: 0000-ffff-0000 - name: with iterations os_project_access: resource_type: cinder_volume_type state: "{{item.state}}" resource_name: "{{item.name}}" project_id: 000-fff-000 with_items: - {name: "sas", state: present } - {name: "ssd", state: absent }
  • 22. Writing Ansible Modules PLEASE, DO NOT write complex modules accessing directly {nova,cinder,..}-api
  • 23. Writing Ansible modules # Implement a general workflow! resource = _get_resource(resource_name_or_id) allowed_projects = _get_resource_access(resource_id) # get acls if state == 'present': _add_resource_access(resource_id, target_project_id) elif state == 'absent' and target_project_id in allowed_projects: _remove_resource_access(resource_id, target_project_id)
  • 24. Contributing to Shade # Implement missing methods in shade if resource_type == 'nova_flavor': _get_resource = cloud.get_flavor _list_resource_access = cloud.list_flavor_access # <- write this! _add_resource_access = cloud.add_flavor_access # <- write this! _remove_resource_access = cloud.remove_flavor_access # <- write this! ... elif resource_type == 'your_resource_type': def __not_general_enough_to_be_in_shade(resource_id): # <- if patch refused ;) ... _list_resource_access = __not_general_enough_to_be_in_shade else: raise NotImplementedError("Resource %r not implemented" % resource_type)
  • 25. Contributing to Shade ⬝ Join #openstack-shade on irc ⬝ Sign Up https://launchpad.net/openstack ⬝ Install git-review ⬝ Write functional tests ⬝ Install devstack and test there before submitting for review
  • 26. Contributing to Shade Check your progresses and give feedback on other's patches https://review.openstack.org/#/q/is:watched is:open
  • 27. The Hardest Part Where is my git-review password? No, it's not your account one ;) 1 2