Ansible pull setup question

I want to setup an ansible pull configuration that can be used across different systems and use cases. With the Host set to localhost and bypassing the use of an inventory file is it possible to make ansible selectively run plays based on detected attributes of the system? Like maybe the hostname or even a text file with predefined “roles” in it?

I just cannot seem to find any information on selectively running plays based on some local criteria with ansible pull.

Absolutely, you can definitely do this. It’s how I do it. Try adding this option:

-i, inventory_file

Note that the comma after -i is intentional, and inventory_file refers to whatever file holds your inventory.

Let me know if that doesn’t work. If it does work, it should still have ansible-pull match on the hostname, even though it’s in pull mode.

Ok, I feel silly. I got so tunnel-visioned on trying to figure out how to setup “roles” based on locally detected facts configured at install I diddnt pay attention to the obvious.

I don’t think that option I posted was very obvious, it took me a while to find it myself a while back when I first set it up. I believe I asked in the Ansible form, if I remember correctly.