From 4b530c02c96cade7d9d136e636cd4439ceb38e2d Mon Sep 17 00:00:00 2001 From: Carmela Rubinos Date: Thu, 10 Sep 2015 18:37:43 +0200 Subject: [PATCH] Added the ability to manage tomcat & java setup Added $manage_app_server and $install_java params in order to be able to whether install tomcat & java or not, and avoid puppet executions to fail because of duplicated class declarations. Change-Id: I644e448a28ca324a9c3be4866642db220db988f5 --- README.md | 34 ++++++++++++++++++++++++++++++ data/common.yaml | 6 ++++++ manifests/midonet_agent/install.pp | 25 +++++++++++++--------- manifests/midonet_api/install.pp | 33 +++++++++++++++++++---------- 4 files changed, 77 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 47c7bc1..7b47843 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,21 @@ You can alternatively use the Hiera's yaml style: - 'host2' - 'host3' +Note: midonet\_agent class already makes a call to midonet\_agent::install. +This class allows to choose whether you want it to install and manage Java, or +use an existing installations instead. + +For this purpose a param has been added and its value has been defaulted to +'true'. Should you want to manage the Java installation from another puppet +module and avoid duplicated class declaration, change the value to 'false': + + class { 'midonet::midonet_agent::install': + install_java => false + } + +You can alternatively use the Hiera's yaml style: + + midonet::midonet_agent::install::install_java: false #### MidoNet API @@ -184,6 +199,25 @@ You can alternatively use the Hiera's yaml style: Please note that Zookeeper port is not mandatory and defaulted to 2181. +Note: midonet\_api class already makes a call to midonet\_api::install. This +class allows you to choose whether you want it to install and manage Tomcat and +Java, or use existing installations of both instead. + +For this purpose 2 parameters have been added and their values have been +defaulted to 'true'. Should you want to manage Tomcat and Java installation +from another puppet module and avoid duplicated class declaration, change the +values to 'false': + + class { 'midonet::midonet_api::install': + install_java => false, + manage_app_server => false + } + +You can alternatively use the Hiera's yaml style: + + midonet::midonet_api::install::install_java: false + midonet::midonet_api::install::manage_app_server: false + #### MidoNet CLI Install the MidoNetCLI this way: diff --git a/data/common.yaml b/data/common.yaml index 7c05529..356b268 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -8,3 +8,9 @@ midonet::zookeeper::server_id: '1' midonet::cassandra::seeds: - 'localhost' midonet::cassandra::seed_address: 'localhost' + +# Choose whether to manage Tomcat and Java installation (true) or use an +# existing installation instead (false). +midonet::midonet_agent::install::install_java: true +midonet::midonet_api::install::manage_app_server: true +midonet::midonet_api::install::install_java: true diff --git a/manifests/midonet_agent/install.pp b/manifests/midonet_agent/install.pp index 88e4a7c..06199c3 100644 --- a/manifests/midonet_agent/install.pp +++ b/manifests/midonet_agent/install.pp @@ -22,19 +22,24 @@ # See the License for the specific language governing permissions and # limitations under the License. # -class midonet::midonet_agent::install { +class midonet::midonet_agent::install ( + $install_java = true +) { - require midonet::repository + require midonet::repository + if ($install_java == true) { if ! defined(Class['java']) { - class {'java': - distribution => 'jre', - require => Exec['update-midonet-repos'] - } + class { 'java': + distribution => 'jre', + require => Exec['update-midonet-repos'] + } } + } + + package {'midolman': + ensure => present, + } - package {'midolman': - ensure => present, - require => Class['java'] - } } + diff --git a/manifests/midonet_api/install.pp b/manifests/midonet_api/install.pp index e75459a..dc1967f 100644 --- a/manifests/midonet_api/install.pp +++ b/manifests/midonet_api/install.pp @@ -22,24 +22,35 @@ # See the License for the specific language governing permissions and # limitations under the License. # -class midonet::midonet_api::install { +class midonet::midonet_api::install ( + $install_java = true, + $manage_app_server = true +) { require midonet::repository require midonet::midonet_api::augeas - if ! defined(Class['java']) { - class {'java': - distribution => 'jre', - require => Exec['update-midonet-repos'] + if ($manage_app_server == true) { + if ($install_java == true) { + if ! defined(Class['java']) { + class { 'java': + distribution => 'jre', + require => Exec['update-midonet-repos'] + } -> + + class { 'tomcat': + install_from_source => false, + require => Exec['update-midonet-repos'] + } + } else { + class { 'tomcat': + install_from_source => false, + require => Exec['update-midonet-repos'] + } + } } } - class {'tomcat': - install_from_source => false, - require => [Class['java'], - Exec['update-midonet-repos']] - } -> - package {'midonet-api': ensure => present, }