我写了一个剧本来使用命令“ inxi”来收集CPU / RAM / HDD信息
- name: run inxi to collect Ubuntu/Debian hardware info
become: yes
become_method: sudo
shell: "/usr/local/bin/inxi -c -Dxx -C -m"
register: du_hw_info
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Debian" or ansible_distribution == "CentOS"
- name: debug bsd_hw_info
debug:
var=du_hw_info
- name: run inxi to collect FreeBSD hardware info
shell: "/usr/local/bin/inxi -c -Dxx -C -m"
register: bsd_hw_info
when: ansible_distribution == "FreeBSD"
- name: debug bsd_hw_info
debug:
var=bsd_hw_info
但是,不知道为什么,序列列被“”遮盖了
"stdout_lines": [
"Memory: RAM: total: 15.63 GiB used: 9.98 GiB (63.9%) ",
" Array-1: capacity: 32 GiB slots: 4 EC: Single-bit ECC max module size: 8 GiB note: est. ",
" Device-1: DIMM_A1 size: 4 GiB speed: 1333 MHz type: DDR3 manufacturer: Transcend ",
" part-no: TS512MLK72V3N ",
" Device-2: DIMM_A2 size: 4 GiB speed: 1333 MHz type: DDR3 manufacturer: Transcend ",
" part-no: TS512MLK72V3N ",
" Device-3: DIMM_B1 size: 4 GiB speed: 1600 MHz type: DDR3 manufacturer: 0000 ",
" part-no: 76.B105G.C4B0C ",
" Device-4: DIMM_B2 size: 4 GiB speed: 1600 MHz type: DDR3 manufacturer: 0000 ",
" part-no: 76.B105G.C4B0C ",
"CPU: Topology: Quad Core model: Intel Xeon E3-1220 v3 bits: 64 type: MCP arch: Haswell ",
" rev: 3 L1 cache: 256 KiB L2 cache: 8192 KiB L3 cache: 8192 KiB ",
" flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 24744 ",
" Speed: 3093 MHz min/max: 800/3500 MHz Core speeds (MHz): 1: 3093 2: 3093 3: 3093 ",
" 4: 3093 ",
"Drives: Local Storage: total: 7.28 TiB used: 119.11 GiB (1.6%) ",
" ID-1: /dev/sda vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 6.0 Gb/s ",
" serial: <filter> temp: 36 C ",
" ID-2: /dev/sdb vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 3.0 Gb/s ",
" serial: <filter> temp: 35 C ",
" ID-3: /dev/sdc vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 3.0 Gb/s ",
" serial: <filter> temp: 37 C ",
" ID-4: /dev/sdd vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 3.0 Gb/s ",
" serial: <filter> temp: 37 C "
]
我可以在远程主机上以正确的值运行该命令
root@pve:~# /usr/local/bin/inxi -c -Dxx -C -m
Memory: RAM: total: 15.63 GiB used: 9.95 GiB (63.6%)
Array-1: capacity: 32 GiB slots: 4 EC: Single-bit ECC max module size: 8 GiB note: est.
Device-1: DIMM_A1 size: 4 GiB speed: 1333 MHz type: DDR3 manufacturer: Transcend part-no: TS512MLK72V3N
Device-2: DIMM_A2 size: 4 GiB speed: 1333 MHz type: DDR3 manufacturer: Transcend part-no: TS512MLK72V3N
Device-3: DIMM_B1 size: 4 GiB speed: 1600 MHz type: DDR3 manufacturer: 0000 part-no: 76.B105G.C4B0C
Device-4: DIMM_B2 size: 4 GiB speed: 1600 MHz type: DDR3 manufacturer: 0000 part-no: 76.B105G.C4B0C
CPU: Topology: Quad Core model: Intel Xeon E3-1220 v3 bits: 64 type: MCP arch: Haswell rev: 3 L1 cache: 256 KiB
L2 cache: 8192 KiB L3 cache: 8192 KiB
flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 24744
Speed: 3108 MHz min/max: 800/3500 MHz Core speeds (MHz): 1: 3093 2: 3093 3: 3093 4: 3093
Drives: Local Storage: total: 7.28 TiB used: 119.11 GiB (1.6%)
ID-1: /dev/sda vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 6.0 Gb/s serial: W4Z3GJ93 temp: 36 C
ID-2: /dev/sdb vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 3.0 Gb/s serial: W4Z3KM2F temp: 35 C
ID-3: /dev/sdc vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 3.0 Gb/s serial: W4Z3KKJB temp: 37 C
ID-4: /dev/sdd vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 3.0 Gb/s serial: W4Z3GYNJ temp: 37 C
root@pve:~#
是否有任何可自动屏蔽“安全性”列的参数?以及如何避免这种情况?