繁体   English   中英

用puppet安装mysql-server

[英]Install mysql-server with 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
}

树:

ubuntu@puppet:/etc/puppet/modules$ tree
.
├── apache2
│   └── manifests
│       └── init.pp
└── mysql-server
    └── manifests
        └── init.pp

我的mysql-server的init.pp:

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

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

当我在我的经纪人puppet agent -t执行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

我究竟做错了什么? 谢谢

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

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

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

尝试使用:

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

正如Michal T所说,服务名称只是mysql。

不同的操作系统通常具有不同的包名称和配置文件位置。

对于像mysql这样的东西,我建议使用先前的知识,例如支持的MySql模块 ,它涵盖了mysql的大多数用例,包括创建数据库。

然后你可以只包含MySql类,它可以为你完成大部分工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM