Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File Ansible-复制是否支持shell*扩展_File_Copy_Jinja2_Ansible_Ansible Playbook - Fatal编程技术网

File Ansible-复制是否支持shell*扩展

File Ansible-复制是否支持shell*扩展,file,copy,jinja2,ansible,ansible-playbook,File,Copy,Jinja2,Ansible,Ansible Playbook,Ansible 1.9.2/更新版本 剧本: # Push Performance tests artifact zip file on remote jmeter machine - name: Push Performance tests artifact zip file on remote jmeter machine copy: src="performance-tests-*.zip" dest={{ common_download_dir }} 它出错了: 19:32:0

Ansible 1.9.2/更新版本

剧本:

# Push Performance tests artifact zip file on remote jmeter machine
- name: Push Performance tests artifact zip file on remote jmeter machine
  copy: src="performance-tests-*.zip"  dest={{ common_download_dir }} 
它出错了:

19:32:08 TASK: [perf_tests | Push Performance tests artifact zip file on remote jmeter machine] *** 
19:32:08 fatal: [jmeter01.server.in.vcloud] => input file not found at /home/service/workspace/run-project-performance-tests/build/artifacts/roles/perf_tests/files/performance-tests-*.zip or /home/service/workspace/run-project-performance-tests/build/artifacts/performance-tests-*.zip
19:32:08 
19:32:08 FATAL: all hosts have already failed -- aborting
我在源计算机(运行ansible的地方)上进行了检查,工作区中有有效的文件:performance-tests-0.0.8-20151001.232123-11.zip

ansible不支持shell扩展,例如在复制操作(如
copy:src=“somePath/*.zip”dest=“somepathnremotemachine”
)期间,在src=parameter中*(复制到所有文件中)

Ansible网站上的所有示例:显示。。只有一个文件用于src=…参数

PS:我没有在复制模块中使用验证参数。

它没有

我想最简单的方法是使用模块,直接发出
cp
命令

可以与_fileglob一起使用,以非递归方式匹配单个目录中与模式匹配的所有文件。它可以这样使用::

# copy each file over that matches the given pattern
- copy: src={{ item }} dest=/etc/fooapp/ owner=root mode=600
  with_fileglob:
    - /playbooks/files/fooapp/*

我预料到了。真奇怪,为什么Ansible不能扩展shell(似乎是因为Jinja2?)。我注意到的另一件事是,它不允许我对ex使用变量:{{var{{{giga}}}{u value}}。。如果giga可以是“新的”或“旧的”,var_new_值是“新的”,var_old_值是“旧的”,那么使用{{var_{{giga}}}}{U值}我不能根据变量giga中设置的内容来计算这两个新的_xxx_值变量中的任何一个。@ArunSangal它无法扩展外壳与jinja2无关。这是因为它没有使用shell来计算参数。@ArunSangal也有点迂回,但您可以“以编程方式”访问变量,以完成您在注释中的示例中所寻找的内容:听起来很有希望,我会尝试一下并更新回来。谢谢。它对我有效(我使用xxxx-.zip)。我看到一个博客,上面说如果它只是,那么它可能不起作用,但是。工作正常。如果我使用“unarchive”而不是“copy”模块,我将如何执行相同的操作(shell扩展)?您可以对任何模块使用