Filter setup-repos loop before include_tasks

Ansible task execution can be a bit slow - so the noop case where
we don't end up doing anything can still be costly. Instead, put
the when on the loop call, which will apply to each iteration of
the loop, not running the loop itself. This way we should only
include_tasks if we need to.

In order for the utility playbook to keep working, we also run all
of the iterations of the loop if gitea_always_update is true. This
will make a sync run take a long time but be comprehensive.

Change-Id: Ib60c736d46d8253e603de097eb80bc84b3366310
This commit is contained in:
Monty Taylor 2019-03-04 20:39:17 +00:00
parent d3220a7ade
commit e29a62d87f

View File

@ -41,3 +41,4 @@
loop_control:
loop_var: project
include_tasks: 'setup-repo.yaml'
when: gitea_always_update or project.project not in gitea_repos