Puppet exec 未执行

Puppet exec not executed

exec { "Installing application by extracting archive file ${app_package_archive} in ${install_dir}":
    cwd => "${install_dir}",
    path => ['/usr/bin','/bin','/usr/sbin','/sbin'],
    command => "tar xf ${app_package_archive}",
    user => 'root',
    creates => "${install_dir}/${app_package_dir}",
    require => File["${install_dir}/${app_package_archive}"],
    logoutput => true
} 

我有这个木偶代码块。此代码块正在提取应用程序包 tar 文件。我希望每次我有一个新的应用程序包时提取 puppet 都会覆盖现有的应用程序文件夹。如果没有旧的应用程序文件夹,此代码块可以正常工作。但如果有它甚至不会被执行。任何帮助将不胜感激。

看看documentation for exec. You are using the creates关键字:

A file to look for before running the command. The command will only run if the file doesn’t exist.

如果您希望 exec 资源每次都 运行,只需从资源定义中删除 creates