SlideShare a Scribd company logo
How to deploy Spark HA instance using
Ansible 2.0 in FIWARE Lab
Fernando López Aguilar
Technological Expert. IT and Cloud Architect
fernando.lopezaguilar@telefonica.com
@flopezaguilar
1
2
Cookies of the Dark Side
• Use OpenStack locally.
• Use Ansible.
• Use both together.
3
Come to the Dark Side
We use OpenStackClient
4
OpenStack client
 Unified shell command structure and a common language to describe
operations in OpenStack.
 Remote interaction with any OpenStack environment (if it is open).
 Easy install, just execute: pip install python-openstackclient.
 Easy to use, just execute: $ openstack --help
ubuntu@ubuntu:~/malaga$ sudo apt install python-pip
…
ubuntu@ubuntu:~/malaga$ sudo apt install virtualenv
…
ubuntu@ubuntu:~/malaga$ virtualenv env
New python executable in
/home/ubuntu/malaga/env/bin/python
Installing setuptools, pip, wheel...done.
ubuntu@ubuntu:~/malaga$ source env/bin/activate
(env) ubuntu@ubuntu:~/malaga$ pip install 
> python-openstackclient
…
5
OpenStackClient hands-on
 Create a new directory
(e.g. malaga)
 If you do not have, install
pip and virtualenv.
 Create your virtualenv
(virtualenv is a tool to
create isolated Python
environments).
 Activate the isolated
python environment.
 Install the
OpenStackClient
6
OpenStack client hands-on
 After the installation you can execute the command shell openstack.
 To obtain information about the openstack command and its
subcommands, run it:
$ openstack help [subcommand]
$ openstack --help
 Typing openstack switches to the interactive mode.
Typing help [subcommand] for information.
To exit the interactive mode, type quit.
7
OpenStack client hands-on
• Next steps: we need the
credentials of your OpenStack
environment.
• Just login into FIWARE Lab Cloud
Portal (https://cloud.lab.fiware.org/)
and get your data:
ubuntu@ubuntu:~/malaga$ more
fernando.lopezaguilar@telefonica.com-openrc
export
OS_USERNAME=fernando.lopezaguilar@telefonica.com
export OS_PASSWORD=
export OS_TENANT_NAME="Fernando Lopez cloud”
export OS_REGION_NAME=Spain2
export OS_AUTH_URL=http://130.206.84.8:4730/v3/
8
OpenStackClient hands-on
 File downloaded a file with
format:
<your user name>-openrc
 Content:
 OS_USERNAME
 OS_PASSWORD
 OS_TENANT_NAME
 OS_REGION_NAME
 OS_AUTH_URL
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_IDENTITY_API_VERSION=3
export PS1='(`basename "$VIRTUAL_ENV`)[u@FIWARE
Lab W(keystone_user)]$ ’
ubuntu@ubuntu:~/malaga$ source
fernando.lopezaguilar@telefonica.com-openrc
9
OpenStackClient hands-on
 You need to edit the file
and add the following.
 I suggest to add also the
following line.
 Move the file to your work
directory and load it.
10
OpenStackClient hands-on
 Your turn…
 Get help about openstack client
 Create a keypair.
 List of keypairs.
11
THEY HAVE ANIBLE… !!!
I’ve been to the dark side…
12
Ansible
 Ansible is an IT automation tool.
 Manages machines in an agent-less manner.
 Uses of OpenSSH for transport and a YAML language.
 Main focus in software deployment and system configuration.
13
What do you need to know?
 Connect to a remote machine using SSH.
 Interact with the bash command-line shell.
 Install packages.
 Use the sudo command.
 Check and set file permissions.
 Start and stop services.
 Set environment variables.
 Write scripts (any language).
14
Previous action
 Install ansible (v 2.2.0.0)
 Using openstackclient, deploy a server.
 Create a keypair
 Create security group an assign rule
 Create a server
15
First steps with Ansible
 Define inventory file (hosts).
 INI-like format and looks like this::
 <server name>: name of the server
 ansible_ssh_host: IP of the server
 ansible_ssh_user: user to access via ssh
 ansible_ssh_private_key_file: key pair to access the server
ubuntu@ubuntu:~/malaga$ ansible ansible-test -i hosts -m
ping
ansible-test | SUCCESS => {
"changed": false,
"ping": "pong"
}
16
First steps with Ansible
 Connect to the server
named <server name>
and invoke the ping
module.
17
Time to do bigger things
---
invoice: 12345
product:
- id: 987
amount: 2
description: basketball ball
- id: 760
amount: 1
description: football ball
18
Ansible
 Process description in YAML
description file.
 YAML is a human friendly data
serialization standard for all
programming languages.
 A deployment is described in a
“playbook” (e.g.: deploy a web
application).
 A “playbook” can define several
processes o deployments
19
Ansible inventory
 Ansible works against multiple systems in your infrastructure at the
same time.
 By defaults, saved in the location /etc/ansible/hosts but can be
specified a different inventory with –i command.
 Not only is this inventory configurable, but you can also use multiple
inventory files at the same time.
 You can use a script to generate dynamically the inventory.
20
Using Variables: About Jinja2
 Ansible allows you to reference variables in your playbooks using the
Jinja2 templating system.
 Example: in a simple template, you can do something like:
My amp goes to {{ max_amp_value }}
 This is also valid directly in playbooks:
template: src=foo.cfg.j2 dest={{ remote_install_path }}/foo.cfg
 Variables might be defined in YAML file (e.g. vars/main.yml)
21
Ansible modules
 Ansible ships with a number of modules (called the ‘module library’).
 They can be executed directly (-m option) on remote hosts or through
Playbooks.
 Users can also write their own modules.
 These modules can control system resources, like services,
packages, or files (anything really), or handle executing system
commands.
22
Ansible roles
 Instead of creating giant playbooks with hundreds of tasks we can use
roles to organize tasks.
 A role breaks task into smaller more discrete units of work.
 A role is all the tasks, variables and handlers needed to complete the
unit of work.
 This allows a role to be completely self contained or encapsulated
and completely reusable.
 Example of role is the installation and configuration of NTPd service.
23
Ansible Galaxy
24
Where the hell is Spark…?
25
Spark
 Apache Spark is a fast and general-purpose cluster computing
system.
 Provide high-level APIs in Java, Scala, Python and R.
 Support a rich set of higher-level tools:
 Spark SQL for SQL and structured data processing.
 MLlib for machine learning.
 GraphX for graph processing, and Spark Streaming.
26
Spark in HA
 Creation of a Master node and several Slaves nodes.
 Configuration of the instances.
 Configuration of Spark nodes.
…
27
Hands-on Spark deployment with Ansible
 Clone the github repository
https://github.com/flopezag/ansible_spark_openstack
 Follow the instructions in README.md file
 Take a look into /vars/main.yml file.
28
Yeah, if you could just,
come to the dark side…
29
References
 OpenStack Client Command List:
http://docs.openstack.org/developer/python-openstackclient/command-
list.html
 Ansible documentation:
http://docs.ansible.com/ansible/
 FIWARE Lab Account portal:
https://account.lab.fiware.org/idm/
Thank you!
http://fiware.org
Follow @FIWARE on Twitter
30
Thank you!
http://fiware.org
Follow @FIWARE on Twitter

More Related Content

What's hot (20)

ODP
OpenStack DevStack Configuration localrc local.conf Tutorial
Saju Madhavan
 
ODP
OpenStack DevStack Tutorial
Saju Madhavan
 
DOC
EMC Networker installation Document
uzzal basak
 
PPTX
Setting up your virtual infrastructure using fi lab cloud
Henar Muñoz Frutos
 
PDF
Docker for Ruby Developers
Aptible
 
PPTX
OpenStack Development Using devstack
mestery
 
PDF
OpenStack in 10 minutes with Devstack
Sean Dague
 
PDF
Provisioning with OSGi Subsystems and Repository using Apache Aries and Felix
David Bosschaert
 
PPTX
OpenStack : DevStack installation using VirtualBox & Ubnutu (Juno with Neutron)
Ian Choi
 
PDF
Oracle linux kube
Ahmed Mekawy
 
PDF
Python on exadata
Rainer Schuettengruber
 
PDF
Amending and Testing changes lab guide
openstackcisco
 
PDF
Eucalyptus on Xen - Build Enterprise Private Cloud | Torry Harris Whitepaper
Torry Harris Business Solutions
 
PDF
Oracle business intelligence enterprise edition 11g
uzzal basak
 
PPTX
DevStack
Everett Toews
 
PDF
Install Solaris 11.1 on a Virtualbox VM
Laurent Leturgez
 
PDF
Installing WordPress on AWS
Manish Jain
 
PPTX
Harmonia open iris_basic_v0.1
Yongyoon Shin
 
PPTX
Installaling Puppet Master and Agent
Ranjit Avasarala
 
PDF
Vulnerability Exploitation in Docker Container Environments
FlawCheck
 
OpenStack DevStack Configuration localrc local.conf Tutorial
Saju Madhavan
 
OpenStack DevStack Tutorial
Saju Madhavan
 
EMC Networker installation Document
uzzal basak
 
Setting up your virtual infrastructure using fi lab cloud
Henar Muñoz Frutos
 
Docker for Ruby Developers
Aptible
 
OpenStack Development Using devstack
mestery
 
OpenStack in 10 minutes with Devstack
Sean Dague
 
Provisioning with OSGi Subsystems and Repository using Apache Aries and Felix
David Bosschaert
 
OpenStack : DevStack installation using VirtualBox & Ubnutu (Juno with Neutron)
Ian Choi
 
Oracle linux kube
Ahmed Mekawy
 
Python on exadata
Rainer Schuettengruber
 
Amending and Testing changes lab guide
openstackcisco
 
Eucalyptus on Xen - Build Enterprise Private Cloud | Torry Harris Whitepaper
Torry Harris Business Solutions
 
Oracle business intelligence enterprise edition 11g
uzzal basak
 
DevStack
Everett Toews
 
Install Solaris 11.1 on a Virtualbox VM
Laurent Leturgez
 
Installing WordPress on AWS
Manish Jain
 
Harmonia open iris_basic_v0.1
Yongyoon Shin
 
Installaling Puppet Master and Agent
Ranjit Avasarala
 
Vulnerability Exploitation in Docker Container Environments
FlawCheck
 

Viewers also liked (20)

PPTX
Adding Identity Management and Access Control to your Application, Authorization
Fernando Lopez Aguilar
 
PPTX
What is FIWARE Lab
Fernando Lopez Aguilar
 
PPTX
Federating new FIWARE Lab nodes
Fernando Lopez Aguilar
 
PDF
MLeap: Release Spark ML Pipelines
DataWorks Summit/Hadoop Summit
 
PPTX
Think Like Spark
Alpine Data
 
PPTX
Cloud Portal - Lesson 3. Launching an Instance
Álvaro Alonso González
 
PPTX
Fiware ops demo meeting (health) (06 07-15)
Fernando Lopez Aguilar
 
PPTX
Fiware ops demo meeting (health) (09 06-15)
Fernando Lopez Aguilar
 
PPTX
Cloud Portal - Lesson 2. Cloud Portal Overview
Álvaro Alonso González
 
PPTX
Cloud Portal - Lesson 1. Introduction
Álvaro Alonso González
 
PDF
Spark Uber Development Kit
DataWorks Summit/Hadoop Summit
 
PPTX
Spark meets Smart Meters
DataWorks Summit/Hadoop Summit
 
PPTX
Advanced Visualization of Spark jobs
DataWorks Summit/Hadoop Summit
 
PPTX
Adding Identity Management and Access Control to your Application, Account Ma...
Fernando Lopez Aguilar
 
PPTX
Faster Batch Processing with Cloudera 5.7: Hive-on-Spark is ready for production
Cloudera, Inc.
 
PDF
Clickstream Analysis with Spark
Josef Adersberger
 
PDF
Lessons Learned: Using Spark and Microservices
Alexis Seigneurin
 
PPTX
FIWARE Lab architecture, an open point to start the installation of a new region
Fernando Lopez Aguilar
 
PDF
Unit testing of spark applications
Knoldus Inc.
 
PPTX
Producing Spark on YARN for ETL
DataWorks Summit/Hadoop Summit
 
Adding Identity Management and Access Control to your Application, Authorization
Fernando Lopez Aguilar
 
What is FIWARE Lab
Fernando Lopez Aguilar
 
Federating new FIWARE Lab nodes
Fernando Lopez Aguilar
 
MLeap: Release Spark ML Pipelines
DataWorks Summit/Hadoop Summit
 
Think Like Spark
Alpine Data
 
Cloud Portal - Lesson 3. Launching an Instance
Álvaro Alonso González
 
Fiware ops demo meeting (health) (06 07-15)
Fernando Lopez Aguilar
 
Fiware ops demo meeting (health) (09 06-15)
Fernando Lopez Aguilar
 
Cloud Portal - Lesson 2. Cloud Portal Overview
Álvaro Alonso González
 
Cloud Portal - Lesson 1. Introduction
Álvaro Alonso González
 
Spark Uber Development Kit
DataWorks Summit/Hadoop Summit
 
Spark meets Smart Meters
DataWorks Summit/Hadoop Summit
 
Advanced Visualization of Spark jobs
DataWorks Summit/Hadoop Summit
 
Adding Identity Management and Access Control to your Application, Account Ma...
Fernando Lopez Aguilar
 
Faster Batch Processing with Cloudera 5.7: Hive-on-Spark is ready for production
Cloudera, Inc.
 
Clickstream Analysis with Spark
Josef Adersberger
 
Lessons Learned: Using Spark and Microservices
Alexis Seigneurin
 
FIWARE Lab architecture, an open point to start the installation of a new region
Fernando Lopez Aguilar
 
Unit testing of spark applications
Knoldus Inc.
 
Producing Spark on YARN for ETL
DataWorks Summit/Hadoop Summit
 
Ad

Similar to How to deploy spark instance using ansible 2.0 in fiware lab v2 (20)

PDF
Ansible at work
Bas Meijer
 
PPTX
Learn you some Ansible for great good!
David Lapsley
 
PDF
Automated Deployment and Configuration Engines. Ansible
Alberto Molina Coballes
 
PDF
Ansible, best practices
Bas Meijer
 
PPTX
Ansible: What, Why & How
Alfonso Cabrera
 
PDF
Ansible is the simplest way to automate. MoldCamp, 2015
Alex S
 
PDF
Ansible is the simplest way to automate. SymfonyCafe, 2015
Alex S
 
PDF
Ansible loves Python, Python Philadelphia meetup
Greg DeKoenigsberg
 
PDF
Ansible101
Hideki Saito
 
PDF
Using Ansible for Deploying to Cloud Environments
ahamilton55
 
PDF
Ansible nice-pdf-copy-for-pres
Manmohan Singh
 
PPTX
Mastering_Ansible_PAnsible_Presentation our score increases as you pick a
nareshmaranp
 
PPTX
Intro to-ansible-sep7-meetup
Ramesh Godishela
 
PDF
03 ansible towerbestpractices-nicholas
Khairul Zebua
 
PDF
ansible_rhel.pdf
ssuser6d347b
 
PDF
Automation with ansible
Khizer Naeem
 
PDF
WAG the Blog
Evan Volgas
 
PDF
Ansible Automation to Rule Them All
Tim Fairweather
 
PDF
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
Jumping Bean
 
PDF
Ansible - Introduction
Stephane Manciot
 
Ansible at work
Bas Meijer
 
Learn you some Ansible for great good!
David Lapsley
 
Automated Deployment and Configuration Engines. Ansible
Alberto Molina Coballes
 
Ansible, best practices
Bas Meijer
 
Ansible: What, Why & How
Alfonso Cabrera
 
Ansible is the simplest way to automate. MoldCamp, 2015
Alex S
 
Ansible is the simplest way to automate. SymfonyCafe, 2015
Alex S
 
Ansible loves Python, Python Philadelphia meetup
Greg DeKoenigsberg
 
Ansible101
Hideki Saito
 
Using Ansible for Deploying to Cloud Environments
ahamilton55
 
Ansible nice-pdf-copy-for-pres
Manmohan Singh
 
Mastering_Ansible_PAnsible_Presentation our score increases as you pick a
nareshmaranp
 
Intro to-ansible-sep7-meetup
Ramesh Godishela
 
03 ansible towerbestpractices-nicholas
Khairul Zebua
 
ansible_rhel.pdf
ssuser6d347b
 
Automation with ansible
Khizer Naeem
 
WAG the Blog
Evan Volgas
 
Ansible Automation to Rule Them All
Tim Fairweather
 
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
Jumping Bean
 
Ansible - Introduction
Stephane Manciot
 
Ad

More from Fernando Lopez Aguilar (20)

PDF
Introduction to FIWARE technology
Fernando Lopez Aguilar
 
PDF
DW2020 Data Models - FIWARE Platform
Fernando Lopez Aguilar
 
PPTX
FIWARE and Smart Data Models
Fernando Lopez Aguilar
 
PPTX
How to deploy a smart city platform?
Fernando Lopez Aguilar
 
PPTX
Building the Smart City Platform on FIWARE Lab
Fernando Lopez Aguilar
 
PDF
Data Modeling with NGSI, NGSI-LD
Fernando Lopez Aguilar
 
PDF
FIWARE and Robotics
Fernando Lopez Aguilar
 
PDF
Big Data and Machine Learning with FIWARE
Fernando Lopez Aguilar
 
PDF
Operational Dashboards with FIWARE WireCloud
Fernando Lopez Aguilar
 
PDF
Creating a Context-Aware solution, Complex Event Processing with FIWARE Perseo
Fernando Lopez Aguilar
 
PDF
FIWARE Identity Management and Access Control
Fernando Lopez Aguilar
 
PDF
Data persistency (draco, cygnus, sth comet, quantum leap)
Fernando Lopez Aguilar
 
PDF
How to debug IoT Agents
Fernando Lopez Aguilar
 
PDF
Core Context Management
Fernando Lopez Aguilar
 
PDF
What is an IoT Agent
Fernando Lopez Aguilar
 
PDF
FIWARE Overview
Fernando Lopez Aguilar
 
PDF
Overview of the FIWARE Ecosystem
Fernando Lopez Aguilar
 
PPTX
Cloud and Big Data in the agriculture sector
Fernando Lopez Aguilar
 
PDF
Berlin OpenStack Summit'18
Fernando Lopez Aguilar
 
PPTX
Context Information Management in IoT enabled smart systems - the basics
Fernando Lopez Aguilar
 
Introduction to FIWARE technology
Fernando Lopez Aguilar
 
DW2020 Data Models - FIWARE Platform
Fernando Lopez Aguilar
 
FIWARE and Smart Data Models
Fernando Lopez Aguilar
 
How to deploy a smart city platform?
Fernando Lopez Aguilar
 
Building the Smart City Platform on FIWARE Lab
Fernando Lopez Aguilar
 
Data Modeling with NGSI, NGSI-LD
Fernando Lopez Aguilar
 
FIWARE and Robotics
Fernando Lopez Aguilar
 
Big Data and Machine Learning with FIWARE
Fernando Lopez Aguilar
 
Operational Dashboards with FIWARE WireCloud
Fernando Lopez Aguilar
 
Creating a Context-Aware solution, Complex Event Processing with FIWARE Perseo
Fernando Lopez Aguilar
 
FIWARE Identity Management and Access Control
Fernando Lopez Aguilar
 
Data persistency (draco, cygnus, sth comet, quantum leap)
Fernando Lopez Aguilar
 
How to debug IoT Agents
Fernando Lopez Aguilar
 
Core Context Management
Fernando Lopez Aguilar
 
What is an IoT Agent
Fernando Lopez Aguilar
 
FIWARE Overview
Fernando Lopez Aguilar
 
Overview of the FIWARE Ecosystem
Fernando Lopez Aguilar
 
Cloud and Big Data in the agriculture sector
Fernando Lopez Aguilar
 
Berlin OpenStack Summit'18
Fernando Lopez Aguilar
 
Context Information Management in IoT enabled smart systems - the basics
Fernando Lopez Aguilar
 

Recently uploaded (20)

PPTX
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
PDF
AI security AI security AI security AI security
elite44
 
PPTX
美国电子毕业证帕克大学电子版成绩单UMCP学费发票办理学历认证
Taqyea
 
PPTX
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
PDF
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
PPTX
Networking_Essentials_version_3.0_-_Module_3.pptx
ryan622010
 
PDF
Empowering Local Language Email with IDN & EAI – Powered by XgenPlus
XgenPlus Technologies
 
PPTX
Academic Debate: Creation vs Evolution.pptx
JOHNPATRICKMARTINEZ5
 
PPTX
原版一样(LHU毕业证书)英国利物浦希望大学毕业证办理方法
Taqyea
 
PDF
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
PDF
google promotion services in Delhi, India
Digital Web Future
 
PDF
BRKAPP-1102 - Proactive Network and Application Monitoring.pdf
fcesargonca
 
PPTX
CHAPTER 1 - PART 3 FOR GRADE 11 STUDENTS
FSBTLEDNathanVince
 
PDF
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
PDF
Strategic Plan New and Completed Templeted
alvi932317
 
PPTX
原版一样(毕业证书)法国蒙彼利埃大学毕业证文凭复刻
Taqyea
 
PPTX
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
PPTX
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
PPTX
Meloniusk_Communication_Template_best.pptx
howesix147
 
PDF
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
AI security AI security AI security AI security
elite44
 
美国电子毕业证帕克大学电子版成绩单UMCP学费发票办理学历认证
Taqyea
 
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
Networking_Essentials_version_3.0_-_Module_3.pptx
ryan622010
 
Empowering Local Language Email with IDN & EAI – Powered by XgenPlus
XgenPlus Technologies
 
Academic Debate: Creation vs Evolution.pptx
JOHNPATRICKMARTINEZ5
 
原版一样(LHU毕业证书)英国利物浦希望大学毕业证办理方法
Taqyea
 
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
google promotion services in Delhi, India
Digital Web Future
 
BRKAPP-1102 - Proactive Network and Application Monitoring.pdf
fcesargonca
 
CHAPTER 1 - PART 3 FOR GRADE 11 STUDENTS
FSBTLEDNathanVince
 
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
Strategic Plan New and Completed Templeted
alvi932317
 
原版一样(毕业证书)法国蒙彼利埃大学毕业证文凭复刻
Taqyea
 
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
Meloniusk_Communication_Template_best.pptx
howesix147
 
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 

How to deploy spark instance using ansible 2.0 in fiware lab v2

  • 1. How to deploy Spark HA instance using Ansible 2.0 in FIWARE Lab Fernando López Aguilar Technological Expert. IT and Cloud Architect [email protected] @flopezaguilar
  • 2. 1
  • 3. 2 Cookies of the Dark Side • Use OpenStack locally. • Use Ansible. • Use both together.
  • 4. 3 Come to the Dark Side We use OpenStackClient
  • 5. 4 OpenStack client  Unified shell command structure and a common language to describe operations in OpenStack.  Remote interaction with any OpenStack environment (if it is open).  Easy install, just execute: pip install python-openstackclient.  Easy to use, just execute: $ openstack --help
  • 6. ubuntu@ubuntu:~/malaga$ sudo apt install python-pip … ubuntu@ubuntu:~/malaga$ sudo apt install virtualenv … ubuntu@ubuntu:~/malaga$ virtualenv env New python executable in /home/ubuntu/malaga/env/bin/python Installing setuptools, pip, wheel...done. ubuntu@ubuntu:~/malaga$ source env/bin/activate (env) ubuntu@ubuntu:~/malaga$ pip install > python-openstackclient … 5 OpenStackClient hands-on  Create a new directory (e.g. malaga)  If you do not have, install pip and virtualenv.  Create your virtualenv (virtualenv is a tool to create isolated Python environments).  Activate the isolated python environment.  Install the OpenStackClient
  • 7. 6 OpenStack client hands-on  After the installation you can execute the command shell openstack.  To obtain information about the openstack command and its subcommands, run it: $ openstack help [subcommand] $ openstack --help  Typing openstack switches to the interactive mode. Typing help [subcommand] for information. To exit the interactive mode, type quit.
  • 8. 7 OpenStack client hands-on • Next steps: we need the credentials of your OpenStack environment. • Just login into FIWARE Lab Cloud Portal (https://cloud.lab.fiware.org/) and get your data:
  • 9. ubuntu@ubuntu:~/malaga$ more [email protected] export [email protected] export OS_PASSWORD= export OS_TENANT_NAME="Fernando Lopez cloud” export OS_REGION_NAME=Spain2 export OS_AUTH_URL=http://130.206.84.8:4730/v3/ 8 OpenStackClient hands-on  File downloaded a file with format: <your user name>-openrc  Content:  OS_USERNAME  OS_PASSWORD  OS_TENANT_NAME  OS_REGION_NAME  OS_AUTH_URL
  • 10. export OS_PROJECT_DOMAIN_NAME=default export OS_USER_DOMAIN_NAME=default export OS_IDENTITY_API_VERSION=3 export PS1='(`basename "$VIRTUAL_ENV`)[u@FIWARE Lab W(keystone_user)]$ ’ ubuntu@ubuntu:~/malaga$ source [email protected] 9 OpenStackClient hands-on  You need to edit the file and add the following.  I suggest to add also the following line.  Move the file to your work directory and load it.
  • 11. 10 OpenStackClient hands-on  Your turn…  Get help about openstack client  Create a keypair.  List of keypairs.
  • 12. 11 THEY HAVE ANIBLE… !!! I’ve been to the dark side…
  • 13. 12 Ansible  Ansible is an IT automation tool.  Manages machines in an agent-less manner.  Uses of OpenSSH for transport and a YAML language.  Main focus in software deployment and system configuration.
  • 14. 13 What do you need to know?  Connect to a remote machine using SSH.  Interact with the bash command-line shell.  Install packages.  Use the sudo command.  Check and set file permissions.  Start and stop services.  Set environment variables.  Write scripts (any language).
  • 15. 14 Previous action  Install ansible (v 2.2.0.0)  Using openstackclient, deploy a server.  Create a keypair  Create security group an assign rule  Create a server
  • 16. 15 First steps with Ansible  Define inventory file (hosts).  INI-like format and looks like this::  <server name>: name of the server  ansible_ssh_host: IP of the server  ansible_ssh_user: user to access via ssh  ansible_ssh_private_key_file: key pair to access the server
  • 17. ubuntu@ubuntu:~/malaga$ ansible ansible-test -i hosts -m ping ansible-test | SUCCESS => { "changed": false, "ping": "pong" } 16 First steps with Ansible  Connect to the server named <server name> and invoke the ping module.
  • 18. 17 Time to do bigger things
  • 19. --- invoice: 12345 product: - id: 987 amount: 2 description: basketball ball - id: 760 amount: 1 description: football ball 18 Ansible  Process description in YAML description file.  YAML is a human friendly data serialization standard for all programming languages.  A deployment is described in a “playbook” (e.g.: deploy a web application).  A “playbook” can define several processes o deployments
  • 20. 19 Ansible inventory  Ansible works against multiple systems in your infrastructure at the same time.  By defaults, saved in the location /etc/ansible/hosts but can be specified a different inventory with –i command.  Not only is this inventory configurable, but you can also use multiple inventory files at the same time.  You can use a script to generate dynamically the inventory.
  • 21. 20 Using Variables: About Jinja2  Ansible allows you to reference variables in your playbooks using the Jinja2 templating system.  Example: in a simple template, you can do something like: My amp goes to {{ max_amp_value }}  This is also valid directly in playbooks: template: src=foo.cfg.j2 dest={{ remote_install_path }}/foo.cfg  Variables might be defined in YAML file (e.g. vars/main.yml)
  • 22. 21 Ansible modules  Ansible ships with a number of modules (called the ‘module library’).  They can be executed directly (-m option) on remote hosts or through Playbooks.  Users can also write their own modules.  These modules can control system resources, like services, packages, or files (anything really), or handle executing system commands.
  • 23. 22 Ansible roles  Instead of creating giant playbooks with hundreds of tasks we can use roles to organize tasks.  A role breaks task into smaller more discrete units of work.  A role is all the tasks, variables and handlers needed to complete the unit of work.  This allows a role to be completely self contained or encapsulated and completely reusable.  Example of role is the installation and configuration of NTPd service.
  • 25. 24 Where the hell is Spark…?
  • 26. 25 Spark  Apache Spark is a fast and general-purpose cluster computing system.  Provide high-level APIs in Java, Scala, Python and R.  Support a rich set of higher-level tools:  Spark SQL for SQL and structured data processing.  MLlib for machine learning.  GraphX for graph processing, and Spark Streaming.
  • 27. 26 Spark in HA  Creation of a Master node and several Slaves nodes.  Configuration of the instances.  Configuration of Spark nodes. …
  • 28. 27 Hands-on Spark deployment with Ansible  Clone the github repository https://github.com/flopezag/ansible_spark_openstack  Follow the instructions in README.md file  Take a look into /vars/main.yml file.
  • 29. 28 Yeah, if you could just, come to the dark side…
  • 30. 29 References  OpenStack Client Command List: http://docs.openstack.org/developer/python-openstackclient/command- list.html  Ansible documentation: http://docs.ansible.com/ansible/  FIWARE Lab Account portal: https://account.lab.fiware.org/idm/

Editor's Notes

  • #12: openstack keypair create spark > spark.pem openstack help
  • #14: An ansible is a fictional communication device that can transfer information faster than the speed of light. More specifically, Michael DeHaan took the name Ansible from the book Ender’s Game by Orson Scott Card. In that book, the ansible was used to control a large number of remote ships at once, over vast distances. Think of it as a metaphor for controlling remote servers.
  • #16: openstack keypair create spark > spark.pem     openstack security group create spark --description "internal security group for spark"     openstack security group rule create spark --protocol tcp --dst-port 1:65535 openstack server create --image base_ubuntu_14.04 --flavor 3  --security-group spark --key-name spark1 --nic net-id=473dacd2-42a6-4c1c-93e8-1b29f098846e ansible-test
  • #17: ansible-test ansible_ssh_host=130.206.122.3 ansible_ssh_user=ubuntu ansible_ssh_private_key_file=spark.pem
  • #20: YAML: YAML Ain't Markup Language
  • #25: Ansible Galaxy is Ansible’s official community hub for sharing Ansible roles. A role is the Ansible way of bundling automation content and making it reusable.
  • #29: --- # Set to absent to take down machines instance_state: present # Number of workers to spawn in the cluster nbr_of_slaves: 2 # The name of the key pair you will use to log in # as set in OpenStack (see the OpenStack security dashboard) key_name: spark # Id of the networks to run in (can be found in the OpenStack # dashboard) network_internal_name: node-int-net-01 network_external_name: public-ext-net-01 # This is the ssh-key which will be distritbuted # across the cluster. It' important that this key # does NOT use password protection ssh_keys_to_use: files/cloud ssh_public_key: files/cloud.pub # This is a ugly hack - but you have to give the # file name of the ssh-key your referencing above name_of_ssh_key: cloud # Name of the user used to install everything # on the remote systems user: ubuntu # Name of hadoop user hadoop_user: ubuntu