mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Allows to fetch machine architecture as an unprivileged user
This commit is contained in:
parent
9aa4214417
commit
e181bcf62b
1 changed files with 10 additions and 5 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue