lineinfile when used with serial is overwriting the data.
*Here's what I'm trying to do:*
In a serial deployment there are '100' hosts and 20 in each batch. I do not
want to stop the execution when a task fails for one host. I'm using
ignore_failure to ignore the failure and continue exec on other hosts. At
the end of the exec I want to list all the hosts which failed to execute
the task. I tried using a local var, I wasn't successful. I tried writing
the hostname to a file and at the end of playbook exec I want to print the
file.
I'm able to do it with shell module >>. But I am unable to do it with
lineinfile.
STEPS TO REPRODUCE
- hosts: webservers
remote_user: sudo
serial: "{{ serial_count | default('100%') }}"
tasks:
- name: update file
lineinfile: hosts.txt line="{{ inventory_hostname }}"
delegate_to: localhost
EXPECTED RESULTS
All the hostnames in the file
ACTUAL RESULTS
Only few hostnames, random every time.
I would like to know if there are any better approaches to do this.
Thanks.
--
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/1190d475-1252-4617-801b-0ec80e81cd5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.