Grant Schoep
2014-Oct-07 14:20 UTC
[Puppet Users] How to ensure a variable gets set, before a File or Service gets set.
So I have the following puppet rule. Pasted below. The problem is, sometimes, I see it looks like it is running the File before it sets the variable $sendmail_file in the case statement above. The reason I believe this, is because of the error message that it reports. Which is Error Message: err: /File[sendmailcf]/ensure: change from absent to file failed: Could not set 'file on ensure: No such file or directory - /etc/mail/sendmail.cf.puppettmp_6850 at /etc/puppet/modules/sendmail/manifests/client.pp:40 What I can't figure out, is how to ensure that that variable gets set, before it gets used. Any pointers? My puppet rule. class sendmail::client { case $::operatingsystem { /^(RedHat|CentOS)/: { case $::lsbmajdistrelease { '5': { $sendmail_file = 'sendmail.cf.rhel5' } '6': { $sendmail_file = 'sendmail.cf.rhel6' } default: { fail("Unsupported OS Major version ${::operatingsystem} ${::lsbmajdistrelease}") } } } default: { fail("Unsupported operating system: ${::operatingsystem}") } } service { sendmail: name => sendmail, enable => true, ensure => running, } file { sendmailcf: path => "/etc/mail/sendmail.cf", mode => 644, owner => root, group => root, ensure => present, source => "puppet:///modules/sendmail/$sendmail_file", notify => Service[sendmail], } } -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/234cfec6-ce05-4861-8334-f4daab55c20c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.