Are you sure it is a bug? Looking at the output, the "magic" to consolidate module runs by joining the items of with_items updates 'item' to be a comma separated string of all items.
I haven't tested, but I would think a when statement, should do something such as using .split(',') on item, and using difference, intersection in it's logic. Maybe I am just thinking within the confines of how this works now, but without updating 'item' to be a joined string, I am not sure things will end up working correctly. On Thu, Oct 2, 2014 at 9:48 AM, James Cammarata <jcammar...@ansible.com> wrote: > Hi Johan, > > Regardless of whether there's a cleaner way to implement what you're > doing, this does appear to be a bug. Could you please open an issue on > GitHub for this, so that we can keep track of it? > > Thanks! > > On Thu, Oct 2, 2014 at 9:30 AM, Mark McCoy <m...@mccoyfam.net> wrote: > >> Sounds like you need to go group by group, server by server, and add them >> in slowly instead of trying to jump to the end and try to come up with a >> playbook that handles all scenarios for your entire 600 machines from the >> start. You could have a single inventory file with all 600 hosts in it, but >> I think it it easier and safer to have multiple inventories (one per >> group-environment pair). This lets you run plays on just one enviroment at >> a time instead of running a huge "do everything to every machine" playbook. >> >> Let's take an example. Pick one instance of machines that are alike, like >> say you have a load-balanced pair of web servers that your HR department >> uses to store files on or something, so you call the instance "webhr". You >> have 2 production "webhr" servers and 2 test systems, so you would have a >> "webhr-prod" and a "webhr-test" instance-environment groupings. >> >> Your webhr-prod inventory could look like this: >> >> [webhr-prod] >> hrweb-1243 >> hrweb-9432 >> >> [children:webservers] >> webhr-prod >> >> >> I have a gist up at >> https://gist.github.com/BradGunnerSGT/ba1cea6c6629a702f9eb with a lot >> more detail that describes how we handle this sort of thing. Basically it >> lets us "touch" only the machines that need to be touched during that run, >> and if someone slips and runs ansible pointing at the complete inventory >> directory, then ansible only runs the parts of the master playbook >> pertinent to each individual machine and skips the rest. A system in >> "webhr-prod" would never have the "tomcat" or "mysql-server" roles run, and >> vice versa (unless the system has both "mysql-server" and "webserver" >> defined). >> >> >> >> ---- >> Mark McCoy <http://markmccoy.us> >> >> >> On Thu, Oct 2, 2014 at 8:36 AM, Johan Chassaing < >> chassaing.jo...@gmail.com> wrote: >> >>> Thanks for your reply :) >>> In my test case, I added apache indeed, but I would like to work like >>> that with any other packages. >>> I have a very long list of servers which is not up to date with all the >>> servers' servicies. >>> My intent is to not upgrade packages that can interrupt my production >>> (like apache, mysql.. ). So I want to put a list of packages that can >>> safely be upgraded and update them only if there are present. >>> If a specific server has a htop I want to upgrade without installing it >>> on the 600 others. >>> >>> If you have any idea. >>> johan >>> >>> -- >>> 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 ansible-project+unsubscr...@googlegroups.com. >>> To post to this group, send email to ansible-project@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/6dca7366-fd16-44f9-92bc-6f824aeb7e76%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/6dca7366-fd16-44f9-92bc-6f824aeb7e76%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> 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 ansible-project+unsubscr...@googlegroups.com. >> To post to this group, send email to ansible-project@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CAP2%3DG9OVoQSicYsyeBe_A3mj8iEo4Kqpnn0%2BYBg8RygPUN%2B43Q%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CAP2%3DG9OVoQSicYsyeBe_A3mj8iEo4Kqpnn0%2BYBg8RygPUN%2B43Q%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> 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 ansible-project+unsubscr...@googlegroups.com. > To post to this group, send email to ansible-project@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAMFyvFhd2%2Bx4H0d49Qa6gPTF3P4WM7qX2FBa8-%3DNYpKHH%2BErGQ%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAMFyvFhd2%2Bx4H0d49Qa6gPTF3P4WM7qX2FBa8-%3DNYpKHH%2BErGQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v-UrcYJ%3D6K-5r0KBx8_f7SntYau%3D1xd3TtenLSBrbpozg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.