Bug 2041997

Summary: docs: cannot run ansible against localhost - can only use "ansible_connection=local"
Product: Red Hat Enterprise Linux 8 Reporter: Rich Megginson <rmeggins>
Component: doc-Release_Notes-8-en-USAssignee: Lucie Vařáková <lmanasko>
Status: CLOSED NEXTRELEASE QA Contact: RHEL DPM <rhel-docs>
Severity: medium Docs Contact: Eliane Ramos Pereira <elpereir>
Priority: medium    
Version: 8.6CC: bfinger, briasmit, elpereir, jpeska, nhosoi, pcahyna, pkettman, rhel-docs, spetrosi
Target Milestone: rcKeywords: Documentation, Triaged
Target Release: 8.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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].
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-02-28 15:23:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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:
1.
2.
3.

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 127.0.0.1, all )