Unsupported unarchive module

Hi @Inderpreet @rahul456 @Akshayy @juliettet
I have got assigned a task to create unarchive on app servers using ansible.

But as I am executing the playbook, that is giving me errors that unarchive module is not supported.

fatal: [stapp01]: FAILED! => {“changed”: false, “msg”: “Unsupported parameters for (unarchive) module: user Supported parameters include: attributes, backup, content, creates, delimiter, dest, directory_mode, exclude, extra_opts, follow, force, group, keep_newer, list_files, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate_certs”}

  • hosts: stapp01
    tasks:

    • name: Unzipping the file
      ansible.builtin.unarchive:
      src: /usr/src/sysops/nautilus.zip
      dest: /opt/sysops/
      user: tony
      group: tony
      mode: 0644
  • hosts: stapp02
    tasks:

    • name: Unzipping the file
      ansible.builtin.unarchive:
      src: /usr/src/sysops/nautilus.zip
      dest: /opt/sysops/
      user: steve
      group: steve
      mode: 0644
  • hosts: stapp03
    tasks:

    • name: Unzipping the file
      ansible.builtin.unarchive:
      src: /usr/src/sysops/nautilus.zip
      dest: /opt/sysops/
      user: banner
      group: banner
      mode: 0644

P.S: I HAVE ALSO TRIED ansible.builtin.unarchive module.

Please check.

Hi @Ashu27,

Here is the approach that I took. My paths will be different from yours:

1 => on the Jump server:

cd /home/thor/ansible

sudo vi ansible.cfg
# set your inventory file and remote user
[defaults]
inventory = ./inventory
remote_user = thor
host_key_checking = False

sudo vi playbook.yml
# note: {{ ansible_user }} is defined in the inventory file
- name: Unzip data & send to all 3 App Servers
  hosts: stapp01, stapp02, stapp03
  become: yes
  tasks:
    - name: Extract the archive and set the owner/permissions
      unarchive:
        src: /usr/src/security/devops.zip
        dest: /opt/security/
        owner: "{{ ansible_user }}"
        group: "{{ ansible_user }}"
        mode: "0777" 

# run
sudo ansible-playbook -i inventory playbook.yml

# check that file exists on all 3 servers
ansible -m command -a "ls /opt/security/" -i inventory all -b
# or manually log into each server and check to see that files were copied

cd /opt/security/
cat /opt/security/unarchive/web.txt

Let me know if this helps:-)

Hi @juliettet This helped me.
But can you please let me know why this was not working before.
I agree that the approach was long and I was not using the variables.

  • hosts: stapp01
    tasks:
    • name: Unzipping the file
      ansible.builtin.unarchive:
      src: /usr/src/sysops/nautilus.zip
      dest: /opt/sysops/
      user: tony
      group: tony
      mode: 0644
  • hosts: stapp02
    tasks:
    • name: Unzipping the file
      ansible.builtin.unarchive:
      src: /usr/src/sysops/nautilus.zip
      dest: /opt/sysops/
      user: steve
      group: steve
      mode: 0644
  • hosts: stapp03
    tasks:
    • name: Unzipping the file
      ansible.builtin.unarchive:
      src: /usr/src/sysops/nautilus.zip
      dest: /opt/sysops/
      user: banner
      group: banner
      mode: 0644

P.S: I HAVE ALSO TRIED ansible.builtin.unarchive module.

thanks @juliettet it worked

1 Like

I’m not sure. Did you remember to set your inventory file and remote user in your ansible.cfg file?

You’re welcome @markt . I’m glad that it helped:-)

@Ashu27 , I think while using the community module ansible.builtin.unarchive the parameter user is not supported. You need to try owner instead.