用puppet安装mysql-server

Den*_*boy 2 mysql ubuntu puppet

我是傀儡新手.这是我第一次体验它.我在2个ubuntu vm上安装了一个主人和一个代理.我已经用puppet安装了apache.它似乎工作正常.现在我写了我的site.pp和我的init.pp:

ubuntu@puppet:/etc/puppet/manifests$ cat site.pp 
node 'puppetclient.example.com' {
   include apache2
   include mysql-server
}
Run Code Online (Sandbox Code Playgroud)

树:

ubuntu@puppet:/etc/puppet/modules$ tree
.
??? apache2
?   ??? manifests
?       ??? init.pp
??? mysql-server
    ??? manifests
        ??? init.pp
Run Code Online (Sandbox Code Playgroud)

我的mysql-server的init.pp:

class mysql-server {
  package { 'mysql-server':
    ensure => installed,
  }

  service { 'mysql-server':
    ensure  => true,
    enable  => true,
    require => Package['mysql-server'],
  }
}
Run Code Online (Sandbox Code Playgroud)

当我puppet agent -t在我的经纪人身上表演时.

ubuntu@puppetclient:~$ sudo puppet agent -t
[sudo] password for ubuntu: 
Info: Retrieving plugin
Info: Caching catalog for puppetclient.example.com
Info: Applying configuration version '1462308091'
Error: /Stage[main]/Mysql-server/Service[mysql-server]: Could not evaluate: Could not find init script or upstart conf file for 'mysql-server'
Notice: Finished catalog run in 0.10 seconds
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?谢谢

MMT*_*MMT 5

该错误意味着puppet无法启动名为mysql-server的服务

无法找到'mysql-server'的init脚本或upstart conf文件

虽然我不使用Ubuntu,但我确信该服务不会被称为mysql-server,因为这只是包的名称,实际服务称为mysql.

尝试使用:

service { 'mysql': ensure => true, enable => true, require => Package['mysql-server'], }