looking for confirmation of bug

29 views
Skip to first unread message

Michael Baydoun

unread,
Aug 13, 2014, 2:43:23 PM8/13/14
to ansible...@googlegroups.com
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

Michael Baydoun

unread,
Aug 13, 2014, 2:49:46 PM8/13/14
to ansible...@googlegroups.com
forgot to state, this error was produced running ansible 1.7 from linux and mac

Brian Coca

unread,
Aug 13, 2014, 2:53:47 PM8/13/14
to ansible...@googlegroups.com
to get the result you want you'll need either serial or forks set to 1​, being concurrent processes you are not guaranteed they happen in perfect succession.

Michael Baydoun

unread,
Aug 13, 2014, 2:57:16 PM8/13/14
to ansible...@googlegroups.com
running with --forks=1 makes problem go away


On Wednesday, August 13, 2014 2:43:23 PM UTC-4, Michael Baydoun wrote:

Michael Baydoun

unread,
Aug 13, 2014, 3:23:55 PM8/13/14
to ansible...@googlegroups.com
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:

Matt Martz

unread,
Aug 13, 2014, 3:30:56 PM8/13/14
to ansible...@googlegroups.com
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.
--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0267337b-1501-4f2f-994c-21aa43eecc00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
ma...@sivel.net
http://sivel.net/
Reply all
Reply to author
Forward
0 new messages