Hi all,
our general setup is based on the idea to have an ansible environment with roles and vars and everything, that can be used
both by command line and also programatically from python. It was quite easy with ansible 1.9, but i struggle to get it with
newer ansible 2.0.
Here is the point, i can’t get fixed:
In python:
from ansible.cli.playbook import *
from ansible.executor.playbook_executor import *
from ansible.utils.vars import combine_vars
my_cli=PlaybookCLI([‘’, ‘/amplay/reboot.yml’,‘-i’,‘/amplay/hosts’,‘-l’,‘nuc5’])
my_cli.parse()
results=my_cli.run()
Output:
PLAY [Start Protected] *********************************************************
TASK [twist-protected : include] ***********************************************
included: /amplay/roles/twist-protected/tasks/start-protected.yml for nuc5
TASK [twist-protected : Workaround delegate_to user name problem] **************
ok: [nuc5]
TASK [twist-protected : Check Twistprotected] **********************************
ok: [nuc5 → localhost]
…
Now i run the same code a second time:
my_cli=PlaybookCLI([‘’, ‘/amplay/reboot.yml’,‘-i’,‘/amplay/hosts’,‘-l’,‘nuc5’])
my_cli.parse()
results=my_cli.run()
Output:
PLAY [Start Protected] *********************************************************
TASK [twist-protected : include] ***********************************************
included: /amplay/roles/twist-protected/tasks/start-protected.yml for nuc5
TASK [twist-protected : include] ***********************************************
included: /amplay/roles/twist-protected/tasks/setup-proxy.yml for nuc5
…
It does not execute the tasks, but just skips without any message!
Apparently there is some caching or similar, that tells ansible not to repeat the execution of the playbook.
This might make sense for some scenarios, but how can i switch it off? I tried with flush-cache
cmd line
option, but that didn’t change anything.
Any hints?