Ansible is a declarative tool where you describe how you want your server / environment to look, and Ansible tries to do it. It is also intended for idempotent , which means that re-playing your pieces should reproduce the same end result every time until nothing underneath has changed.
The git module also ascribes this and just tries to make sure that the remote host has a repo on it and the version (or branch / tag) that you requested.
So when you run the git task in your question in the new environment, it clones the repo to the destination folder. In future runs, the repo already exists, so it just does git pull.
If you specify the tag / branch / commit ref in the update property, then it will simply check this version and pull it out.
source share