On Mon, 4 May 2020 22:31:49 +0200 Kai Stian Olstad <[email protected]> wrote:
> > [test_group]
> > host1
> > host2
>
> Since you have two host you will have two tasks that tries to write to the
> same
> file at the same time, and only one of them will win.
>
> Add "throttle: 1" to you lineinfile task and it will work.
I don't need "throttle" with 2.9.6. The playbook
shell> cat pb.yml
- hosts:
- test_01
- test_02
gather_facts: false
tasks:
- lineinfile:
path: test-file
line: "{{ inventory_hostname }}"
delegate_to: localhost
gives
shell> cat test-file
shell> ansible-playbook pb.yml
PLAY [test_01,test_02]
*******************************
TASK [lineinfile]
*******************************
changed: [test_01 -> localhost]
changed: [test_02 -> localhost]
PLAY RECAP
*******************************
test_01 : ok=1 changed=1 unreachable=0 failed=0
skipped=0 rescued=0 ignored=0 test_02 : ok=1
changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
shell> cat test-file
test_01
test_02
--
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/20200504224938.51f3f4c6%40gmail.com.
pgpXGd8uCZuCw.pgp
Description: OpenPGP digital signature
