Perhaps my logic isn't that good here and I shouldn't be using a custom fact at
all but what I am trying to do is ascertain which version of the passenger gem
is actually installed because I need to reference it in various places in
apache & nginx configuration (the specific location of the passenger binary).
but my erb fails because the fact $passenger_version hasn't been created yet.
so I tried...
file {"/etc/apache2/mods-enabled/passenger.load":
... snip ...
require => Facter["datacenter"],
}
and in /etc/puppet/modules/custom/lib/facter/datacenter.rb I have
Facter.add("datacenter") do
setcode do
datacenter = "unknown"
# Get current ip address from Facter's own database
ipaddr = Facter.value(:ipaddress)
... snip ...
datacenter
end
end
#
# Provide an additional 'passenger_version' fact
# to use in apache & nginx modules
#
Facter.add("passenger_version") do
setcode do
passenger_version = "unknown"
exec('/usr/local/bin/passenger --version > /tmp/passenger_version')
passenger_version = "File.open('/tmp/passenger_version',
&:readline).chomp.split(' ').last"
passenger_version
end
end
but it never seems to add the 'passenger_version' fact
1. How can I make sure that the fact is ascertained before the template file is
parsed?
2. If I am setting up a new system, passenger won't be installed until some
point in the declarative process and at that point, how would I ensure that the
fact is ascertained?
Thanks
--
Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [email protected]
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com
Need help communicating between generations at work to achieve your desired
success? Let us help!
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.