diff options
| author | YangHaibo <b40869@freescale.com> | 2014-12-03 17:07:56 +0800 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-12-18 12:59:52 -0500 |
| commit | 733213218602067a6077b810d44edc025b1fa741 (patch) | |
| tree | 3fe39096eae7e5ae555ec9f1cd0969b8cc25083f /meta-openstack | |
| parent | 12374d96e4b6130bdd26cb9b688c2ddc95f77d0d (diff) | |
| download | meta-cloud-services-733213218602067a6077b810d44edc025b1fa741.tar.gz | |
puppet: add recipe for puppet 3.7.3
A simple demo is added
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack')
3 files changed, 129 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/puppet/README b/meta-openstack/recipes-support/puppet/README new file mode 100644 index 0000000..2de808a --- /dev/null +++ b/meta-openstack/recipes-support/puppet/README | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | What is Puppet | ||
| 2 | ------------------------ | ||
| 3 | Puppet is a configuration management system that allows you to define the | ||
| 4 | state of your IT infrastructure, then automatically enforces the correct state. | ||
| 5 | |||
| 6 | |||
| 7 | Basic Requirements | ||
| 8 | ------------------------ | ||
| 9 | Ruby 1.8.7 or later | ||
| 10 | Facter 1.7.0 or later | ||
| 11 | Hiera 1.0 or later | ||
| 12 | The json gem (any modern version) | ||
| 13 | |||
| 14 | |||
| 15 | Simple Demo | ||
| 16 | ------------------------ | ||
| 17 | In this simple demo, we have a CA master server named 'master' and ip is 192.168.2.83 | ||
| 18 | and an agent node named 'agent', ip is 192.168.2.30. | ||
| 19 | |||
| 20 | On master server, file 'test.cfg' is under /etc/puppet/files/, puppet will sync this | ||
| 21 | file to /opt/ folder on agent node. | ||
| 22 | |||
| 23 | Step 1: Configure Puppet CA Master Server | ||
| 24 | 1) create a puppet group and user | ||
| 25 | $ puppet resource group puppet ensure=presnt | ||
| 26 | $ puppet resource user puppet ensure=present gid=puppet shell='/sbin/nologin' | ||
| 27 | |||
| 28 | 2) create the CA certificate and the puppet master certificate | ||
| 29 | $ puppet master --verbose --no-daemonize | ||
| 30 | (Once it says Notice: Starting Puppet master version <VERSION>, type ctrl-C to kill the process) | ||
| 31 | |||
| 32 | 3) $ vi /etc/hosts | ||
| 33 | add new line: | ||
| 34 | 192.168.2.30 agent | ||
| 35 | |||
| 36 | 4) start puppet master | ||
| 37 | $ puppet master --verbose --no-daemonize & | ||
| 38 | |||
| 39 | |||
| 40 | Step 2: Config Puppet Agent Node | ||
| 41 | 1) Edit puppet.conf | ||
| 42 | $ echo "[main] | ||
| 43 | server = master" >> /etc/puppet/puppet.conf | ||
| 44 | |||
| 45 | 2) $ vi /etc/hosts | ||
| 46 | add new line: | ||
| 47 | 192.168.2.83 master | ||
| 48 | |||
| 49 | 3) Request certificates | ||
| 50 | $ puppet agent --test --ca_server=t2080qds -w 60 | ||
| 51 | (Accept the request on master server by this command: puppet cert sign --all) | ||
| 52 | |||
| 53 | |||
| 54 | Step 3: Add site map on master | ||
| 55 | 1) Edit /etc/puppet/fileserver.conf to make /etc/puppet/files available | ||
| 56 | $ mkdir /etc/puppet/files | ||
| 57 | $ touch /etc/puppet/files/test.cfg | ||
| 58 | $ vi /etc/puppet/fileserver.conf | ||
| 59 | add following lines: | ||
| 60 | [extra_files] | ||
| 61 | path /etc/puppet/files | ||
| 62 | allow * | ||
| 63 | |||
| 64 | 2) Add a new sitemap | ||
| 65 | $ vi /etc/puppet/manifests/site.pp | ||
| 66 | add follwing lines: | ||
| 67 | file | ||
| 68 | { "/opt/test.cfg": | ||
| 69 | source => "puppet:///extra_files/test.cfg", | ||
| 70 | } | ||
| 71 | |||
| 72 | |||
| 73 | Step 4: Run puppet on agent | ||
| 74 | $ puppet agent --test | ||
| 75 | $ ls /opt/ | ||
diff --git a/meta-openstack/recipes-support/puppet/puppet/add_puppet_gemspec.patch b/meta-openstack/recipes-support/puppet/puppet/add_puppet_gemspec.patch new file mode 100644 index 0000000..a5c8e3b --- /dev/null +++ b/meta-openstack/recipes-support/puppet/puppet/add_puppet_gemspec.patch | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | diff -urN puppet-3.7.3_ori/puppet.gemspec puppet-3.7.3/puppet.gemspec | ||
| 2 | --- puppet-3.7.3_ori/puppet.gemspec 1970-01-01 08:00:00.000000000 +0800 | ||
| 3 | +++ puppet-3.7.3/puppet.gemspec 2014-11-12 14:30:07.000000000 +0800 | ||
| 4 | @@ -0,0 +1,19 @@ | ||
| 5 | +$:.unshift(File.dirname(__FILE__) + '/lib') | ||
| 6 | +require 'puppet/version' | ||
| 7 | + | ||
| 8 | +Gem::Specification.new do |s| | ||
| 9 | + s.name = 'puppet' | ||
| 10 | + s.version = Puppet::PUPPETVERSION | ||
| 11 | + s.platform = Gem::Platform::RUBY | ||
| 12 | + s.summary = 'Open source Puppet is a configuration management system' | ||
| 13 | + s.description = s.summary | ||
| 14 | + s.author = 'Yang Haibo' | ||
| 15 | + s.email = 'b40869@freescale.com' | ||
| 16 | + s.homepage = 'https://puppetlabs.com/puppet/puppet-open-source' | ||
| 17 | + s.license = 'Apache 2.0' | ||
| 18 | + | ||
| 19 | + s.bindir = 'bin' | ||
| 20 | + s.executables = ['puppet', 'extlookup2hiera'] | ||
| 21 | + s.require_path = 'lib' | ||
| 22 | + s.files = %w(LICENSE README.md Rakefile) + Dir.glob('{lib,spec}/**/*') | ||
| 23 | +end | ||
diff --git a/meta-openstack/recipes-support/puppet/puppet_3.7.3.bb b/meta-openstack/recipes-support/puppet/puppet_3.7.3.bb new file mode 100644 index 0000000..afd9a23 --- /dev/null +++ b/meta-openstack/recipes-support/puppet/puppet_3.7.3.bb | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | SUMMARY = "Open source Puppet is a configuration management system" | ||
| 2 | HOMEPAGE = "https://puppetlabs.com/puppet/puppet-open-source" | ||
| 3 | LICENSE = "Apache-2.0" | ||
| 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=f257790c70561550fd666c6e0044fd89" | ||
| 5 | |||
| 6 | SRC_URI = " \ | ||
| 7 | https://downloads.puppetlabs.com/puppet/puppet-${PV}.tar.gz \ | ||
| 8 | file://add_puppet_gemspec.patch \ | ||
| 9 | " | ||
| 10 | SRC_URI[md5sum] = "cc294da1d51df07bcc7f6cf78bd90ce0" | ||
| 11 | SRC_URI[sha256sum] = "4a3bd7ddb51072c3dd898a8de158cde204a2d8fd0b84e8ac806b84c074348637" | ||
| 12 | |||
| 13 | inherit ruby | ||
| 14 | |||
| 15 | DEPENDS += " \ | ||
| 16 | ruby \ | ||
| 17 | facter \ | ||
| 18 | hiera \ | ||
| 19 | " | ||
| 20 | |||
| 21 | RUBY_INSTALL_GEMS = "puppet-${PV}.gem" | ||
| 22 | |||
| 23 | do_install_append() { | ||
| 24 | install -d ${D}${sysconfdir}/puppet | ||
| 25 | install -d ${D}${sysconfdir}/puppet/manifests | ||
| 26 | install -d ${D}${sysconfdir}/puppet/modules | ||
| 27 | |||
| 28 | install -m 655 ${S}/conf/auth.conf ${D}${sysconfdir}/puppet/ | ||
| 29 | install -m 655 ${S}/conf/fileserver.conf ${D}${sysconfdir}/puppet/ | ||
| 30 | install -m 655 ${S}/conf/tagmail.conf ${D}${sysconfdir}/puppet/ | ||
| 31 | } | ||
