Comments (8)
Files identified in the description:
None
If these files are incorrect, please update the component name
section of the description or use the component bot command.
from ansible.
This is not a bug. You are attempting to update a file multiple times simultaneously, so at least one update will make it into the file but some may not (depending on the exact timing of when each module execution reads and writes the file, which will vary between playbook runs.)
You should either template the entire file at once, or make sure you only run one lineinfile:
task at a time (e.g. by using serial:
or throttle:
)
from ansible.
Closing per above.
If you have further questions please stop by IRC or the mailing list:
- IRC: #ansible on irc.libera.chat
- mailing list: https://groups.google.com/forum/#!forum/ansible-project
from ansible.
This is not a bug. You are attempting to update a file multiple times simultaneously, so at least one update will make it into the file but some may not (depending on the exact timing of when each module execution reads and writes the file, which will vary between playbook runs.)
You should either template the entire file at once, or make sure you only run one
lineinfile:
task at a time (e.g. by usingserial:
orthrottle:
)
Thats interesting, throttle made it consistent
from ansible.
You have to take into account that Ansible is parallel by default, but this does not lock files as the basic assumption is that the parallelism will affect different hosts. So if you want to do something like this you can use several solutions (some already explained above):
- a callback (see the included tree callback)
- a task with run: once and a template that writes the file in one shot
- a play that runs on localhost
- a task with throttle: 1, can keep lineinfile
- a play with serial: 1, can keep lineinfile
from ansible.
You have to take into account that Ansible is parallel by default, but this does not lock files as the basic assumption is that the parallelism will affect different hosts. So if you want to do something like this you can use several solutions (some already explained above):
* a task with run: once and a template that writes the file in one shot
* a play that runs on localhost
These 2 did not work for me. The race condition still messed with the variables being written to the file.
from ansible.
There should be no race conditions as both only apply to a single host and hence only one fork.
from ansible.
When i tried it, it did not work. both template and/or localhost did not work
from ansible.
Related Issues (20)
- ERROR! 'listen' is not a valid attribute for a Block HOT 4
- Trying to create a postgresqlflexibleserver fail with an API internal server error HOT 3
- `user` module use of chmod/chown can change files outside of home dir HOT 1
- get_url error if tile character (~) is in url HOT 5
- Windows command works with winrm but hangs with SSH HOT 2
- Allow retry/loops on blocks HOT 4
- package/dnf5 doesn't seem to install packages on Fedora 41 HOT 3
- community.windows.win_scheduled_task fails to update when Windows is using regional settings with dots in time. HOT 1
- ansible.builtin.password_hash filter return a value when an undefined variable is provided HOT 6
- copy task changes file permissions of the existing destination file when becoming an unprivileged user although mode is not specified HOT 1
- (auto-added by VS-Code) new line on Ansible-Vault breaks HMAC verification. HOT 10
- tags are not inherited by role dependencies, breaking the dependencies HOT 3
- Make include_vars module concatenate the same list from different vars files instead of overwriting HOT 4
- ansible.builtin.find should explicitly mention it does not list links by default HOT 13
- TOML Inventory generates empty "hosts" group HOT 3
- ModuleNotFoundError: No module named 'ansible_collections.ansible.builtin' HOT 3
- No error issued on `is defined` references a variable that reference an undefined variable HOT 3
- No error issued on `is defined` referencing a variable that references an undefined variable HOT 5
- Make ansible galaxy support installation from git repo with submodules HOT 2
- Option -u ignored by ansible-pull HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible.