在其他命令之前运行exec的Puppet
我正在puppet中创建一个名为在其他命令之前运行exec的Puppet,puppet,Puppet,我正在puppet中创建一个名为jboss的组,然后使用exec运行sed命令,在/etc/group文件中进行一些更改。 问题是exec命令在group命令之前运行 我的Yaml文件 group { 'jboss': ensure => 'present', gid => "501", } exec { "modify etc_group": command => "/bin/sed -i -e '
jboss
的组,然后使用exec运行sed
命令,在/etc/group
文件中进行一些更改。问题是exec命令在group命令之前运行 我的Yaml文件
group { 'jboss':
ensure => 'present',
gid => "501",
}
exec { "modify etc_group":
command => "/bin/sed -i -e '<regex>' /etc/group",
path => "/bin:/usr/bin",
unless => "<condition>",
}
如何确保
exec
在group
命令之后运行?只需定义group
和exec
之间的关系即可
例如:
exec{“修改等组”:
command=>“/bin/sed-i-e”“/etc/group”,
路径=>“/bin:/usr/bin”,
除非=>“”,
require=>Group['jboss'],
}
更多关于puppet中的关系。滥用
exec
以不同方式管理资源(例如组
文件)几乎总是一个坏主意。这可能是一个更好的问题,如何规避这种需求。是的,我知道这是一个不好的方法,但不幸的是,由于一个糟糕的遗留设计,我们不得不手动修改此文件,无法绕过它。
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 { "modify etc_group":
command => "/bin/sed -i -e '<regex>' /etc/group",
path => "/bin:/usr/bin",
unless => "<condition>",
require => Group['jboss'],
}