Я ничего не знаю о Ruby, только начал изучать Puppet и хочу создать собственный факт, для начала использовал использованный факт в интернете, чтобы посмотреть, как он работает:
скопированный код ниже /etc/puppetlabs/code/environments/production/modules/dsc/lib/facter/windows.rb
(dsc - имя модуля)
Facter.add(:ismsclusternode) do
confine :kernel => 'windows'
sysnativedir = Facter.value(:system32)
setcode do
if Facter::Util::Resolution.exec(sysnativedir +
'\WindowsPowerShell\v1.0\powershell.exe "(get-windowsfeature
-Name Failover-Clustering).Installed"') == "True"
true
else
false
end
end
end
из вывода агента:
Info: Facter: loading custom facts from C:/ProgramData\PuppetLabs\puppet\cache\lib\facter\windows.rb.
Debug: Facter: executing command: C:\Windows\system32\cmd.exe /c C:\Windows\System32\Wbem\wmic.exe ComputerSystem get SystemType | FindStr /i x
Debug: Facter: x64-based PC
Debug: Facter: process exited with exit code 0.
Debug: Facter: searching for custom facts in C:/ProgramData\PuppetLabs\puppet\cache\lib\facter.
Debug: Facter: custom fact "common_appdata" was not found.
Error: Facter: error while resolving custom fact "_puppet_inventory_1": no implicit conversion of nil into String
Debug: Facter: fact "_puppet_inventory_1" resolved to null and will not be added.
Error: Facter: error while resolving custom fact "_puppet_inventory_1": no implicit conversion of nil into String
Error: Failed to apply catalog: Parameter path failed on File[/PuppetLabs/pxp-agent/etc/pxp-agent.conf]: File paths must be fully qualified, not '/PuppetLabs/pxp-agent/etc/pxp-agent.conf' (file: /opt/puppetlabs/puppet/modules/puppet_enterprise/manifests/pxp_agent.pp, line: 87)
/ opt / puppetlabs / puppet / modules / puppet_enterprise / manifest / pxp_agent.pp, строка: 87
file { "${puppet_enterprise::params::pxp_agent_etc}/pxp-agent.conf":
puppetserver version: 2018.1.0.54
puppet --version
5.5.2