Puppet 运行 在其他命令之前执行

Puppet running exec before other commands

我正在 puppet 中创建一个名为 jboss 的组,然后使用 exec 执行 运行 一个 sed 命令,随后在 /etc/group 文件中进行一些更改。
问题是 exec 命令在 group 命令之前 运行ning。

我的 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>",
    }

人偶运行输出

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 运行 在 group 命令之后?

只需定义groupexec之间的关系即可。

例如:

exec { "modify etc_group":
    command => "/bin/sed -i -e '<regex>' /etc/group",
    path    => "/bin:/usr/bin",
    unless  => "<condition>",
    require => Group['jboss'],
}

有关人偶关系的更多信息 here