Contrail plugin puppet manifests added

This commit contains the puppet code, files and templates
involved in plugin tasks.

Change-Id: Ib0569d8d99debdf0d3eaf37ae056a82fd1c07b41
This commit is contained in:
Oleksandr Martsyniuk 2015-02-24 20:18:17 +02:00
parent e4216a20a9
commit 9ce02bc723
15 changed files with 159 additions and 15 deletions

View File

@ -1,4 +0,0 @@
#!/bin/bash
# It's a script which deploys your plugin
echo contrail > /tmp/contrail

View File

@ -0,0 +1,5 @@
class { contrail::packages:
install => ['python-crypto','python-netaddr','python-paramiko',
'contrail-fabric-utils','contrail-setup'],
responsefile => 'contrail.preseed',
}

View File

@ -0,0 +1 @@
include contrail

View File

@ -0,0 +1,4 @@
sun-java6-plugin shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
debconf shared/accepted-oracle-license-v1-1 select true
debconf shared/accepted-oracle-license-v1-1 seen true

View File

@ -0,0 +1,36 @@
class contrail {
$settings = hiera('contrail')
$role = hiera('role')
$node_name = hiera('user_node_name')
case $role {
/^*.controller$/: {
class { contrail::packages:
install => ['python-paramiko, contrail-fabric-utils, contrail-setup'],
}
}
/^compute$/: {
class { contrail::packages:
install => 'contrail-openstack-vrouter',
remove => ['openvswitch-common','openvswitch-datapath-lts-saucy-dkms','openvswitch-switch',
'nova-network','nova-api'],
}
}
/^base-os$/: {
case $node_name {
/^contrail.\d+$/: {
class { contrail::packages:
install => ['python-crypto','python-netaddr','python-paramiko',
'contrail-fabric-utils','contrail-setup'],
responsefile => 'contrail.preseed',
}
}
default: {
notify { "This is not a contrail controller node. Plugin tasks aborted": }
}
}
}
}
}

View File

@ -0,0 +1,53 @@
# requires
# puppetlabs-apt
# puppetlabs-stdlib
class contrail::packages (
$master_ip = hiera('master_ip'),
$master_port = '8080',
$plugin_version = $contrail::settings['metadata']['plugin_version'],
$install = undef,
$remove = undef,
$responsefile = undef,
) {
class { 'apt': disable_keys => true }
apt::source { 'contrail-from-fuel-master':
location => "http://${master_ip}:${master_port}/contrail-${plugin_version}/repositories/ubuntu/",
release => '',
repos => '/',
include_src => false,
require => Apt::Pin['ubuntu'],
}
apt::pin { 'ubuntu':
order => 10,
priority => 100,
label => 'Ubuntu',
packages => '*',
}
if ($responsefile) {
file { "/var/cache/debconf/${responsefile}" :
ensure => file,
source => "puppet:///modules/contrail/${responsefile}",
before => Package[$install],
}
}
if ($install) {
package { $install:
ensure => present,
require => Apt::Source['contrail-from-fuel-master'],
}
}
if ($remove) {
package { $remove:
ensure => absent,
require => Apt::Source['contrail-from-fuel-master'],
}
}
}

View File

@ -1,5 +1,16 @@
#!/bin/bash
# Add here any the actions which are required before plugin build
# like packages building, packages downloading from mirrors and so on.
# The script should return 0 if there were no errors.
set -eux
ROOT="$(dirname `readlink -f $0`)"
MODULES="${ROOT}"/deployment_scripts/puppet/modules
mkdir -p "${MODULES}"
REPO_PATH='https://github.com/stackforge/fuel-library/tarball/f43d885914d74fbd062096763222f350f47480e1'
RPM_REPO="${ROOT}"/repositories/centos/
DEB_REPO="${ROOT}"/repositories/ubuntu/
wget -qO- "${REPO_PATH}" | \
tar -C "${MODULES}" --strip-components=3 -zxvf - \
stackforge-fuel-library-f43d885/deployment/puppet/{apt,inifile,stdlib}

View File

@ -1,22 +1,60 @@
# This tasks will be applied on controller nodes,
# This tasks will be applied on slave nodes,
# here you can also specify several roles, for example
# ['cinder', 'compute'] will be applied only on
# cinder and compute nodes
- role: ['base-os']
stage: pre_deployment
type: shell
type: puppet
parameters:
cmd: ./deploy.sh
timeout: 42
puppet_manifest: puppet/manifests/site-contrail-pre.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- role: ['base-os']
stage: post_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/site-contrail-post1.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- role: ['base-os']
stage: post_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/site-contrail-post2.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- role: ['base-os']
stage: post_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/site-contrail-post3.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- role: ['controller']
stage: post_deployment
type: shell
type: puppet
parameters:
cmd: echo contrail-plugin-post > /tmp/plugin.txt
timeout: 42
puppet_manifest: puppet/manifests/site-controller-post.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- role: ['compute']
stage: post_deployment
type: shell
type: puppet
parameters:
cmd: echo contrail-plugin-post > /tmp/plugin.txt
timeout: 42
puppet_manifest: puppet/manifests/site-compute-post.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- role: ['base-os']
stage: post_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/site-contrail-post4.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- role: ['base-os']
stage: post_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/site-contrail-post5.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720