# hard disk serial mask by \<filter\> in register

**URL:** <https://forum.ansible.com/t/hard-disk-serial-mask-by-filter-in-register/30167>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [April 23, 2019, 4:17am UTC](https://forum.ansible.com/t/hard-disk-serial-mask-by-filter-in-register/30167 "2019-04-23T04:17:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cch](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@cch](https://forum.ansible.com/u/cch)\
**Post date:** [April 23, 2019, 4:17am UTC](https://forum.ansible.com/t/hard-disk-serial-mask-by-filter-in-register/30167/1 "2019-04-23T04:17:31Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 23, 2019, 6:29am UTC](https://forum.ansible.com/t/hard-disk-serial-mask-by-filter-in-register/30167/2 "2019-04-23T06:29:38Z")

</div>

> 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 ",  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" serial: \<filter\> temp: 37 C "  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]

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.

---

<div class="post-metadata">

**Author:** ![cch](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@cch](https://forum.ansible.com/u/cch)\
**Post date:** [April 23, 2019, 8:46am UTC](https://forum.ansible.com/t/hard-disk-serial-mask-by-filter-in-register/30167/3 "2019-04-23T08:46:20Z")

</div>

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秒寫道：
