[Puppet] Puppet-master demo

Change-Id: I0becebfb46fd046f4d93ec14f1daf1aa26065023
This commit is contained in:
Alexey Khivin 2016-06-29 02:45:36 +03:00
parent cb593cf5b7
commit 1801f262c9
5 changed files with 281 additions and 0 deletions

View File

@ -0,0 +1,50 @@
Puppet Master Support for Murano
================================
Puppet is an open-source configuration management tool. It runs on many
Unix-like systems as well as on Microsoft Windows, and includes its own
declarative language to describe system configuration.
This application is a demonstration of Puppet Library capabilities.
Application creates a set of nodes and connects them to a puppet master.
Every name in the list of the nodes names is the cert name in the puppet
master. Dependencies can be installed by pointing Puppetfile which
will be used to install modules by librarian-puppet. All nodes
are included in the "production" environment and that is the only
environment. Cron runs puppet-agent twice in an hour.
Tested under Ubuntu 14.04 Murano image.
Usage example
^^^^^^^^^^^^^
As an example of input data you can use:
Nodes list::
server
slave1
slave2
Puppetfile link::
http://paste.openstack.org/raw/529624/
Main manifest::
modules/puppettest/manifests/
The resulting environment contains GoCD server with a slaves connected.
GoCD server will run on "server" node on port :8153
Known issues
^^^^^^^^^^^^
Cron runs puppet-agent twice in an hour and agents do not run during deployment.
You can wait while cron will run puppet agents or run them manually by executing::
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --no-daemonize --verbose --no-splay

View File

@ -0,0 +1,131 @@
Namespaces:
=: org.openstack.ci_cd_pipeline_murano_app.puppet
std: io.murano
res: io.murano.resources
sys: io.murano.system
ci_cd_pipeline_murano_app: org.openstack.ci_cd_pipeline_murano_app
puppet: org.openstack.ci_cd_pipeline_murano_app.puppet
net: org.openstack.ci_cd_pipeline_murano_app.utils.net
Name: PuppetMasterApplication
Extends: std:Application
Properties:
server:
Contract: $.class(puppet:PuppetInstance)
Usage: InOut
clients:
Contract:
- $.class(puppet:PuppetClient)
Usage: InOut
name:
Contract: $.string().notNull()
Default: 'PuppetMaster'
puppetfileLink:
Contract: $.string().notNull()
nodesStr:
Contract: $.string().notNull()
manifest:
Contract: $.string().notNull()
flavor:
Contract: $.string().notNull()
osImage:
Contract: $.string().notNull()
keyPair:
Contract: $.string().notNull()
availabilityZone:
Contract: $.string().notNull()
assignFloatingToMaster:
Contract: $.bool().notNull()
assignFloatingToSlaves:
Contract: $.bool().notNull()
Methods:
initialize:
Body:
- $._environment: $.find(std:Environment).require()
deploy:
Body:
- $._environment.reporter.report($this, 'Using Puppetfile to install={0}'.format($this.puppetfileLink))
- $nodes: $this.nodesStr.split()
- $._environment.reporter.report($this, 'Nodes list={0}'.format($nodes))
- $rules:
- FromPort: 1
ToPort: 65535
IpProtocol: tcp
External: false
- FromPort: 1
ToPort: 65535
IpProtocol: tcp
External: true
# puppet master port
- FromPort: 8140
ToPort: 8140
IpProtocol: tcp
External: false
- $this._environment.securityGroupManager.addGroupIngress(rules => $rules)
- Parallel:
- If: $.server = null
Then:
- $this.server: new(puppet:PuppetInstance, $this._environment,
name => 'master',
flavor => $this.flavor,
image => $this.osImage,
keyname => $this.keyPair,
availabilityZone => $this.availabilityZone,
assignFloatingIp => $this.assignFloatingToMaster)
- $this.server.deploy()
- If: len($this.clients) = 0
Then:
- $this.clients: $nodes.select(
new( puppet:PuppetClient, $this._environment,
instance => new( puppet:PuppetInstance, $this._environment,
name => concat('puppet_', $),
flavor => $this.flavor,
image => $this.osImage,
keyname => $this.keyPair,
availabilityZone => $this.availabilityZone,
assignFloatingIp => $this.assignFloatingToSlaves),
role => $))
- $this.clients.pselect($.instance.deploy())
- $master: new( puppet:PuppetServer,
masterInstance => $this.server,
environment => $this._environment,
manifest => $this.manifest)
# add every node with the role assigned to it
- $this.clients.select(
$master.addClient($))
- $master.configure()
- $master.installDependencies(
environment => 'production',
puppetfileLink => $this.puppetfileLink)
- $this._environment.reporter.report(
$this,
'Puppet master can be accessed on {0}'.format($.server.floatingIpAddress))
- $this.clients.select($this._environment.reporter.report($this,
'{0} can be accessed on {1}'.format(
$.role,
$.instance.floatingIpAddress)))

View File

@ -0,0 +1,83 @@
Version: 2
Application:
?:
type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetMasterApplication
nodesStr: $.manifest.nodes
puppetfileLink: $.manifest.puppetfileLink
manifest: $.manifest.manifest
flavor: $.instanceConfiguration.flavor
osImage: $.instanceConfiguration.osImage
keyPair: $.instanceConfiguration.keyPair
availabilityZone: $.instanceConfiguration.availabilityZone
assignFloatingToMaster: $.instanceConfiguration.assignFloatingToMaster
assignFloatingToSlaves: $.instanceConfiguration.assignFloatingToSlaves
Forms:
- manifest:
fields:
- name: nodes
type: text
label: Nodes list
description: >-
List of the nodes name. Every line means separate node connected to puppet
master with the same certificate name
- name: puppetfileLink
type: string
label: Puppetfile link
description: >-
Direct link to a Puppetfile
- name: manifest
type: string
label: Main manifest
description: >-
The file or directory which contains main manifest for your environment
- instanceConfiguration:
fields:
- name: title
type: string
required: false
hidden: true
description: Specify some instance parameters on which the application would be created
- name: flavor
type: flavor
label: Instance flavor
description: >-
Select registered in Openstack flavor. Consider that application performance
depends on this parameter.
initial: m1.medium
required: false
- name: osImage
type: image
imageType: linux
label: Instance image
description: >-
Select a valid image for the application. Image should already be prepared and
registered in glance.
- name: keyPair
type: keypair
label: Key Pair
description: >-
Select a Key Pair to control access to instances. You can login to
instances using this KeyPair after the deployment of application.
required: false
- name: availabilityZone
type: azone
label: Availability zone
description: Select availability zone where the application would be installed.
required: false
- name: assignFloatingToMaster
type: boolean
label: Assign floating to master node
description: Assign floating to Puppet master node
initial: true
required: false
- name: assignFloatingToSlaves
type: boolean
label: Assign floating to slaves nodes
description: Assign floating to an every slave node
initial: true
required: false

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,17 @@
Format: 1.2
Type: Application
FullName: org.openstack.ci_cd_pipeline_murano_app.PuppetMasterApplication
Name: PuppetMasterApplication
Description: |
Puppet is an open-source configuration management tool. It runs on many
Unix-like systems as well as on Microsoft Windows, and includes its own
declarative language to describe system configuration.
Author: 'Mirantis, Inc'
Tags: [Server, Puppet]
Classes:
org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetMasterApplication: PuppetMasterApplication.yaml
UI: ui.yaml
Logo: logo.png
Require:
org.openstack.ci_cd_pipeline_murano_app.puppet.Puppet:
org.openstack.ci_cd_pipeline_murano_app.utils.CiCdUtils: