2

Is there a nicer way of doing zcat in ansible than invoking shell?

- name: "Unpack the local config"
  shell: "zcat /proc/config.gz > /usr/src/linux/.config"
  args:
    creates: "/usr/src/linux/.config"
2
  • If you've a recent ansible, 2.2+, you could probably use unarchive with remote_src: yes. I don't have access to test just now.
    – jscott
    Dec 10, 2016 at 12:12
  • @jscott I tried that earlier but it seems like unarchive dest is implied to be a directory where the files get unpacked too. It doesn't let me unpack a blob into a file. As far as my attempts went at least.
    – Kit Sunde
    Dec 10, 2016 at 12:16

1 Answer 1

3

In the future there might be an uncompress module, but today no:

https://github.com/ansible/ansible-modules-core/issues/3241#issuecomment-240991265

The unarchive module only supports archives, not compressed files. The documentation was improved to make that more clear. We anticipate a new pure-python uncompress module that will support compressed files as well as archives, which would then deprecate the unarchive module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.