在运行ansible playbook以git克隆项目时出现违规行

use*_*dev 1 git ansible ansible-playbook ansible-2.x

嗨我想用ansible克隆一个项目,但我一直得到以下错误

ERROR! this task 'git' has extra params, which is only allowed in the following modules: command, shell, script, include, include_vars, add_host, group_by, set_fact, raw, meta

The error appears to have been in '/vagrant/ansible/roles/rolename/tasks/main.yml': line 67, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  - git: repo=ssh://git@git.example.sample.net:/component/exact/repo.git
    ^ here


The error appears to have been in '/vagrant/ansible/roles/rolename/tasks/main.yml': line 67, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  - git: repo=ssh://git@git.example.sample.net:/component/exact/repo.git
    ^ here

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
Run Code Online (Sandbox Code Playgroud)

我的Ansible任务是

  - git: repo=ssh://git@git.example.sample.net:/component/exact/repo.git
         dest=/home/
         accept_hostkey = true
         version= {{someversion}}
         accept_hostkey = true
Run Code Online (Sandbox Code Playgroud)

我在我的剧本中还有其他任务,但这些工作正常,但每当我包括git它失败了.

Xio*_*iov 6

等号语法仅在您使用模块的单行格式时使用; 当您将它们拆分为多行时,您应该使用以下key: value语法传递YAML哈希:

- git:
    repo: ssh://git@git.example.sample.net:/component/exact/repo.git
    dest: /home/
    accept_hostkey: true
    version: "{{someversion}}"
Run Code Online (Sandbox Code Playgroud)