How do you solve this in Ansible?
I have a file
/etc/foo/foo.config. I want to replace the string "DisallowBar" to "AlllowBarUntilMidnight" in this file.
Ansible should act in these cases like this:
- Case1: DisallowBar gets found and gets replaced: OK
- Case2: AllowBarUntilMidnight is already in the file. Nothing gets done: OK
- Case3: DisallowBar and AllowBarUntilMidnight are not in the file: I want ansible to fail.
Case3 is important for me, since this state should not exist. It is an error and this should not pass silently.