I'm exploring puppet on a standalone system and ran into a wall with copying a config file for MySQL. Using the manifest below, MySQL is installed but the my.cnf file is not copied over.
init.pp (hostname: dev_one.site.com)
class mysql {
case $servername {
"prod_one.site.com", "dev_one.site.com", "sandbox_one.site.com": {
$conf_file = 'my.cnf.one'
}
"prod_two.site.com", "dev_two.site.com", "sandbox_two.site.com": {
$conf_file = 'my.cnf.two'
}
}
package { "mysql-server":
ensure => present,
}
package { "mysql":
ensure => present,
}
file { 'my.cnf':
path => '/etc/',
ensure => file,
require => Package['mysql'],
source => "puppet:///modules/mysql/${conf_file}"
}
service { "mysqld":
ensure => running,
enable => true,
require => Package["mysql-server"]
}
}
And here is the result:
[root@dev_one manifests]# puppet apply --verbose ./init.pp
Info: Applying configuration version '1379018555'
Notice: /Stage[main]/Mysql/Package[mysql-server]/ensure: created
Notice: /Stage[main]/Mysql/Service[mysqld]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Mysql/Service[mysqld]: Unscheduling refresh on Service[mysqld]
Notice: Finished catalog run in 14.34 seconds
[root@dev_one manifests]# ll /etc/my*
total 0
No errors, but my.cnf is not being copied. What am I doing wrong?