hey everyone, i just got started with ansible today and have a question about the core git module - does it always make remote requests when a repo is specified, even when it’s in the desired state?
i ask because ansible is taking considerable time at that step, which is annoying during this early fast iteration and is going to get really annoying once i have 20-30 repos in there. i haven’t dug into the git module code, but i can only realistically attribute the delay to a remote request - the git module correctly reports that nothing has changed, but a run that includes the repo dependency takes 25 seconds, versus 1.2 seconds when the dependency is commented out (see output dumps at bottom).
i understand that remote requests might be necessary to make absolutely sure that things are correct and maybe deal with some nasty edge cases, but for obvious reasons i would like to have the module not contact the remote if the repo is already present in the specified state. any way to get this behavior?
with the git repo:
imac:ansible nrser$ time ansible-playbook -v all.yaml
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [github_repo | clone kcrawford/dockutil from github] ********************
ok: [localhost] => {“after”: “7e7b56dae7a118c256748c2f69c82b912d64c6e2”, “before”: “7e7b56dae7a118c256748c2f69c82b912d64c6e2”, “changed”: false}
TASK: [dock | clean dock] *****************************************************
changed: [localhost] => {“changed”: true, “cmd”: “PYTHONIOENCODING=utf-8 ~/dev/gh/kcrawford/dockutil/scripts/dockutil --remove all”, “delta”: “0:00:00.095622”, “end”: “2015-02-18 19:33:21.744730”, “rc”: 0, “start”: “2015-02-18 19:33:21.649108”, “stderr”: “”, “stdout”: “”, “warnings”: }
TASK: [dock | add apps] *******************************************************
skipping: [localhost] => (item=apps)
TASK: [dock | add folders] ****************************************************
changed: [localhost] => (item={‘path’: ‘/Applications’, ‘view’: ‘list’}) => {“changed”: true, “cmd”: “PYTHONIOENCODING=utf-8 ~/dev/gh/kcrawford/dockutil/scripts/dockutil --add ‘/Applications’ --view list --display folder --sort name”, “delta”: “0:00:00.096044”, “end”: “2015-02-18 19:33:21.943452”, “item”: {“path”: “/Applications”, “view”: “list”}, “rc”: 0, “start”: “2015-02-18 19:33:21.847408”, “stderr”: “”, “stdout”: “”, “warnings”: }
changed: [localhost] => (item={‘path’: ‘~/’, ‘view’: ‘list’}) => {“changed”: true, “cmd”: “PYTHONIOENCODING=utf-8 ~/dev/gh/kcrawford/dockutil/scripts/dockutil --add ‘~/’ --view list --display folder --sort name”, “delta”: “0:00:00.097483”, “end”: “2015-02-18 19:33:22.112191”, “item”: {“path”: “~/”, “view”: “list”}, “rc”: 0, “start”: “2015-02-18 19:33:22.014708”, “stderr”: “”, “stdout”: “”, “warnings”: }
changed: [localhost] => (item={‘sort’: ‘datemodified’, ‘path’: ‘~/Downloads’, ‘view’: ‘list’}) => {“changed”: true, “cmd”: “PYTHONIOENCODING=utf-8 ~/dev/gh/kcrawford/dockutil/scripts/dockutil --add ‘~/Downloads’ --view list --display folder --sort datemodified”, “delta”: “0:00:00.099095”, “end”: “2015-02-18 19:33:22.288923”, “item”: {“path”: “~/Downloads”, “sort”: “datemodified”, “view”: “list”}, “rc”: 0, “start”: “2015-02-18 19:33:22.189828”, “stderr”: “”, “stdout”: “”, “warnings”: }
PLAY RECAP ********************************************************************
localhost : ok=5 changed=2 unreachable=0 failed=0
real 0m25.046s
user 0m0.810s
sys 0m0.584s
without the git repo: