reigster is not working with ansible git task

2020-05-07 02:58发布

I want to debug git task in my ansible play-book.When I am using register keyword for that but it is throwing me error .This is my playbook code

- 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 

I am getting this error

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 ************************************************************************************************************************************

标签: git ansible
1条回答
Animai°情兽
2楼-- · 2020-05-07 03:17

register is a task parameter, not module parameter, so mind the padding:

- 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 
查看更多
登录 后发表回答