How to use git on ansible ?

Hello,

I have reviewed ansible git module [1], but I don’t find how it could work with my workflow.

My workflow is the next:

  • dir_fschanges: /srv/ansible/fschanges
  • project: myproject
  • Create a local {{dir_fschanges}}/{{project}} git empty repository
  • Use fetch module to fetch files to {{dir_fschanges}}/{{project}}
  • cd {{dir_fschanges}}/{{project}}
  • git add *
  • git commit “Files from servers” *
    <= Here start a loop of modifications …
  • git branch mymods
  • git checkout mymods
  • Modify {{dir_fschanges}}/{{project}} files, trying to use ansible modules
  • git add *
  • git commit -m “Files modified with ansible”
    <= Endloop
  • Review changes and Copy files from repo to servers and possibly restart services affected

If I need to copy files from servers, I would git checkout master

How can I integrate git commands on ansible playbooks without using command / shell modules. Using command will tell about using git module

Thank you very much

[1] http://docs.ansible.com/ansible/git_module.html