Ansible Tower and Dummy Hosts/Facts

Hello.

I am currently running my playbooks using Ansible Tower. I’m trying to work with facts as a method to store information that I can keep around until I want to get rid of it. Use it in multiple playbooks, etc. While I have it fully functional I’m wondering how I can clear the facts to that host in the inventory that’s not a valid host. So here is what I do…

My hostname in tower is called: fake_host

I’m using the set_fact module and delegate_to function to set the facts in the fake_host hostname.

  • name: Set facts
    set_fact:
    dummy_fact: “Hello world”
    cacheable: yes
    delegate_to: fake_host
    delegate_facts: true

This sets the fact in the hostname fake_host just fine. But if I want to clear the fact, I cannot because it’s not targeted by the playbook. So it’ll never clear the cache. The manner I tried is:

  • name: clear fact cache
    meta: clear_facts
    delegate_to: fake_host

The meta tag does not obviously work with the delegate_to function since it’s not clearing the facts.

I have tried to target the playbook using host: fake_host but the playbook run tells me the host is invalid or something to that effect. Can someone tell me if this is even possible to do? Possible to target directly?

If not, I’ll have to find other ways to keep this information for usage in other playbooks. And while I can save the facts to a file, it’s something I’ve decided not to do at this time.

Thanks.

Glen

By the way, I’m using Tower 3.5.4.

Glen