unzip to unarchive

54 views
Skip to first unread message

lpesc...@google.com

unread,
Aug 28, 2020, 12:41:24 PM8/28/20
to Ansible Project
Hi all, 
I want to change this to unarchive:

- name: unpack-protos-bin
  shell: unzip -o /root/.ansible-management/file.zip -d /usr/local bin/protoc
  args:
    executable: /bin/bash
  notify:
    - unpack-proto-includes

- name: unpack-proto-includes
  shell: unzip -o /root/.ansible-management/file.zip -d /usr/local include/*
  args:
    executable: /bin/bash


This is what I have surmounted, but not sure if it's correct:

- name: unpack-protos-bin
  unarchive:
    src: file.zip
    dest: /usr/local/bin/protoc
  notify:
    - unpack-proto-includes

- name: unpack-proto-includes
  unarchive:
    dest: /usr/local/include/*

Can anyone tell me if I am correct, and if not, how to resolve?


lpesc...@google.com

unread,
Aug 28, 2020, 12:42:13 PM8/28/20
to Ansible Project
I'm also curious about how the -o and -d switches in the original playbook relate to the new.

lpesc...@google.com

unread,
Aug 31, 2020, 5:48:31 PM8/31/20
to Ansible Project
Bump - anyone?

Nuno Costa

unread,
Sep 2, 2020, 11:18:49 AM9/2/20
to Ansible Project
I'm using something like below but I had to add ignore_errorsyes due to what I believe is a bug in ansible and/or unarchive module.
The task always fail but the files are extracted.


   - nameUnzip core plugins from war file
      unarchive:
        remote_srctrue
        src"/home/user/gerrit-war/gerrit-3.2.3.war"
        extra_opts:
          - -j
          - "/home/user/gerrit-war/gerrit-3.2.3.war"
          - "WEB-INF/plugins/{{ item }}.jar"
        dest"/home/user"
      loop:
        - replication
        - gitiles
      ignore_errorsyes

Reply all
Reply to author
Forward
0 new messages