So basically I will need to set facts for every major playbook once it succeeds and then check for it? I thought Ansible was idempotent in this way by default
On Saturday, August 20, 2016 at 3:28:45 AM UTC-7, Dick Davies wrote: > > Use a when: clause, or make the included files tasks idempotent. > > On 19 August 2016 at 22:25, <[email protected] <javascript:>> > wrote: > > Short version: > > Why does Ansible keep running '-include: mysql-cluster.yml' whenever it > > encounters it? Can't it recognize this was already executed once? > > > > Long version: > > I am trying to find a good way to organize Ansible scripts so that they > meet > > these requirements: > > - Developers can run their project and not worry about running any > > dependencies manually > > - Have a master playbook describing our whole infrastructure (site.yml) > and > > not call dependencies multiple times even though they already run. > > > > We're running a mid size setup with site.yml that is a list of other > > playbooks that we include. > > # file: site.yml > > # This is a top level playbook representing everything in Polaris. > > # It includes subplaybooks for independent collections of modules that > may > > be deployed together. > > > > # Infrastructure > > - include: cdh5.yml > > - include: memcached.yml > > - include: myAPI_1.yml > > - include: myAPI_2.yml > > > > ( and so on ) > > > > The myAPI_1 and myAPI_2 playbook look like this: > > file: myAPI_1.yml > > --- > > > > - include: mysql-cluster.yml > > > > - name: Memcached - Setup > > hosts: memcached > > roles: > > - memcached > > tags: > > - memcached > > > > - name: My API 1 - Setup > > hosts: myapis > > roles: > > - repository > > - oracle-java > > - myAPIs/myAPI_1 > > tags: > > - myAPI_1 > > > > > > > > When running site.yml, how do I avoid calling running MySQL-cluster > playbook > > twice? Once included via myAPI_1, second time via myAPI_2. > > For developers, I want them to be able to run myAPI_1.yml and not worry > > about running any other dependencies. > > > > I tried doing this with TAGS, so developers would always launch site.yml > > with '--tags=myAPI1' but for a large site.yml this takes a long time and > > leaves a lot irrelevant logging. > > > > Using meta dependencies works only for roles, not playbooks. > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Ansible Project" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > To post to this group, send email to [email protected] > <javascript:>. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/ansible-project/bdf52ade-9cbb-45fa-8b03-fc789aa515f7%40googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/da079b88-79c6-405c-8229-7f01ee4007c9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
