Chef infra 正在解压缩tar文件并排除某些目录和文件

Chef infra 正在解压缩tar文件并排除某些目录和文件,chef-infra,Chef Infra,我是新来的厨师,请有人帮助我正确的语法或正确的方法来进行以下操作: remote_file '/tmp/apache-tomcat-8.0.43.tar.gz' do source 'http://csjh****1:8000/Tomcat/apache-tomcat-8.0.43.tar.gz' user 'root' group 'root' mode '0755' action :create end directory '/Apps/Dev/Tomcat/

我是新来的厨师,请有人帮助我正确的语法或正确的方法来进行以下操作:

remote_file '/tmp/apache-tomcat-8.0.43.tar.gz' do
   source 'http://csjh****1:8000/Tomcat/apache-tomcat-8.0.43.tar.gz'
   user 'root'
   group 'root'
   mode '0755'
   action :create
end

directory '/Apps/Dev/Tomcat/8.0.43' do
    recursive true
    mode 0755
    action :create
end

execute 'extract_some_tar' do
    command = 'tar -xzvf /tmp/apache-tomcat-8.0.43.tar.gz --strip-
    components=1'
    command =  '--exclude=*webapps/examples* '
    command = '--exclude=*webapps/ROOT*'
    command = '--exclude=*webapps/ROOT*'
    cwd '/Apps/Dev/Tomcat/8.0.43'
end
我从厨房得到以下错误:

     ================================================================================
       Error executing action `run` on resource 'execute[extract tomcat tarball]'
       ================================================================================

       Errno::ENOENT
       -------------
       No such file or directory - extract

       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cache/cookbooks/last_test/recipes/default.rb

在执行
命令之后不应该有
=
,您还可以通过在每行末尾添加
\
来拆分长字符串

execute 'extract_some_tar' do
  command 'tar -xzvf /tmp/apache-tomcat-8.0.43.tar.gz '\
    '--strip-components=1 --exclude=*webapps/examples* '\
    '--exclude=*webapps/ROOT* --exclude=*webapps/ROOT*'
  cwd '/Apps/Dev/Tomcat/8.0.43'
end

请确保在
execute
资源中添加一些保护,否则它将在每次Chef运行时执行。

Hi Draco,我尝试了您的命令,但它不会删除目录。所以在这里,我试图提取并剥离目录“/Apps/Dev/Tomcat/8.0.43”中的所有内容,不包括“examples;ROOT;docs”