2014-09-19 67 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專用模塊。