我在puppet脚本中有一个exec资源,应该在每个配置上执行,但它似乎不起作用。我可能有配置问题或逻辑执行顺序问题,但我不确定它在哪里。
exec { 'get-ec2-hosts-run':
environment => "HOME=/home/${common_username}",
command => "php /home/${common_username}/get-ec2-hosts.php",
refresh => "php /home/${common_username}/get-ec2-hosts.php",
require => [
Package["php7.1"],
File_line['export aws access key'],
File_line['export aws secret key'],
],
user => "${common_username}"
}
所以我使用该代码实际上总是运行甚至刷新脚本名为get-ec2-hosts.php的每个配置,它只描述实例并为我编写〜/ .ssh / config文件。实际上是我们架构中非常需要的文件。
如果我手动运行此文件,它工作正常并创建我的配置文件,但从任何提供步骤它似乎永远不会运行,虽然我在puppet配置输出中得到一行说它做到了!
==> local_dev: Notice: /Stage[main]/Main/Exec[php71-add-tools]/returns: executed successfully
==> local_dev: Notice: /Stage[main]/Main/Exec[php71-add-repo]/returns: executed successfully
==> local_dev: Notice: /Stage[main]/Main/Exec[php71-update-sources]/returns: executed successfully
==> local_dev: Notice: /Stage[main]/Main/Exec[get-ec2-hosts-run]/returns: executed successfully
==> local_dev: Notice: /Stage[main]/Main/Exec[get-ec2-hosts-copy]/returns: executed successfully
==> local_dev: Notice: Finished catalog run in 6.57 seconds
所以我想知道我在这里做错了什么。
目标:
条件:
你能帮我理解吗?