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
tasks:- name: Compress directory .tgz
archive:
path: /usr/src/devops/
dest: /opt/dba/beta.tar.gz
format: gz
owner: tony
group: tony
- name: Compress directory .tgz