On 02.10.2019 09:43, T Karim wrote:
Hi,
I am using the slurp module to retrieve and decode a binary file. However,
I am getting wrong output with binary starting with 1F EF BD instead of
what I have in a decoded file with other tools: 1F 8B 08

- name: Read backup file content
  slurp:
    src: "/tmp/{{ file }}"
  register: slurp_result
  delegate_to: localhost

- name: Define file content
  set_fact:
    content: "{{slurp_result.content | b64decode }}"

The filter b64decode doesn't support binary data, only ASCII.

Since you are getting the file from localhost you can use lookup plugin file.

{{ lookup('file', '/tmp/' ~ file) }}

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4d68e82804dd3667bcbe8e9d34971b7d%40olstad.com.

Reply via email to