# Two problems with ansible-pull

**URL:** <https://forum.ansible.com/t/two-problems-with-ansible-pull/39953>\
**Category:** Get Help\
**Created:** [February 1, 2025, 9:19am UTC](https://forum.ansible.com/t/two-problems-with-ansible-pull/39953 "2025-02-01T09:19:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![microlinux](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/microlinux/32/2968_2.png) [@microlinux](https://forum.ansible.com/u/microlinux)\
**Post date:** [February 1, 2025, 9:19am UTC](https://forum.ansible.com/t/two-problems-with-ansible-pull/39953/1 "2025-02-01T09:19:21Z")

</div>

Hi,

I’d like to use `ansible-pull` to manage two servers and three desktops in my local network. I’ve read an excellent (though a bit outdated) [tutorial](https://opensource.com/article/18/3/manage-workstation-ansible) about `ansible-pull`, and it seems like the right fit for my use case.

I have a minimal installation of Rocky Linux 8 on a test box. I just installed Ansible from EPEL, and I have a first draft of a `local.yml` playbook in a GitHub repository here:

- [GitHub - kikinovak/microlinux-squidbox-el8](https://github.com/kikinovak/microlinux-squidbox-el8)

I execute `ansible-pull` (as `root`) with the appropriate URL, and here’s an error I get:

```auto
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import 
the required Python library (libselinux-python) on squidbox's Python 
/usr/bin/python3.12.

```

Now this is a known problem with RHEL8 and compatible clones like Rocky Linux 8. In a “classic” Ansible setup, this can be solved simply by defining this in the appropriate place:

```auto
ansible_python_interpreter=/usr/bin/python3

```

The first problem here is that there seems to be no appropriate place with `ansible-pull`. Apparently the only solution here is to use an extra variable on the command line like this:

```auto
# ansible-pull -U https://github.com/kikinovak/microlinux-squidbox-el8 \
  -e ansible_python_interpreter=/usr/bin/python3

```

This time things work as expected:

```auto
TASK [enable_selinux : Enable SELinux in enforcing mode] **************
ok: [localhost]

```

So my **first question** would be: how can I define `ansible_python_interpreter=/usr/bin/python3` in a permanent way for `ansible-pull` ?

In a similar way, I have another problem. Every time I call `ansible-pull`, I get a series of warnings:

```auto
[WARNING]: Could not match supplied host pattern, ignoring: squidbox
[WARNING]: Could not match supplied host pattern, ignoring:
...
[WARNING]: provided hosts list is empty, only localhost is available. 
Note that the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: squidbox
[WARNING]: Could not match supplied host pattern, ignoring:
squidbox.microlinux.lan

```

Apparently there seems to be no way to explain to `ansible-pull` that I only want to execute the `local.yml` play on `localhost`.

Which brings me to my **second question** : how do I get rid of these useless warnings ?

On a side note: `ansible-pull` seems to be the right fit for what I do, but some of its designs details seem… not very smart (to state it politely).

Any suggestions ?

Niki

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [February 2, 2025, 10:51am UTC](https://forum.ansible.com/t/two-problems-with-ansible-pull/39953/2 "2025-02-02T10:51:01Z")

</div>

Your repo doesn’t seem to have an inventory? Try creating a `hosts.yml` file containing something like this:

```yaml
all:
  vars:
    ansible_python_interpreter: /usr/bin/python3
  children:
    localhosts:
      hosts:
        localhost:
          ansible_connection: local

```

And a `ansible.cfg` with:

```conf
[defaults]
inventory = hosts.yml

```

Does that solve these issues?

---

<div class="post-metadata">

**Author:** ![microlinux](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/microlinux/32/2968_2.png) [@microlinux](https://forum.ansible.com/u/microlinux)\
**Post date:** [February 3, 2025, 9:04am UTC](https://forum.ansible.com/t/two-problems-with-ansible-pull/39953/3 "2025-02-03T09:04:44Z")

</div>

> [@chris](#):
>
> ```auto
> all:
> vars:
> ansible_python_interpreter: /usr/bin/python3
> children:
> localhosts:
> hosts:
> localhost:
> ansible_connection: local
> 
> ```

No, unfortunately that doesn’t solve the problem.

And please note I’m using `ansible-pull`, not `ansible`. Those two are different beasts. And `ansible-pull` seems sadly underdocumented.

Cheers,

Niki

---

<div class="post-metadata">

**Author:** ![microlinux](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/microlinux/32/2968_2.png) [@microlinux](https://forum.ansible.com/u/microlinux)\
**Post date:** [February 4, 2025, 6:46pm UTC](https://forum.ansible.com/t/two-problems-with-ansible-pull/39953/4 "2025-02-04T18:46:06Z")

</div>

Right, here goes. I’ve spent some time with a few sandbox VMs and lots of coffee, and it looks like (almost) all my problems are solved. Only thing left is those pesky warnings about missing hosts, but it looks like this problem is endemic to `ansible-pull`. I’ll just ignore them.

1. Configuration files are handled differently with ansible-pull. I had to figure that out. You have to put your stuff in `~/.ansible.cfg`. If you just use `./ansible.cfg`, things won’t work.
2. Since stuff is supposed to run locally, an inventory file makes no sense. Well, you can always try to create one, but then watch out for some confusion. This is completely undocumented, except a few educated guesses by a handful of bloggers.
3. Variables like `ansible_python_interpreter` have to go in your playbook for lack of an inventory file.

So, after a sunny day of experimenting and working out stuff and then a run in the woods to clear my head, here’s my working configuration (work in progress):

> **[GitHub - kikinovak/microlinux-squidbox-el8](https://github.com/kikinovak/microlinux-squidbox-el8)**
>
> Contribuez au développement de kikinovak/microlinux-squidbox-el8 en créant un compte sur GitHub.

Cheers from the sunny South of France,

Niki
