Hi all,
is it possible to “clear” or “unregister” a variable ?
I have this situation:
deploy.yml
- include “deploy-apache.yml”
- include “deploy-tomcat.yml”
deploy-apache and deploy-tomcat both have a dependency to a “deliver-artifact” role, and both run on the same server(s).
The {{installdir}} is either opt/web/install/apache or /opt/web/install/tomcat (read from included *.yml files)
The following task is implemented in this “shared” “deliver-artifact” role:
…
for each run, backup the old installdir and install into an empty directory
-
name: stat installdir
stat: path={{installdir}}
register: installdir_stat -
name: get the current time for a timestamp
command: date +%Y%m%d-%H%M%S
register: time -
name: backup installdir
command: mv {{installdir}} {{installdir}}_{{time.stdout}}
when: installdir_stat.stat.exists
…
It seems that the “installdir_stat.stat.exists” is true from the “deploy-apache.yml” run - where {{installdir}} was /opt/web/install/apache
For “deploy-tomcat.yml” run the task now tries to mv a directory that doesnt exists - but the variable installdir_stat.stat.exists is true !
=> Can I clear the register ? Or what´s the solution here?
Thanx, Torsten