Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/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
如何使用ansible从命令行创建war文件_Ansible - Fatal编程技术网

如何使用ansible从命令行创建war文件

如何使用ansible从命令行创建war文件,ansible,Ansible,我正在使用ansible创建一个war文件,下面是我正在使用的代码 - name: Create test.war file command: jar -cf test.war * args: chdir: /tmp/testFolder/ 但我的错误率越来越低 "rc": 1, "start": "2019-09-13 15:20:03.759503", "stderr": "* : no such file or directory", "std

我正在使用ansible创建一个war文件,下面是我正在使用的代码

- name: Create test.war file
  command: jar -cf test.war *
  args:
    chdir: /tmp/testFolder/
但我的错误率越来越低

  "rc": 1,
    "start": "2019-09-13 15:20:03.759503",
    "stderr": "* : no such file or directory",
    "stderr_lines": [
        "* : no such file or directory"

有人能帮我解决这个问题吗?

这是因为
*
是由shell扩展的,但是在运行时,您没有shell

您可以使用以下模块使其正常工作:

否则,必须指定外壳才能展开它:

- name: Create test.war file
  command: /bin/sh -c 'jar -cf test.war *'
  args:
    chdir: /tmp/testFolder/
(第二个解决方案的所有学分归为)

- name: Create test.war file
  command: /bin/sh -c 'jar -cf test.war *'
  args:
    chdir: /tmp/testFolder/