Repository: incubator-stratos Updated Branches: refs/heads/master 8e4ad61a5 -> e0da580a2
added Puppet base class, improved puppet nodes structure Signed-off-by: Manula Thantriwatte <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/e0da580a Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/e0da580a Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/e0da580a Branch: refs/heads/master Commit: e0da580a288cd86c6e3758b95275939b4cbb7c10 Parents: 8e4ad61 Author: Akila Perera <[email protected]> Authored: Sun May 4 23:28:35 2014 +0530 Committer: Manula Thantriwatte <[email protected]> Committed: Mon May 5 04:53:05 2014 +0000 ---------------------------------------------------------------------- tools/puppet3/manifests/base.pp | 44 +++++++ tools/puppet3/manifests/default.pp | 24 ++++ tools/puppet3/manifests/haproxy.pp | 25 ++++ tools/puppet3/manifests/lb.pp | 25 ++++ tools/puppet3/manifests/mysql.pp | 27 ++++ tools/puppet3/manifests/nodejs.pp | 27 ++++ tools/puppet3/manifests/nodes.pp | 129 ------------------- tools/puppet3/manifests/php.pp | 32 +++++ tools/puppet3/manifests/ruby.pp | 26 ++++ tools/puppet3/manifests/site.pp | 18 --- tools/puppet3/manifests/tomcat.pp | 28 ++++ tools/puppet3/manifests/wordpress.pp | 26 ++++ tools/puppet3/modules/php/manifests/init.pp | 8 +- .../modules/stratos_base/manifests/init.pp | 63 +++++++++ tools/puppet3/puppet.conf | 1 + 15 files changed, 350 insertions(+), 153 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/base.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/base.pp b/tools/puppet3/manifests/base.pp new file mode 100755 index 0000000..5722073 --- /dev/null +++ b/tools/puppet3/manifests/base.pp @@ -0,0 +1,44 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Stratos base node +node 'base' { + + #essential variables + $package_repo = 'http://10.4.128.7' + $local_package_dir = '/mnt/packs' + $mb_ip = '127.0.0.1' + $mb_port = '61616' + $mb_type = 'activemq' #in wso2 mb case, value should be 'wso2mb' + $cep_ip = '127.0.0.1' + $cep_port = '7611' + $truststore_password = 'wso2carbon' + $java_distribution = 'jdk-7u51-linux-x64.tar.gz' + $java_name = 'jdk1.7.0_51' + $member_type_ip = 'private' + $lb_httpPort = '80' + $lb_httpsPort = '443' + $tomcat_version = '7.0.52' + $enable_log_publisher = 'false' + $bam_ip = '127.0.0.1' + $bam_port = '7611' + $bam_secure_port = '7711' + $bam_username = 'admin' + $bam_password = 'admin' + + require stratos_base +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/default.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/default.pp b/tools/puppet3/manifests/default.pp new file mode 100755 index 0000000..1708013 --- /dev/null +++ b/tools/puppet3/manifests/default.pp @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# default (base) cartridge node +node /default/ inherits base { + require java + class {'agent':} + + Class['stratos_base'] -> Class['java'] ~> Class['agent'] +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/haproxy.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/haproxy.pp b/tools/puppet3/manifests/haproxy.pp new file mode 100755 index 0000000..abce18b --- /dev/null +++ b/tools/puppet3/manifests/haproxy.pp @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# haproxy extension loadbalancer cartridge node +node /haproxy/ inherits base { + require java + class {'haproxy':} + class {'agent':} + + Class['stratos_base'] -> Class['java'] -> Class['haproxy'] ~> Class['agent'] +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/lb.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/lb.pp b/tools/puppet3/manifests/lb.pp new file mode 100755 index 0000000..3faa7d9 --- /dev/null +++ b/tools/puppet3/manifests/lb.pp @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# loadbalancer cartridge node +node /lb/ inherits base { + require java + class {'agent':} + class {'lb': maintenance_mode => 'norestart'} + + Class['stratos_base'] -> Class['java'] -> Class['lb'] ~> Class['agent'] +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/mysql.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/mysql.pp b/tools/puppet3/manifests/mysql.pp new file mode 100755 index 0000000..9b62f7e --- /dev/null +++ b/tools/puppet3/manifests/mysql.pp @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# mysql cartridge node +node /mysql/ inherits base { + require java + class {'agent': + type => 'mysql', + } + class {'mysql':} + + Class['stratos_base'] -> Class['java'] -> Class['mysql'] ~> Class['agent'] +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/nodejs.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/nodejs.pp b/tools/puppet3/manifests/nodejs.pp new file mode 100755 index 0000000..e99cbc8 --- /dev/null +++ b/tools/puppet3/manifests/nodejs.pp @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# nodejs cartridge node +node /nodejs/ inherits base { + require java + class {'agent': + type => 'nodejs', + } + class {'nodejs':} + + Class['stratos_base'] -> Class['java'] -> Class['nodejs'] ~> Class['agent'] +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/nodes.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/nodes.pp b/tools/puppet3/manifests/nodes.pp deleted file mode 100644 index 519de39..0000000 --- a/tools/puppet3/manifests/nodes.pp +++ /dev/null @@ -1,129 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -node 'base' { - - #essential variables - $package_repo = 'http://10.4.128.7' - $local_package_dir = '/mnt/packs' - $mb_ip = '127.0.0.1' - $mb_port = '61616' - $mb_type = 'activemq' #in wso2 mb case, value should be 'wso2mb' - $cep_ip = '127.0.0.1' - $cep_port = '7611' - $truststore_password = 'wso2carbon' - $java_distribution = 'jdk-7u51-linux-x64.tar.gz' - $java_name = 'jdk1.7.0_51' - $member_type_ip = 'private' - $lb_httpPort = '80' - $lb_httpsPort = '443' - $tomcat_version = '7.0.52' - $enable_log_publisher = 'false' - $bam_ip = '127.0.0.1' - $bam_port = '7611' - $bam_secure_port = '7711' - $bam_username = 'admin' - $bam_password = 'admin' - - -} - -# php cartridge node -node /php/ inherits base { - $docroot = "/var/www/" - $syslog="/var/log/apache2/error.log" - $samlalias="/var/www/" - require java - class {'agent': - type => 'php', - } - class {'php':} - - #install php before agent - Class['php'] ~> Class['agent'] -} - -# loadbalancer cartridge node -node /lb/ inherits base { - require java - class {'agent':} - class {'lb': maintenance_mode => 'norestart',} -} - -# tomcat cartridge node -node /tomcat/ inherits base { - $docroot = "/mnt/apache-tomcat-${tomcat_version}/webapps/" - $samlalias="/mnt/apache-tomcat-${tomcat_version}/webapps/" - - require java - class {'agent':} - class {'tomcat':} - - #install tomcat befor agent - #Class['tomcat'] ~> Class['agent'] -} - -# mysql cartridge node -node /mysql/ inherits base { - require java - class {'agent': - type => 'mysql', - } - class {'mysql':} -} - -# nodejs cartridge node -node /nodejs/ inherits base { - require java - class {'agent': - type => 'nodejs', - } - class {'nodejs':} - - #install agent before nodejs - Class['nodejs'] ~> Class['agent'] -} - -# haproxy extension loadbalancer cartridge node -node /haproxy/ inherits base { - require java - class {'haproxy':} - class {'agent':} -} - -# ruby cartridge node -node /ruby/ inherits base { - require java - class {'agent': - } - class {'ruby':} -# Class['ruby'] ~> Class['agent'] -} - -#wordpress cartridge node -node /wordpress/ inherits base { - class {'agent':} - class {'wordpress':} - class {'mysql':} - -} - -# default (base) cartridge node -node /default/ inherits base { - require java - class {'agent':} -} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/php.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/php.pp b/tools/puppet3/manifests/php.pp new file mode 100755 index 0000000..da47e11 --- /dev/null +++ b/tools/puppet3/manifests/php.pp @@ -0,0 +1,32 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# php cartridge node +node /php/ inherits base { + $docroot = "/var/www/" + $syslog="/var/log/apache2/error.log" + $samlalias="/var/www/" + + require java + class {'agent': + type => 'php', + } + class {'php':} + + #install stratos_base before java before php before agent + Class['stratos_base'] -> Class['java'] -> Class['php'] ~> Class['agent'] +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/ruby.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/ruby.pp b/tools/puppet3/manifests/ruby.pp new file mode 100755 index 0000000..b4ade98 --- /dev/null +++ b/tools/puppet3/manifests/ruby.pp @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# ruby cartridge node +node /ruby/ inherits base { + require java + class {'agent': + } + class {'ruby':} + + Class['stratos_base'] -> Class['java'] -> Class['ruby'] ~> Class['agent'] +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/site.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/site.pp b/tools/puppet3/manifests/site.pp deleted file mode 100644 index cce0655..0000000 --- a/tools/puppet3/manifests/site.pp +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -import "nodes" http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/tomcat.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/tomcat.pp b/tools/puppet3/manifests/tomcat.pp new file mode 100755 index 0000000..8826d27 --- /dev/null +++ b/tools/puppet3/manifests/tomcat.pp @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# tomcat cartridge node +node /tomcat/ inherits base { + $docroot = "/mnt/apache-tomcat-${tomcat_version}/webapps/" + $samlalias="/mnt/apache-tomcat-${tomcat_version}/webapps/" + + require java + class {'agent':} + class {'tomcat':} + + Class['stratos_base'] -> Class['java'] -> Class['tomcat'] ~> Class['agent'] +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/manifests/wordpress.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/manifests/wordpress.pp b/tools/puppet3/manifests/wordpress.pp new file mode 100755 index 0000000..7233842 --- /dev/null +++ b/tools/puppet3/manifests/wordpress.pp @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +#wordpress cartridge node +node /wordpress/ inherits base { + require java + class {'agent':} + class {'wordpress':} + class {'mysql':} + + Class['stratos_base'] -> Class['java'] -> Class['mysql'] -> Class['wordpress'] ~> Class['agent'] +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/modules/php/manifests/init.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/modules/php/manifests/init.pp b/tools/puppet3/modules/php/manifests/init.pp index 5c66ecc..17857a7 100755 --- a/tools/puppet3/modules/php/manifests/init.pp +++ b/tools/puppet3/modules/php/manifests/init.pp @@ -21,9 +21,7 @@ class php () { - $packages = [ - 'nano', - 'zip', + $packages = [ 'build-essential', 'mysql-client', 'apache2', @@ -34,9 +32,7 @@ class php () { 'php5-mysql', 'php-db', 'php-pear', - 'php5-curl', - 'curl', - 'wget', + 'php5-curl', 'php5-ldap', 'php5-adodb', 'mailutils', http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/modules/stratos_base/manifests/init.pp ---------------------------------------------------------------------- diff --git a/tools/puppet3/modules/stratos_base/manifests/init.pp b/tools/puppet3/modules/stratos_base/manifests/init.pp new file mode 100755 index 0000000..288ec8e --- /dev/null +++ b/tools/puppet3/modules/stratos_base/manifests/init.pp @@ -0,0 +1,63 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +class stratos_base( + $ensure = 'present', + $autoupgrade=true, +){ + + if ! ($ensure in [ "present", "absent" ]) { + fail("ensure parameter must be absent or present") + } + + if ! ("$autoupgrade" in [ 'true', 'false' ]) { + fail("autoupgrade parameter must be true or false") + } + +# Set local variables based on the desired state + if $ensure == "present" { + if $autoupgrade == true { + $package_ensure = latest + } + else { + $package_ensure = present + } + } + else { + $package_ensure = absent + } + + $packages = [ + 'nano', + 'curl', + 'wget', + 'zip', + 'unzip', + 'tar'] + + package { $packages: + ensure => $package_ensure, + } + + define printPackages{ + notify { $name: + message => "Installed package: ${name}", + } + } + printPackages{ $packages:} + +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e0da580a/tools/puppet3/puppet.conf ---------------------------------------------------------------------- diff --git a/tools/puppet3/puppet.conf b/tools/puppet3/puppet.conf index 4854197..9ef66db 100644 --- a/tools/puppet3/puppet.conf +++ b/tools/puppet3/puppet.conf @@ -28,4 +28,5 @@ templatedir=$confdir/templates # and can safely be removed if webrick is used. ssl_client_header = SSL_CLIENT_S_DN ssl_client_verify_header = SSL_CLIENT_VERIFY +manifest = $confdir/manifests
