Accurate Solution for Ansible Archive Module

Hi, I have finished Anisble Archive module question and completed it successfully but I feel my solution is not optimized one, as its tasks are repeated. Can some one suggest correct solution.

Here is my solution. I had to repeat it for every host. I think we can use “hosts: all” and dynamically pass the user names as variables. Can some one suggest optimized solution for this.

  • hosts: stapp01
    become: true
    • name: Compress directory .tgz
      path: /usr/src/devops/
      dest: /opt/dba/beta.tar.gz
      format: gz
      owner: tony
      group: tony

use ansible variables like this:
group: ‘{{ ansible_user }}’
owner: ‘{{ ansible_user }}’

@nashwan Thanks for your solution.