Flushing the code cache
Everywhere in IT, caches are used to speed up operations, and Ansible is no exception.
Usually, caches are good, and for this reason, they are heavily used ubiquitously. However, they might create some problems if they cache a value that should not have been cached or if they are not flushed, even if the value has changed.
Flushing caches in Ansible is very straightforward, and it’s enough to run ansible-playbook
, which we are already running, with the addition of the --flush-cache
option, as follows:
ansible-playbook -i inventory helloworld.yaml --flush-cache
Ansible can use multiple cache plugins to save host variables, as well as execution variables. Sometimes, those variables might be left behind and influence the following executions. When Ansible finds a variable that should be set in the step it just started, Ansible might assume that the step has already been completed, and therefore pick up that old variable as if it has just been...