reigster不使用ansible git任务

时间:2017-06-02 07:28:31

标签: git ansible

我想在我的ansible play-book中调试git任务。当我使用注册关键字但是它给我带来错误。这是我的剧本代码

- git: 
        repo: http://<git url>/<user>/<repo>
        dest: /home/atul/Workplace/test-ansible
        version: "{{ GIT_TAG }}"
        refspec: '+refs/tags/{{GIT_TAG}}:refs/remotes/origin/tags/{{GIT_TAG}}'
        update: no
        register: cloned 

我收到此错误

TASK [git] ************************************************************************************************************************************
fatal: [host]: FAILED! => {"changed": false, "failed": true, "msg": "Unsupported parameters for (git) module: register. Supported parameters include: accept_hostkey,bare,clone,depth,dest,executable,force,key_file,recursive,reference,refspec,remote,repo,ssh_opts,track_submodules,umask,update,verify_commit,version"}
    to retry, use: --limit @/home/atul/Workplace/infra-automation/scripts/iquippo-build.retry

PLAY RECAP ************************************************************************************************************************************

1 个答案:

答案 0 :(得分:1)

register是一个任务参数,而不是模块参数,所以请注意填充:

- git: 
        repo: http://<git url>/<user>/<repo>
        dest: /home/atul/Workplace/test-ansible
        version: "{{ GIT_TAG }}"
        refspec: '+refs/tags/{{GIT_TAG}}:refs/remotes/origin/tags/{{GIT_TAG}}'
        update: no
  register: cloned