hard disk serial mask by <filter> in register

I wrote a playbook to collect CPU/RAM/HDD info in ansible using command “inxi”

  • 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

but , dunno why , the serial column were masked by “”

“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: temp: 36 C ",
" ID-2: /dev/sdb vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 3.0 Gb/s ",
" serial: temp: 35 C ",
" ID-3: /dev/sdc vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 3.0 Gb/s ",
" serial: temp: 37 C ",
" ID-4: /dev/sdd vendor: Seagate model: ST2000DM001-1ER164 size: 1.82 TiB speed: 3.0 Gb/s ",
" serial: temp: 37 C "
]

I can run that command on remote host with correct value

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:~#

is there any ansible parameters to auto masked “security” column ?? and how to avoid that ?

I wrote a playbook to collect CPU/RAM/HDD info in ansible using command
"inxi"

but , dunno why , the serial column were masked by "<filter>"

ST2000DM001-1ER164 size: 1.82 TiB speed: 3.0 Gb/s ",
            " serial: <filter> temp: 37 C "
        ]

This is not something Ansible does, so it must be inxi.

I can run that command on remote host with correct value

root@pve:~# /usr/local/bin/inxi -c -Dxx -C -m

1.82 TiB speed: 3.0 Gb/s serial: W4Z3GYNJ temp: 37 C
root@pve:~#

When you run this on the command line you are running it in a interactive shell.
When Ansible run a command on a remote host the shell will run in non-interactive mode.

So if you run
ssh <user>@<some_host> /usr/local/bin/inxi -c -Dxx -C -m

this will also be a non-interactive shell an you should get the same result with the <filter>

is there any ansible parameters to auto masked "security" column ?? and how
to avoid that ?

You must look in the inxi documentation for this.
inxi probably detect that it's not running in an interactive shell and filter out what it consider sensitive information.

yes , exactly what you said. inxi auto masked sensitive data in non-interacting shell .

I add some parameters to inxi then problem solve , thanks !

Kai Stian Olstad於 2019年4月23日星期二 UTC+8下午2時29分52秒寫道: