On Mon, 4 May 2020 23:06:50 +0200 Kai Stian Olstad <[email protected]> wrote:
> > > Add "throttle: 1" to you lineinfile task and it will work.
> >
> > I don't need "throttle" with 2.9.6. The playbook
>
> That is just pure luck, try running it 100 times and count how many times it
> fails.
Well, I tried and it's working properly with Python3. There is no problem with
Ansible 2.9.6 and Python 3.8 on the controller ( the redirection in the script
'2>/dev/null' is there because of annoying 3.8 RuntimeWarning).
#!/bin/bash
export ANSIBLE_STDOUT_CALLBACK=null
for i in {1..99}; do
ansible-playbook pb.yml 2>/dev/null
no_lines=`cat test-file | wc -l`
[ $no_lines -ne 2 ] && echo "ERROR File 2 lines missing"
cat /dev/null > test-file
no_lines=`cat test-file | wc -l`
[ $no_lines -ne 0 ] && echo "ERROR File not empty"
done
But, you were right with "throttle". With Ansible 2.9.6 and Python 2.7 on the
controller "throttle: 1" fixed the problem
- name: Update test file
lineinfile:
path: test-file
regexp: "^\ \ test[.-]{{ test_string|lower }}:.*"
line: " test-{{ test_string|lower }}: {{ mac }}"
delegate_to: localhost
throttle: 1
Thank you,
-vlado
--
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/20200504235514.2f5df6b4%40gmail.com.
pgp6KsCeCwa7e.pgp
Description: OpenPGP digital signature
