The most basic way to use Git is to use the git clone command to clone an origin Git repository (such as example.git) to a directory on your PC (such as /home/john.doe/git), make a change to a file in the cloned repository on your PC (such as example.txt), use the git commit command to commit the change to the file, and to then use the git push command to upload the file to the origin Git repository.
If you are not familiar with modules, check out Ansible - Getting Started with Modules.
The git module can be used to create a zip, tar, or gzip compressed tar archive of a git repository can be created. This is kind of like using the git archive command.
This module requires that the repository first be cloned onto the managed node, and then an archive of the directory on the managed node is created. Which means you may need to use the file module to remove the clone directory (e.g. rmdir /usr/local/git/foo).
This module does not support creating an archive that only contains a specific file or directory in the archive.
In this example, the foo.tar.gz archive will be created.
- name: create foo.tar.gz of foo.git