2
我在puppet中創建一個名爲jboss
的組,然後使用exec運行sed
命令,以便在之後對/etc/group
文件進行一些更改。
問題是exec命令在組命令之前運行。傀儡在其他命令之前運行exec
我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)
如何確保該group
命令後exec
運行?
濫用'exec'以不同方式管理資源(例如'groups'文件)幾乎總是一個壞主意。如何規避需求可能是一個更好的問題。 –
是的,我知道這是一種糟糕的方式,但不幸的是,由於傳統設計不當,我們必須手動修改此文件,並且無法繞過它。 – Arpit