I have some trouble with puppet and systemctl. I used to load several parameters for a 'service' but it's not working anymore on centos7.
This is my error:
Error: Could not enable [ntpd ntpdate]:
Error: /Stage[main]/Ntp::Service/Service[[ntpd ntpdate]]/enable: change from false to true failed: Could not enable [ntpd ntpdate]:
And this is my code :
Hiera :
ntp::service::ntp_services:
- "ntpd"
- "ntpdate"
Service.pp :
class ntp::service ($ntp_services) {
service {"$ntp_services":
hasrestart => false,
hasstatus => true,
ensure => running,
enable => true,
}
}
It's working very well on centos 6 and it used to work on centos 7.
It works if I define the parameter like that :
ntp::service::ntp_services: "ntpd"
But I will have to define 1 parameter for 1 service...
Thanks
The quotes on this line are likely to be causing the problem:
Using
""
containing a variable will create a string with the variable expanded inside it. This is probably why Puppet is reporting a single service with the name[ntpd ntpdate]
(i.e. an array) rather than two different services.Change it to:
and this should pass the original array, generating one resource per item.