mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Allows to fetch machine architecture as an unprivileged user
This commit is contained in:
committed by
Jonathan Süssemilch Poulain
parent
9aa4214417
commit
e181bcf62b
@@ -186,16 +186,21 @@ class Facts(object):
|
|||||||
if self.facts['system'] == 'Linux':
|
if self.facts['system'] == 'Linux':
|
||||||
self.get_distribution_facts()
|
self.get_distribution_facts()
|
||||||
elif self.facts['system'] == 'AIX':
|
elif self.facts['system'] == 'AIX':
|
||||||
try:
|
# Attempt to use getconf to figure out architechture
|
||||||
rc, out, err = module.run_command("/usr/sbin/bootinfo -p")
|
# fall back to bootinfo if needed
|
||||||
|
if module.get_bin_path('getconf'):
|
||||||
|
rc, out, err = module.run_command([module.get_bin_path('getconf'),
|
||||||
|
'MACHINE_ARCHITECTURE'])
|
||||||
|
data = out.split('\n')
|
||||||
|
self.facts['architecture'] = data[0]
|
||||||
|
else:
|
||||||
|
rc, out, err = module.run_command([module.get_bin_path('bootinfo'),
|
||||||
|
'-p'])
|
||||||
data = out.split('\n')
|
data = out.split('\n')
|
||||||
self.facts['architecture'] = data[0]
|
self.facts['architecture'] = data[0]
|
||||||
except:
|
|
||||||
self.facts['architecture'] = 'Not Available'
|
|
||||||
elif self.facts['system'] == 'OpenBSD':
|
elif self.facts['system'] == 'OpenBSD':
|
||||||
self.facts['architecture'] = platform.uname()[5]
|
self.facts['architecture'] = platform.uname()[5]
|
||||||
|
|
||||||
|
|
||||||
def get_local_facts(self):
|
def get_local_facts(self):
|
||||||
|
|
||||||
fact_path = module.params.get('fact_path', None)
|
fact_path = module.params.get('fact_path', None)
|
||||||
|
|||||||
Reference in New Issue
Block a user