[16:41:15 #168 root@:~$ ] FACTER_operatingsystem=plop puppet -e 'notify { "We are running on $::operatingsystem": }'
notice: We are running on Debian
notice: /Stage[main]//Notify[We are running on Debian]/message: defined 'message' as 'We are running on Debian'
[16:41:32 #169 root@:~$ ] puppetd --version
2.6.2
[16:41:35 #170 root@:~$ ] puppet agent --version
2.6.2
Hi,I want to add "Proxmox" as new value in $::operatingsystem."Proxmox" is based on Debian, so the normal value is currently "Debian".To change that, I just write a custom fact based on the facter fact "operatingsystem"Facter.add(:operatingsystem) do
...
setcode do
...
elsif FileTest.exists?("/usr/bin/pveversion")
"Proxmox"This method doesn't override the original fact.I've also tried to set $::operatingsystem = "Proxmox" directly in my node.What's the best way to do override an existing fact ?Regards,Julien
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Facter.add(:operatingsystem) do
confine :kernel => [ 'Linux' ]
has_weight 100
setcode do
if FileTest.exists?("/usr/bin/pveversion") then
"Proxmox"
end
end
end
Facter.add(:operatingsystemrelease) do
confine :kernel => [ 'Linux' ]
has_weight 100
setcode do
if FileTest.exists?("/usr/bin/pveversion") then
Facter::Util::Resolution.exec("/usr/bin/pveversion")
end
end
end