我正在puppet中创建一个名为SELECT b_id,b_thumb1,b_thumb2,b_league,b_date,b_status
FROM battles
WHERE (b_userid1 in (?, ?))
AND (b_status in (1, 2))
ORDER BY b_date DESC
的组,然后使用exec运行jboss
命令,以便在sed
文件中进行一些更改。
问题是exec命令在group命令之前运行。
我的Yaml文件
/etc/group
Puppet run output
group { 'jboss':
ensure => 'present',
gid => "501",
}
exec { "modify etc_group":
command => "/bin/sed -i -e '<regex>' /etc/group",
path => "/bin:/usr/bin",
unless => "<condition>",
}
如何确保在notice: /Stage[main]/App::Misc/Exec[modify etc_group]/returns: current_value notrun, should be 0 (noop)
notice: /Stage[main]/App::Misc/Group[jboss]/ensure: current_value absent, should be present (noop)
命令之后运行exec
?
答案 0 :(得分:4)
只需定义group
和exec
之间的关系。
E.g:
exec { "modify etc_group":
command => "/bin/sed -i -e '<regex>' /etc/group",
path => "/bin:/usr/bin",
unless => "<condition>",
require => Group['jboss'],
}
更多关于木偶here中的关系。