Developers Club geek daily blog

2 years, 4 months ago
Information technologies become an integral part of products and services of new IT style in which business expects to receive the requested resources under new applications almost instantly. IT resources, in a paradigm of new requirements from modern applications, have to be selected, used, return and be reused automatically from the general pool of nodes of calculations, storage, and a network.

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Such infrastructure can have the different types of hardware platforms abstracted under a single system of management. This approach is called "infrastructure as a code" (infrastructure-as-code). Vision of the Hewlett Packard Enterprise company is the movement to Composable (Made) to Infrastructure — a flexible pool of resources from which, under control of the manager of HPE OneView by means of templates and API, there is an expansion, service and control of applications.

To implement the concept of Composable of Infrastructure and to automate expansions of environments for business applications, HPE integrated the practices with the known software developer for management of configurations of the CHEF Software applications.

CHEF (Shef) — the management system configurations written on Ruby and Erlang with use of a domain-specific language for the description of configurations. It is used for simplification of problems of setup and support of a set of servers and it can be integrated into cloud platforms for control automation current and automation of process of setup of new servers.

The user of CHEF creates certain "recipes" with the description of how to operate server applications (for example, Apache, MySQL or Hadoop) and their settings.

"Recipe" is a description of a status of resources of system in which it has to be in a specific timepoint, including the set packets, the started services, the created files. CHEF checks that each of resources of system is configured correctly and tries to correct a resource status if it does not correspond to expected.

"Recipes" are used as for management of Linux-nodes, and Windows (in the last releases)

The driver of expansion of CHEF for HPE OneView, allows IT administrators to use "recipes" of CHEF to automate process of physical expansion as physical medium, including servers, network connections, storage, and expansion of operating systems and applications. Such integration increases return speed for business and increases reliability of expansion, thanks to automation of all steps.

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 1 — the Scheme of interaction of the CHEF driver with HPE OneView
To create fast and effective IT infrastructure the organization has to transform traditional physical systems to flexible pools of physical and virtual resources.

In process of such transformation the organization often faces difficulties in automation of expansion of "bare metal" of the physical equipment. Expansion always difficult process. He demands installation and preparation of hardware, connections, OS and application stack on the equipment, suitable for this task. These processes often demand manual control and monitoring that takes a lot of time and can lead to emergence of errors.

Here also the idea of Composable of infrastructure appears. In such infrastructure there is a flexible pool of calculators, storages and networks, resources in it are selected, increase, decrease, are reused dynamically, using the program defined approach. In a portfolio of the solutions Hewlett Packard Enterprise all products of servers, storage systems and data transmission networks were specially developed for embedding in such program defined infrastructure.

For example, each server is equipped with the iLO chip that allows to collect without installation of agents in OS a status of all equipment rooms a component and to configure interaction with the server. Storage systems and network devices in a portfolio of the solutions Hewlett Packard Enterprise understand the open API RESTful standard. It was necessary to create a product which would be capable to integrate all practices in the hardware of a portfolio and to create a full-fledged orkestrator which will be able to manage all infrastructure of TsODa. OneView which is let out in October, 2013 became it products.
 

HPE OneView


Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 2 — HPE OneView Environment
HPE OneView — the software product of a full stroke of management of modern DPC: uses connectors for network management, servers and storage systems, Hewlett Packard Enterprise constructed on products, Brocade, some Cisco switches, it is integrated into all known hypervisors and can address them for expansion of virtual environments.

It is delivered in the form of an image of the Vmware or Hyper-v virtual computer and it can be unrolled on any equipment with support of these hypervisors. HPE OneView has the clear and simple interface in mastering which can be adapted under certain groups of administrators, adding or cleaning components the graphic console. In addition, HPE OneView can be integrated with infrastructure of TsODa — UPS, PDU (Schneider Electric, Eaton, etc.), racks, allowing to receive a three-dimensional picture of what occurs in server halls and to manage movement of applications or virtual computers, based on data retrieveds.

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 3 — the Temperature card of DPC in OneView
The administrator can construct the card of interaction of devices in the OneView interface:

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 4 — Communications of elements of a server architecture
HPE OneView replaces entirely 5 previous products of management of a server framework: HP SIM, Insight Control, Onboard Administrator, VCM, HPSUM.
 
In version 2.0 HPE OneView expanded the opportunities — there was a functionality of migration of profiles (the IP, WWN, MAC settings of addresses and other parameters) of the server about one blade compartment on another, as between compartments with identical a blade servers (the same types of processors, memories, network adapters), and between compartments with different generations a blade servers with different generations of CPU, the LAN and FC type of adapters. And, such migration is possible now not only within one blade basket, but also between several.

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 5 — New opportunities for migration of profiles in OneView 2.0
HPE OneView allows administrators to use templates and profiles for implementation at the enterprise of idea of the program defined architecture or an infrastructure-as-code (infrastructure-as-code).

The templates delivered together with OneView can are easily adapted and changed under different applications and proceeding from specifics of the equipment in each case.
 
These templates are recommended to be used in approach of DevOps because they reduce time of expansion of infrastructure for developers and eliminate a mismatch between representatives of department of IT, allowing to begin to test applications in read minutes.

Expansion steps


To show a possibility of the automated expansion of applications "from scratch", using possibilities of OneView and CHEF it is necessary to execute several steps.
 
Expansion of the physical server, using HPE OneView
 
For this purpose we come into the HPE OneView — Server Profiles — Create Profile console. Also we receive approximately such window:

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 6 — Creation of a profile in OneView
In this scenario the name of a profile is set by "Web Server Template", parameters a blade basket, a blade server, network connections, based on specific models of the equipment in your TsODe are filled.

We click "Create" and we save a profile. Further it is necessary to install the driver of integration of CHEF and OneView.

Expansion of OS, using a template in OneView
We load a script of "chef-settings-Linux" from the website GitHub. We change the following values in a script:

CHEF_PROXYSERVER: the proxy server address 
YUM_REPOSITORY_INFO: the yum repository information 
CHEF_CERT: the SSH certificate information to be copied into the authorization files 
LOGIN_DISABLED: should be set to YES/yes to disable user login and NO/no if LOGIN using username/password should not be disabled

This script needs to be built in a packet of expansion of OS — OS Build Plan. In more detail about creation of OS Build Plan here and here.
 
Application stack configuration, using Cookbook (cookbook) of CHEF
Further we create the cookbook and the recipe in CHEF. What main tool of the chef? Knife!
The first file of the recipe will have the same name, we find it https://github.com/HewlettPackard/chef-provisioning-oneview#prerequisites and we fill all parameters of your environment.
 
The following step we create the recipe, replacing parameters of the code given below on actual for your environment:

require 'chef/provisioning'
with_driver 'oneview'
with_chef_server "<a href="https://my-chef.my-domain.com/organizations/my-org">https://my-chef.my-domain.com/organizations/my-org</a>",
 :client_name => Chef::Config[:node_name],
 :signing_key_filename => Chef::Config[:client_key]
machine 'web01' do
 recipe 'my_server_cookbook::default'
 machine_options :driver_options => {
 :server_template => 'Web Server Template',
 :os_build => 'CHEF-RHEL-6.5-x64',
 :host_name => 'chef-web01',
 :ip_address => 'xx.xx.xx.xx',
 :domainType => 'workgroup',
 :domainName => 'sub.domain.com',
 :mask => '255.255.255.0',
 :dhcp => false,
 :gateway => 'xx.xx.xx.1',
 :dns => 'xx.xx.xx.xx,xx.xx.xx.xx,xx.xx.xx.xx',
 :connections => {
 #1 => { ... } (Reserved for PXE on our setup)
 2 => {
 :ip4Address => 'xx.xx.xx.xx',
 :mask => '255.255.254.0', # Optional
 :dhcp => false
 :gateway => 'xx.xx.xx.1' # Optional
 :dns => 'xx.xx.xx.xx' # Optional
 }
 },
 :custom_attributes => {
 :chefCert => 'ssh-rsa AA...' # Optional
 }
 },
 :transport_options => {
 :user => 'root', # Optional. Defaults to 'root'
 :ssh_options => {
 :password => Chef::Config.knife[:node_root_password]
 }
 },
 :convergence_options => {
 :ssl_verify_mode => :verify_none, # Optional
 :bootstrap_proxy => '<a href="http://proxy.domain.com:8080/">http://proxy.domain.com:8080</a>' # Optional
 }
 chef_environment '_default'
 converge true
end

We unroll! Now, when all is ready, we start final part. CHEF will use the created recipe and together with the OneView driver complete expansion of the Web server "from scratch" will be carried out.

In the CHEF console it is necessary to rise on the directory containing the recipe and to execute command:
 
$ bundle exec chef-client -z путь_к_рецепту.rb

Let's glance in the OneView console and we will look how there is an expansion of our application:

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 7 — it is silent, there is an expansion!
When expansion is complete — we will check that all components are installed and configured correctly:

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 8 — we Check parameters
Now we switch in the CHEF console and we check that the node is really created with use of the recipe of CHEF:

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 9 — CHEF knows about this node too
Also we check that the serial number is assigned to the server, on it Apache is configured and Apache Webserver how many it was required to time and what were taken steps is lifted:

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 10 — the Majority a component are initialized in seconds!
The fact that this server is visible in the console now means that it is correctly configured and sends information on itself. Time to be convinced that the application really works came, for this purpose we address Webserver in the browser:

Recipes from CHEFa: the automated expansion of environments of business applications with use of HPE OneView

Fig. 11 — Webserver is live and ready to work!
The mechanics of expansion in HPE OneView consists of 5 steps:

1. We select compatible server hardware from a pool of the available servers managed by HPE OneView, using search of HPE OneView REST API.

2. We create a new template of a profile of the server, using HPE OneView REST API and we assign:

   A. Version of a firmware, BIOS, configuration of local storage: HPE OneView uses the built-in HP Intelligent Provisioning (IP), Linux environment for PXE boot which is built already in iLO baseboard management card (BMC) the processor, SmartStart.

   B. Network connections: HPE OneView uses the network virtual connect platform for dynamic view of network connections for servers from a pool of network connections.

   C. SAN network: HPE OneView automates representation of the SAN network for HPE 3PAR storage and for the switches Fibre Channel, including Brocade, Cisco and HPE Networking.

3. The selected OS is unrolled as soon as providing physical resources is ended:

   A. The server profile is configured on loading of an installation image on a network.

   B. The server turns on and loading of PXE boot begins.

   C. The OneView driver starts the OS installation, using HPE OneView REST API (Insight Control server provisioning).

4. Network parameters are set

   A. IP addresses, subnets, a name of hosts, etc. for different network adapters and virtual network adapters, allowing to create difficult network configurations.

5. CHEF develops application stack over the unrolled OS

   A. Loading of the client of CHEF on the server, after that the client of CHEF is registered on the CHEF server.

   B. Start of the client of CHEF on the new server which tightens necessary "cookbook" from the CHEF server and applies the recipe to a server Web configuration.

Video of process of expansion:



As we see — using recipes of CHEF, together with equipment rooms and Hewlett Packard Enterprise software products, it is possible to receive simple, open and completely automated an infrastructure-as-code for expansion of applications. Be not afraid to experiment, only this way it is possible to become this chief of IT of kitchen!
 
For independent studying: WangTuFriFo

Thanks for attention!

This article is a translation of the original post at habrahabr.ru/post/273605/
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here: sysmagazine.com@gmail.com.

We believe that the knowledge, which is available at the most popular Russian IT blog habrahabr.ru, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.

comments powered by Disqus