mysql - 使用 puppet 安装 mysql-server

标签 mysql ubuntu puppet

我是 puppet 新手。这是我第一次体验它。我在 2 个 ubuntu 虚拟机上安装了一个 master 和一个 agent。我已经用 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 时。

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 的服务

Could not find init script or upstart conf file for 'mysql-server'

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

尝试使用:

服务 { 'mysql': 确保 => 真, 启用 => 真, require => Package['mysql-server'], }

关于mysql - 使用 puppet 安装 mysql-server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37014161/

相关文章:

php - MYSQL/PHP : Select identical numbers in different rows

MySQL 更新联合选择

php - preg_match_all 不使用 mysql 数据库结果变量?

CSS 在 vagrant 环境中格式不正确

java - 从 java 执行 shell 脚本

ubuntu - 配置中的 VSCode 空嵌套引号字符串停止工作

vagrant - vagrant 会自动安装 puppet 吗?

php - MySQL PHP 抓取与查询不相关的行

mysql - 错误 1064 (42000) : You have an error in your SQL syntax; to set permission

vagrant - 如何在 Puppet 配置的 Vagrant 项目中跨环境共享 list