本文介绍了reigster 不使用 ansible git 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 ansible play-book 中调试 git 任务.当我为此使用 register 关键字时,它抛出了我的错误.这是我的 playbook 代码

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

我收到此错误

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

推荐答案

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

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

这篇关于reigster 不使用 ansible git 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 15:50