mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #6777 from GuiGui2/devel
Setup module: Additional facts when using ansible with Linux on System z
This commit is contained in:
commit
ea53576759
1 changed files with 26 additions and 9 deletions
|
@ -587,7 +587,7 @@ class LinuxHardware(Hardware):
|
||||||
key = data[0].strip()
|
key = data[0].strip()
|
||||||
# model name is for Intel arch, Processor (mind the uppercase P)
|
# model name is for Intel arch, Processor (mind the uppercase P)
|
||||||
# works for some ARM devices, like the Sheevaplug.
|
# works for some ARM devices, like the Sheevaplug.
|
||||||
if key == 'model name' or key == 'Processor':
|
if key == 'model name' or key == 'Processor' or key == 'vendor_id':
|
||||||
if 'processor' not in self.facts:
|
if 'processor' not in self.facts:
|
||||||
self.facts['processor'] = []
|
self.facts['processor'] = []
|
||||||
self.facts['processor'].append(data[1].strip())
|
self.facts['processor'].append(data[1].strip())
|
||||||
|
@ -604,6 +604,9 @@ class LinuxHardware(Hardware):
|
||||||
sockets[physid] = int(data[1].strip())
|
sockets[physid] = int(data[1].strip())
|
||||||
elif key == 'siblings':
|
elif key == 'siblings':
|
||||||
cores[coreid] = int(data[1].strip())
|
cores[coreid] = int(data[1].strip())
|
||||||
|
elif key == '# processors':
|
||||||
|
self.facts['processor_cores'] = int(data[1].strip())
|
||||||
|
if self.facts['architecture'] != 's390x':
|
||||||
self.facts['processor_count'] = sockets and len(sockets) or i
|
self.facts['processor_count'] = sockets and len(sockets) or i
|
||||||
self.facts['processor_cores'] = sockets.values() and sockets.values()[0] or 1
|
self.facts['processor_cores'] = sockets.values() and sockets.values()[0] or 1
|
||||||
self.facts['processor_threads_per_core'] = ((cores.values() and
|
self.facts['processor_threads_per_core'] = ((cores.values() and
|
||||||
|
@ -2214,9 +2217,23 @@ class LinuxVirtual(Virtual):
|
||||||
elif re.match('^vendor_id.*PowerVM Lx86', line):
|
elif re.match('^vendor_id.*PowerVM Lx86', line):
|
||||||
self.facts['virtualization_type'] = 'powervm_lx86'
|
self.facts['virtualization_type'] = 'powervm_lx86'
|
||||||
elif re.match('^vendor_id.*IBM/S390', line):
|
elif re.match('^vendor_id.*IBM/S390', line):
|
||||||
|
self.facts['virtualization_type'] = 'PR/SM'
|
||||||
|
lscpu = module.get_bin_path('lscpu')
|
||||||
|
if lscpu:
|
||||||
|
rc, out, err = module.run_command(["lscpu"])
|
||||||
|
if rc == 0:
|
||||||
|
for line in out.split("\n"):
|
||||||
|
data = line.split(":", 1)
|
||||||
|
key = data[0].strip()
|
||||||
|
if key == 'Hypervisor':
|
||||||
|
self.facts['virtualization_type'] = data[1].strip()
|
||||||
|
else:
|
||||||
self.facts['virtualization_type'] = 'ibm_systemz'
|
self.facts['virtualization_type'] = 'ibm_systemz'
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
if self.facts['virtualization_type'] == 'PR/SM':
|
||||||
|
self.facts['virtualization_role'] = 'LPAR'
|
||||||
|
else:
|
||||||
self.facts['virtualization_role'] = 'guest'
|
self.facts['virtualization_role'] = 'guest'
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue