How vault win_shell output command?

  ansible, command-line, vault, windows, yaml

I need to vault (sha1, sha256… ) the ansible output of "type" windows command with whin_shell module.

Code:

win_shell: type 'C:testtest01.txt' | sha1sum
args:
  executable: 'cmd'
register: recorder

Ansible error:

fatal: [test]: FAILED! => {
    "changed": true, 
    "cmd": "type 'C:testtest01.txt' | sha1sum", 
    "delta": "0:00:00.046875", 
    "end": "2021-03-30 10:31:29.119955", 
    "msg": "non-zero return code", 
    "rc": 255, 
    "start": "2021-03-30 10:31:29.073080", 
    "stderr": "'sha1sum' is not recognized as an internal or external command,rnoperable program or batch file.rn", 
    "stderr_lines": [
        "'sha1sum' is not recognized as an internal or external command,", 
        "operable program or batch file."
    ], 
    "stdout": "", 
    "stdout_lines": []
}

Note: The target is vault a file content before the insertion in the register var {{ recorder }}.

Sincerely,
Thank’s a lot!!!

Source: Windows Questions

LEAVE A COMMENT