2014-09-19 61 views
0

我正在做我的生活更轻松(我希望)通过学习使用木偶和无业游民。 我已经知道如何与流浪工作,但要作出这样的开箱拥有一切建立启动配置。所以我想用Puppet。 我使用的教程在http://jamesmcfadden.co.uk/using-vagrant-and-puppet-to-build-a-php-nginx-and-mysql-environment/但似乎无法弄清楚如何启动MySQL。木偶不会启动MySQL

运行Ubuntu 14.04LTS为MySQL我init.pp是

class mysql { 

    # Install mysql 
    package { ['mysql-server']: 
    ensure => present, 
    require => Exec['apt-get update'], 
    } 

    # Run mysql 
    service { 'mysql': 
    ensure => running, 
    require => Package['mysql-server'], 
    } 

    # Use a custom mysql configuration file 
    file { '/etc/mysql/my.cnf': 
    source => 'puppet:///modules/mysql/my.cnf', 
    require => Package['mysql-server'], 
    notify => Service['mysql'], 
    } 

    # We set the root password here 
    exec { 'set-mysql-password': 
    unless => 'mysqladmin -uroot -proot status', 
    command => "mysqladmin -uroot password a9120ed2b58af37862a83f5b9f850819ed08b2a9", 
    path => ['/bin', '/usr/bin'], 
    require => Service['mysql']; 
    } 
} 

但是,这给了我,MySQL是没有发现错误。

err: /Stage[main]/Mysql/Service[mysql]/ensure: change from stopped to running fa 
iled: Could not start Service[mysql]: Execution of '/sbin/start mysql' returned 
1: at /tmp/vagrant-puppet-2/modules-0/mysql/manifests/init.pp:13 

并改变其对mysqld(注意是“d”)这个消息已不存在,但也有想出无法发现,以检查是否MySQL正在运行的依赖问题(后改为「服务[“mysqld的”]'?。

err: /Stage[main]/Mysql/Service[mysqld]: Could not evaluate: Could not find init 
script or upstart conf file for 'mysqld' 

是我做错了

+0

显然'mysql'无拖尾* d *是正确的,但你需要调查的启动脚本失败的原因。尝试* syslog *或任何专用的'mysql'日志,你可能会写服务。 – 2014-09-20 00:24:36

回答

-2

不要写你自己的MySQL模块请使用官方支持puppet MySQ大号模块要安装它称之为:

puppet module install puppetlabs-mysql 

一般来说,如果你想安装/由傀儡管理一些应用程序中,首先检查上存在puppet forge专用模块。