介绍:
我们使用puppet通过自定义事实来configuration节点,然后在hiera中引用它。 事实可以在/etc/facter/fact.d/中的黄金映像中,或通过pluginsync(两者都没有区别)
版本:
dpkg -l|grep puppet hi facter 1.7.5-1puppetlabs1 amd64 Ruby module for collecting simple facts about a host operating system hi hiera 1.3.4-1puppetlabs1 all A simple pluggable Hierarchical Database. hi puppet 3.4.3-1puppetlabs1 all Centralized configuration management - agent startup and compatibility scripts hi puppet-common 3.4.3-1puppetlabs1 all Centralized configuration management
设置很简单:
木偶大师:
cat hiera.yaml :hierarchy: - "aws/%{::aws_cluster}" /etc/puppet/hieradata/aws/web.json
EC2节点:
cat /etc/facter/facts.d/ec_cluster.sh echo 'aws_cluster=web'
所以有这个黄金ec2图像包括事实aws_cluster。 这是在hiera中引用,并指定要制作的类和configuration。
问题:
当我们启动实例并启用自动签名时,第一次运行时客户端不会出现$ aws_cluster。 所以它会失败(这是有道理的)说
puppet-agent[2163]: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item classes in any Hiera data file and no default supplied at /etc/puppet/manifests/site.pp:33 on node ip-172-31-35-221.eu-west-1.compute.internal
当傀儡代理人重新启动时,一切都按预期工作。 任何提示呢?
我们的猜测是:
更新:
当试图通过/etc/rc.local启动时,它也会失败。 所以交互式和非交互式运行必须有所不同。 是否有特殊的环境variables需要设置?
对不起,伙计们,我们走错了路。
在进一步debugging和logging来自facter -p的rc.local的输出之后,我们看到我们的外部事实需要脚本的aws凭证成功运行。 当您以root身份login时,它会自动获取,但在引导时运行时不会自动获取。
所以导出aws凭证的env参数解决了这个问题。
在debugging时,与计划键值对无关的信息一定是错误的。 SRY
泰勒博士:这不是一个傀儡的问题