Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible_userspace_bits fact is incorrect when running 32bit python on 64bit architecture #5510

Closed
KimNorgaard opened this issue Jan 6, 2014 · 1 comment

Comments

@KimNorgaard
Copy link
Contributor

Ansible version: 1.4.3

Cause

  • The userspace_bits fact is generated using platform.architecture.
  • platform.architecture uses sys.executable (as the first argument to platform.architecture) by default to determine the architecture.
  • sys.executable is the python interpreter and if this is a 32-bit binary, then userspace_bits report 32. Even if the underlying architecture of the OS is 64-bit.

Example

Ansible says:

$ ansible -i ansible-hosts -m setup solarisserver|grep bits
        "ansible_userspace_bits": "32"

On the server:

$ uname -m -s -r -v -p -i
SunOS 5.10 Generic_147441-27 i86pc i386 i86pc

$ file /usr/bin/python
/usr/bin/python:        ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, not stripped, no debugging information available

$ isainfo -kv
64-bit amd64 kernel modules

Possible solutions

I have come up with a few solutions, though there are probably more:

  1. Supply another executable as the first argument to platform.architecture. This will probably not work because it's hard to find a binary that exists on all platforms and that is linked to that platform's architecture.
  2. Move away from platform.architecture and use system native methods to figure out the architecture (isainfo on SunOS, getconf on HPUX, etc.). This method will probably render more consistent results, but it has the disadvantage that you must take all sorts of variables into consideration (os types, os versions, releases, hardware architectures, etc.).
@mpdehaan
Copy link
Contributor

mpdehaan commented Jan 6, 2014

I've changed the defect topic from "cannot be trusted" to "is incorrect", as this totally sounded like some kindof security issue, and it's not :)

Further, I don't think this is not a bug.

There are other facts for architecture (like 'ansible_architecture'), as this was added to detect that we were running a 32bit python on a 64 bit OS, so is working as designed, IMHO.

If you disagree, let's discuss on the ansible-devel list.

@mpdehaan mpdehaan closed this as completed Jan 6, 2014
edunham pushed a commit to edunham/galaxy-role-android-ndk that referenced this issue Aug 21, 2015
Also bump the version and add checksums, for when Ansible gets around to
supporting them.

This will install a 32- or 64-bit NDK based on the system's python version,
because Ansible: ansible/ansible#5510
jimi-c pushed a commit that referenced this issue Dec 6, 2016
* Expose internal_network in os_floating_ip

Shade project has finally exposed this argument so now this module
matches old quantum_floatingip module's capabilities.

Use "nat_destination" term instead of "internal_network" to match shade
terminology.

* Add (private|internal)_network aliases to os_floating_ip

* Fix typo in os_floating_ip
@ansible ansible locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants