# Ansible pull setup question

**URL:** <https://community.learnlinux.tv/t/ansible-pull-setup-question/300>\
**Category:** Uncategorized\
**Created:** [March 13, 2021, 9:09am UTC](https://community.learnlinux.tv/t/ansible-pull-setup-question/300 "2021-03-13T09:09:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![avanesov](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/a/9fc29f/32.png) [@avanesov](https://community.learnlinux.tv/u/avanesov)\
**Post date:** [March 13, 2021, 9:09am UTC](https://community.learnlinux.tv/t/ansible-pull-setup-question/300/1 "2021-03-13T09:09:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jay](https://community.learnlinux.tv/user_avatar/community.learnlinux.tv/jay/32/649_2.png) [@jay](https://community.learnlinux.tv/u/jay)\
**Post date:** [March 13, 2021, 7:31pm UTC](https://community.learnlinux.tv/t/ansible-pull-setup-question/300/2 "2021-03-13T19:31:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![avanesov](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/a/9fc29f/32.png) [@avanesov](https://community.learnlinux.tv/u/avanesov)\
**Post date:** [March 13, 2021, 7:45pm UTC](https://community.learnlinux.tv/t/ansible-pull-setup-question/300/3 "2021-03-13T19:45:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jay](https://community.learnlinux.tv/user_avatar/community.learnlinux.tv/jay/32/649_2.png) [@jay](https://community.learnlinux.tv/u/jay)\
**Post date:** [March 27, 2021, 2:28pm UTC](https://community.learnlinux.tv/t/ansible-pull-setup-question/300/4 "2021-03-27T14:28:56Z")

</div>

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.
