RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2041997 - docs: cannot run ansible against localhost - can only use "ansible_connection=local"
Summary: docs: cannot run ansible against localhost - can only use "ansible_connection...
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: doc-Release_Notes-8-en-US
Version: 8.6
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: 8.6
Assignee: Lucie Vařáková
QA Contact: RHEL DPM
Eliane Ramos Pereira
Depends On:
TreeView+ depends on / blocked
Reported: 2022-01-18 16:46 UTC by Rich Megginson
Modified: 2023-01-17 20:59 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
.Unable to manage `localhost` by using the `localhost` hostname in the playbook or inventory With the inclusion of the `ansible-core 2.13` package in RHEL, if you are running Ansible on the same host you manage your nodes, you cannot do it by using the `localhost` hostname in your playbook or inventory. This happens because `ansible-core 2.13` uses the `python38` module, and many of the libraries are missing, for example, `blivet` for the `storage` role, `gobject` for the `network` role. To workaround this problem, if you are already using the `localhost` hostname in your playbook or inventory, you can add a connection, by using `ansible_connection=local`, or by creating an inventory file that lists `localhost` with the `ansible_connection=local` option. With that, you are able to manage resources on `localhost`. For more details, see the article link:https://access.redhat.com/solutions/6726561[RHEL System Roles playbooks fail when run on localhost].
Clone Of:
Last Closed: 2022-02-28 15:23:42 UTC
Type: Bug
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-108509 0 None None None 2022-01-18 16:57:09 UTC

Description Rich Megginson 2022-01-18 16:46:15 UTC
Description of problem:

With RHEL 8.6, and the ansible-core 2.12 included in RHEL, you cannot use ansible to manage localhost by using the hostname "localhost" in the playbook or inventory.  That is, if you are running ansible on the same system that you want to manage, doing something like this will not work:

- hosts: localhost

The problem is that ansible-core 2.12 uses the python38 module, and many of the libraries that we use are missing such as blivet for the storage role, gobject for network, and many, many more.

You must instead tell ansible to use a local connection for localhost e.g. in the inventory use `ansible_connection=local`, or use `ansible-playbook -c local`, when you want to manage resources on localhost.

There is no way to fix this in the code, we will need to add this to our release notes and our documentation for RHEL8.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:

Actual results:

Expected results:

Additional info:

Comment 2 Pavel Cahyna 2022-01-18 20:48:07 UTC
how to quickly compare behavior with implicit localhost and explicit inventory connecting to localhost:

diff -u <(ansible -vvv -a /bin/true -c local localhost ) <(ansible -vvv  -a /bin/true -c local -i, all )

Note You need to log in before you can comment on or make changes to this bug.