run_once, runs once per specified hosts. Serial causes this to run for each batch.
So serial: 1 with run_once causes the task to run for every host. On Wednesday, August 13, 2014, Michael Baydoun <[email protected]> wrote: > actually, if I set serial to 1 the first task which has a run_once ends up > running multiple times, which breaks the playbook > > On Wednesday, August 13, 2014 2:43:23 PM UTC-4, Michael Baydoun wrote: >> >> before I file a bug report >> playbook to reproduce is below >> change hosts line to specify three or more individual hosts, or a group >> containing three or more hosts >> after running playbook /tmp/test.out is expected to contain 1 line for >> each host >> but it will often be missing one or more lines >> run playbook again and get a different result >> >> --- >> >> - hosts: ds1:ds2:ds3 >> >> remote_user: root >> >> vars: >> >> outfile: /tmp/test.out >> >> tasks: >> >> >> - name: test | start with empty local file >> >> local_action: file path={{ outfile }} state=absent >> >> run_once: true >> >> >> - name: test | generate output one line per host >> >> shell: "echo {{ ansible_hostname }} file.sh dbname" >> >> register: hostout >> >> >> >> - debug: var=hostout.stdout >> >> >> - name: test | create local file listing all output from above >> >> local_action: lineinfile dest={{ outfile }} line="{{ hostout.stdout >> }}" create=yes >> > -- > 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:_e(%7B%7D,'cvml','ansible-project%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/0267337b-1501-4f2f-994c-21aa43eecc00%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/0267337b-1501-4f2f-994c-21aa43eecc00%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz [email protected] http://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 [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/CAD8N0v-5hn_mo5em78BHNjLW2JnWCEeuguGPjmnGbi_O9WX-TQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
