尝试部署 mySQL puppet。使用“Puppetlabs-MySQL”模块。
我的木偶大师 pp 有
node 'jira.oracle' { class {'mysql::server':} }
class mysql::server {
package { "mysql-server": ensure => installed }
package { "mysql": ensure => installed }
service { "mysqld":
enable => true,
ensure => running,
require => Package["mysql-server"],
}
file { "/var/lib/mysql/my.cnf":
owner => "mysql", group => "mysql",
source => "puppet:///fs/my.cnf",
notify => Service["mysqld"],
require => Package["mysql-server"],
}
file { "/etc/my.cnf":
require => File["/var/lib/mysql/my.cnf"],
ensure => "/var/lib/mysql/my.cnf",
}
exec { "set-mysql-password":
unless => "mysqladmin -uroot -p$mysql_password status",
path => ["/bin", "/usr/bin"],
command => "mysqladmin -uroot password $mysql_password",
require => Service["mysqld"],
}
}
并且 fileserver.conf 有
# MOUNT POINTS
[fs]
path /etc/puppet/environments/production/modules
allow *
但是代理仍然没有从 Pubpet Master 中提取“my.cnf”,并出现错误:
"Error: /Stage[main]/Mysql::Server/File[/var/lib/mysql/my.cnf]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///fs/my.cnf
Notice: /Stage[main]/Mysql::Server/File[/etc/my.cnf]: Dependency File[/var/lib/mysql/my.cnf] has failures: true
Warning: /Stage[main]/Mysql::Server/File[/etc/my.cnf]: Skipping because of failed dependencies
Notice: /Stage[main]/Mysql::Server/Service[mysqld]: Dependency File[/var/lib/mysql/my.cnf] has failures: true
Warning: /Stage[main]/Mysql::Server/Service[mysqld]: Skipping because of failed dependencies
Notice: /Stage[main]/Mysql::Server/Exec[set-mysql-password]: Dependency File[/var/lib/mysql/my.cnf] has failures: true
Warning: /Stage[main]/Mysql::Server/Exec[set-mysql-password]: Skipping because of failed dependencies
Notice: Finished catalog run in 0.51 seconds"
答案1
您定义挂载点,例如 /etc/storage,用于在 pp 上使用。在您定义的挂载点前面放置三个 ///。
(文件服务器.conf)
[fs]
path /etc/storage/
allow *
(节点.pp)
source => "puppet:///fs/my.cnf",