From d8c233d89d2d16a110ae908ed6767b59d19c88cf Mon Sep 17 00:00:00 2001 From: Matthias Crauwels Date: Fri, 10 Feb 2017 14:54:17 +0100 Subject: [PATCH 1/3] added support for managing the packagecloud repo's added packagecloud module as a dependency --- manifests/init.pp | 3 +++ manifests/params.pp | 3 +++ manifests/repo.pp | 23 +++++++++++++++++ metadata.json | 62 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 manifests/repo.pp create mode 100644 metadata.json diff --git a/manifests/init.pp b/manifests/init.pp index acd1321..5adc069 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,6 +9,7 @@ $package_ensure = $orchestrator::params::package_ensure, $package_manage = $orchestrator::params::package_manage, $package_name = $orchestrator::params::package_name, + $repo_manage = $orchestrator::params::repo_manage, $service_enable = $orchestrator::params::service_enable, $service_ensure = $orchestrator::params::service_ensure, $service_manage = $orchestrator::params::service_manage, @@ -20,6 +21,7 @@ validate_string($package_ensure) validate_bool($package_manage) validate_array($package_name) + validate_bool($repo_manage) validate_bool($service_enable) validate_string($service_ensure) validate_bool($service_manage) @@ -28,6 +30,7 @@ # Using anchor pattern based on known issue: # http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html#known-issues anchor { 'orchestrator::begin': } -> + class { '::orchestrator::repo': } -> class { '::orchestrator::install': } -> class { '::orchestrator::config': } ~> class { '::orchestrator::my_cnf': } ~> diff --git a/manifests/params.pp b/manifests/params.pp index ded9e98..3181c5c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,6 +6,7 @@ $package_ensure = 'present' $package_manage = true $package_name = [ 'orchestrator' ] + $repo_manage = true $service_enable = true $service_ensure = 'running' $service_manage = true @@ -13,6 +14,7 @@ $srv_cnf = '/etc/orchestrator_srv.cnf' $topology_cnf = '/etc/orchestrator.cnf' + # lint:ignore:140chars $config_defaults = { 'Debug' => true, 'EnableSyslog' => false, @@ -150,4 +152,5 @@ 'GraphitePath' => '', 'GraphiteConvertHostnameDotsToUnderscores' => true, } + # lint:endignore } diff --git a/manifests/repo.pp b/manifests/repo.pp new file mode 100644 index 0000000..dd10e23 --- /dev/null +++ b/manifests/repo.pp @@ -0,0 +1,23 @@ +# Manage the packagecloud repo's +class orchestrator::repo inherits orchestrator { + if $orchestrator::manage_repo { + include packagecloud + + case $::operatingsystem { + 'Debian', 'Ubuntu': { + packagecloud::repo { 'github/orchestrator': + type => 'deb', + } + } + 'Fedora', 'CentOS', 'RedHat': { + packagecloud::repo { 'github/orchestrator': + type => 'rpm', + } + } + default: { + fail("Operating system ${::operatingsystem} was not supported for adding repo's") + } + } + } + +} diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..95251eb --- /dev/null +++ b/metadata.json @@ -0,0 +1,62 @@ +{ + "name": "github-orchestrator", + "version": "1.0.1", + "author": "GitHub", + "license": "MIT", + "summary": "A module for installing and configuring Orchestrator (https://github.com/github/orchestrator/)", + "source": "https://github.com/github/puppet-orchestrator-for-mysql.git", + "project_page": "https://github.com/github/puppet-orchestrator-for-mysql", + "issues_url": "https://github.com/github/puppet-orchestrator-for-mysql/issues", + "tags": ["mysql", "orchestrator"], + "operatingsystem_support": [ + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] + }, + { + "operatingsystem": "CentOS", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] + }, + { + "operatingsystem":"Fedora", + "operatingsystemrelease": [ + "22", + "23", + "24" + ] + }, + { + "operatingsystem":"Debian", + "operatingsystemrelease": [ + "7", + "8" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "12.04", + "14.04", + "15.04", + "15.10", + "16.04" + ] + } + ], + "requirements": [ + { "name": "json", "version_requirement": ">=1.8.0" }, + { "name": "puppet", "version_requirement": ">= 3.2.0" } + ], + "dependencies": [ + { "name": "puppetlabs/stdlib", "version_requirement": ">= 3.2.0 <5.0.0" }, + { "name": "computology/packagecloud", "version_requirement": ">= 0.2.0" } + ] +} From 0824addfd99e48bf2a4051711c7cd5f209dcaf26 Mon Sep 17 00:00:00 2001 From: Matthias Crauwels Date: Fri, 10 Feb 2017 19:14:40 +0100 Subject: [PATCH 2/3] using the correct var might help --- manifests/repo.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/repo.pp b/manifests/repo.pp index dd10e23..1308edb 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -1,6 +1,6 @@ # Manage the packagecloud repo's class orchestrator::repo inherits orchestrator { - if $orchestrator::manage_repo { + if $orchestrator::repo_manage { include packagecloud case $::operatingsystem { From a2d24565181863a25faca001e91bbef1d8164d4c Mon Sep 17 00:00:00 2001 From: Matthias Crauwels Date: Fri, 10 Feb 2017 22:33:48 +0100 Subject: [PATCH 3/3] updated readme to add the repo_manage feature added basic usage example for testing --- README.md | 2 ++ examples/init.pp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 examples/init.pp diff --git a/README.md b/README.md index a003648..d743063 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,8 @@ This module is to install the MySQL tool called Orchestrator via puppet. Orchest * The orchestrator deb/rpm package is available to puppet if `orchestrator::params::package_manage` is `true`. +* Puppet will manage the [Orchestrator Packagecloud repo](https://packagecloud.io/github/orchestrator) if `orchestrator::params::repo_manage` is `true`. *Note*: this functionality will require the [computology/packagecloud]( https://forge.puppet.com/computology/packagecloud) module dependency. + ## Status Stable and in active development. diff --git a/examples/init.pp b/examples/init.pp new file mode 100644 index 0000000..96bbb5e --- /dev/null +++ b/examples/init.pp @@ -0,0 +1,16 @@ +node default { + + $user = 'root' + $password = 'root' + + class { '::mysql::server': + root_password => "%${password}%", + remove_default_accounts => true, + } -> + class { '::orchestrator': + config_override => { + 'MySQLOrchestratorHost' => '127.0.0.1', + }, + } + +}