Bug 1567995

Summary: Ansible cannot manage localhost
Product: [Fedora] Fedora Reporter: Andrei Stepanov <astepano>
Component: ansibleAssignee: Kevin Fenzi <kevin>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: a.badger, athmanem, bgoncalv, kevin, maxim, pcahyna, tbielawa
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1567996 (view as bug list) Environment:
Last Closed: 2018-04-16 19:57:13 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:
Bug Depends On:    
Bug Blocks: 1567996    

Description Andrei Stepanov 2018-04-16 14:27:43 UTC
Ansible cannot manage localhost system without tweaking, ansible uses /usr/bin/python by default, which is not available on Rawhide.

ansible-2.5.0-2.fc29.noarch


# ansible -i localhost, all -m ping --extra-vars "ansible_connection=local"
localhost | FAILED! => {
    "changed": false,
    "module_stderr": "/bin/sh: /usr/bin/python: No such file or directory\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE",
    "rc": 127
}
 
# ls /usr/bin/python*
/usr/bin/python3  /usr/bin/python3.6  /usr/bin/python3.6m  /usr/bin/python3-chardetect
 
# cat /etc/os-release
NAME=Fedora
VERSION="29 (Cloud Edition)"
ID=fedora
VERSION_ID=29
PRETTY_NAME="Fedora 29 (Cloud Edition)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:29"
HOME_URL="https://fedoraproject.org/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=rawhide
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=rawhide
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Cloud Edition"
VARIANT_ID=cloud


User must specify extra parameters, which is not intuitive:

# ansible -i localhost, all -m ping --extra-vars "ansible_connection=local" --extra-vars ansible_python_interpreter=/usr/bin/python3 
localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Comment 1 Andrei Stepanov 2018-04-16 19:57:13 UTC
We define `localhost` explicitly. As a result, we must set `ansible_python_interpreter` too.