You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by sa...@apache.org on 2014/01/30 17:37:48 UTC

git commit: Adding mysql cartridge puppet configs

Updated Branches:
  refs/heads/master 810874cb8 -> 9251ccdee


Adding mysql cartridge puppet configs


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/9251ccde
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/9251ccde
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/9251ccde

Branch: refs/heads/master
Commit: 9251ccdee4e84ec5f23c29723f0d698e8c44f360
Parents: 810874c
Author: Sajith Kariyawasam <sa...@wso2.com>
Authored: Thu Jan 30 22:07:00 2014 +0530
Committer: Sajith Kariyawasam <sa...@wso2.com>
Committed: Thu Jan 30 22:07:00 2014 +0530

----------------------------------------------------------------------
 tools/puppet/manifests/classes/mysql.pp | 122 +++++++++++++++++++++++++++
 1 file changed, 122 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9251ccde/tools/puppet/manifests/classes/mysql.pp
----------------------------------------------------------------------
diff --git a/tools/puppet/manifests/classes/mysql.pp b/tools/puppet/manifests/classes/mysql.pp
new file mode 100644
index 0000000..2f78a50
--- /dev/null
+++ b/tools/puppet/manifests/classes/mysql.pp
@@ -0,0 +1,122 @@
+# --------------------------------------------------------------
+#
+# 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 mysql (mb_ip,mb_port,cep_ip,cep_port,java_truststore,java_truststore_password) {
+
+  if $stratos_mysql_password {
+    $root_password = $stratos_mysql_password
+  }
+  else {
+    $root_password = 'root'
+  }
+
+  file { "/etc/apt/apt.conf.d/90forceyes":
+                ensure  => present,
+                source  => "puppet:///apt/90forceyes";
+   }
+
+   exec { "update-apt":
+            path    => ['/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/'],
+            command => "apt-get update > /dev/null 2>&1 ",
+            require => File["/etc/apt/apt.conf.d/90forceyes"],
+            logoutput => on_failure,
+   }
+
+  package { ['mysql-server','phpmyadmin','apache2']:
+    ensure => installed,
+    require => Exec["update-apt"],
+  }
+
+  service { 'mysql':
+    ensure  => running,
+    pattern => 'mysql',
+    require => Package['mysql-server'],
+  }
+
+  service { 'apache2':
+    ensure  => running,
+    pattern => 'apache2',
+    require => Package['apache2'],
+  }
+
+#  exec { 'Set root password':
+#    path    => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+#    unless  => "mysqladmin -uroot -p${root_password} status",
+#    command => "mysqladmin -uroot password ${root_password}",
+#    require => Service['mysql'];
+#  }
+#
+#  if $root_password {
+#    exec {
+#      'Delete anonymous users':
+#        path    => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+#        command => "mysql -uroot -p${root_password} -Bse \"DELETE from mysql.user WHERE password=''\"",
+#        require => Exec['Set root password'];
+#
+#      'Create mysql user root@%':
+#        path    => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+#        command => "mysql -uroot -p${root_password} -Bse \"CREATE USER 'root'@'%' IDENTIFIED BY '${root_password}'\"",
+#        require => Exec['Delete anonymous users'];
+#    }
+#  }
+
+#  file { '/etc/httpd/conf.d/phpMyAdmin.conf':
+#    ensure  => present,
+#    content => template('mysql/phpMyAdmin.conf.erb'),
+#    notify  => Service['httpd'],
+#    require => [
+#      Package['phpmyadmin'],
+#      Package['apache2'],
+#    ];
+#  }
+
+
+        file {  "/opt/apache-stratos-cartridge-agent/apache-stratos-cartridge-agent-4.0.0-SNAPSHOT-bin.zip":
+                source          => "puppet:///commons/apache-stratos-cartridge-agent-4.0.0-SNAPSHOT-bin.zip",
+                ensure          => present,
+        }
+
+        file {  "/opt/apache-stratos-cartridge-agent/cartridge-agent.sh":
+                source          => "puppet:///commons/cartridge-agent.sh",
+                ensure          => present,
+        }
+
+
+        file {  "/opt/apache-stratos-cartridge-agent/get-launch-params.rb":
+                source          => "puppet:///commons/get-launch-params.rb",
+                ensure          => present,
+        }
+
+
+        file {"/tmp/puppet-payload":
+                 ensure  => present,
+                 content => ",MB_IP=${mb_ip},MB_PORT=${mb_port},CEP_IP=${cep_ip},CEP_PORT=${cep_port},CERT_TRUSTSTORE=${java_truststore},TRUSTSTORE_PASSWORD=${java_truststore_password},APP_PATH=null",
+                 require => Service['apache2'];
+        }
+
+        exec {"run_agent_script-$deployment_code":
+                command => "/opt/apache-stratos-cartridge-agent/cartridge-agent.sh",
+                require => File["/tmp/puppet-payload"];
+        }
+
+
+}