set_fact retain the fact between run?

Hi Team,

I read that it is retained between each play.

So I got

TASK: [web_base | set fact CUSTOMER_LOCATOR_PORT] *****************************
ok: [demo-web-kr] => {“ansible_facts”: {“CUSTOMER_LOCATOR_PORT”: “52360”}}

But then I run
ansible -i hosts ‘demo-web-kr’ -u root -k -msetup|grep LOCATOR

found nothing about that variable. (I did remove the grep and search for it :slight_smile: .

And it looks like the same when using ansible-playbook. In the real example on my hosts file I set

CUSTOMER_LOCATOR_PORT=“{{ansible_CUSTOMER_LOCATOR_PORT|default(60000|random(50000,10))}}”

and the set_fact is in one of the role task but it does not work - that means it changes every time I run playbook.

Any idea why?

thanks in advance.

Indeed they can!

http://docs.ansible.com/playbooks_variables.html#fact-caching