# Git, unsupported parameter for module: refspec

**URL:** <https://forum.ansible.com/t/git-unsupported-parameter-for-module-refspec/19958>\
**Category:** Ansible Developer\
**Created:** [December 8, 2015, 2:24am UTC](https://forum.ansible.com/t/git-unsupported-parameter-for-module-refspec/19958 "2015-12-08T02:24:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Stivers](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@Paul\_Stivers](https://forum.ansible.com/u/Paul_Stivers)\
**Post date:** [December 8, 2015, 2:24am UTC](https://forum.ansible.com/t/git-unsupported-parameter-for-module-refspec/19958/1 "2015-12-08T02:24:35Z")

</div>

Hi all,

I’m trying to use the Ansible Git module to deploy an application repository in Git using a Git tag. I’m thinking I need to use the refspec parameter to define the tag. The following task works without the refspec parameter.

` `tasks:` `- name: update | application repo`git: repo={{ repo_url }} dest={{ deploy_to }} version={{ branch }} accept_hostkey=yes`

However, the following play with the refspec parameter

`tag_name: "v2015.11.1" ... ``tasks:`` ``- name: update | application repo`` git: repo={{ repo_url }} dest={{ deploy_to }} version={{ branch }} refspec=refs/tags{{ tag_name }} accept_hostkey=yes`

throws the following error upon deploy.

`TASK: [update | application repo] ********************************************* failed: [x.x.x.x] => {"failed": true} msg: unsupported parameter for module: refspec`

[http://docs.ansible.com/ansible/git\_module.html](http://docs.ansible.com/ansible/git_module.html) says refspec was added in 1.9.

I’m running

`$ ansible --version ansible 1.9.2 (detached HEAD f974ff6972) last updated 2015/12/07 14:19:33 (GMT -700) lib/ansible/modules/core: (detached HEAD ea913bada2) last updated 2015/12/07 14:19:33 (GMT -700) lib/ansible/modules/extras: (detached HEAD f291e9fcc3) last updated 2015/12/07 14:19:33 (GMT -700) v2/ansible/modules/core: (detached HEAD 85c8a892c8) last updated 2015/12/07 14:19:33 (GMT -700) v2/ansible/modules/extras: (detached HEAD 70ea058563) last updated 2015/12/07 14:19:33 (GMT -700) configured module search path = None`

I tried

`ansible$ git checkout stable-2.0 ansible$ git submodule update --init --recursive`

I’m still getting the same error.

I may not be using the right syntax to define the refspec value, however it seems like the refspec parameter should be recognized.

Questions:

Why isn’t the refpec paramter recognized?  
Is there another way to use the Git playbook to deploy a tagged location on a Git repo?

If not I’ll try something like

`command: cd {{deploy_to}} && git checkout tags/{{ tag_name }} && git checkout develop && git merge {{ tag_name }}`

Thanks,  
Paul

---

<div class="post-metadata">

**Author:** ![Paul\_Stivers](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@Paul\_Stivers](https://forum.ansible.com/u/Paul_Stivers)\
**Post date:** [December 8, 2015, 10:59am UTC](https://forum.ansible.com/t/git-unsupported-parameter-for-module-refspec/19958/2 "2015-12-08T10:59:32Z")

</div>

This of course works.

`command: bash -lc "cd {{deploy_to}} && git checkout tags/{{ tag_name }}"`

Removing the version parameter from the git task gave the same error message, "`msg: unsupported parameter for module: refspec" I thought perhaps having both a version and a refspec might have been causing the error.`

` `  
git: repo={{ repo\_url }} dest={{ deploy\_to }} refspec=refs/tags/{{ tag\_name }} accept\_hostkey=yes

` `

---

<div class="post-metadata">

**Author:** ![Paul\_Stivers](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@Paul\_Stivers](https://forum.ansible.com/u/Paul_Stivers)\
**Post date:** [December 10, 2015, 9:02pm UTC](https://forum.ansible.com/t/git-unsupported-parameter-for-module-refspec/19958/3 "2015-12-10T21:02:35Z")

</div>

Sheesh, I missed in the documentation that the version parameter will take a tag name as an argument. Problem solved.
