Hello!

I would like to exclude a folder from being archived into a tar.gz file. 
However, I've tried multiple options but I haven't had any luck. Any time I 
run the archive module, the images directory keeps on getting backed up 
even though it should be excluded.

- name: Archiving the Contents of all the websites
  archive:
    path: '{{ item.path }}'
    dest: '{{ item.dest }}'
    owner: centos
    group: centos
    mode: 0740
    format: gz
  with_items:
  - { path: '{{ websites_path }}/{{ site01 }}', dest: '{{ 
remote_backup_path }}/{{ date_time }}/{{ site01 }}/{{ site01 }}.tar.gz', 
exclude_path:'/var/www/html/abcd.com/test/images' }
  - { path: '{{ websites_path }}/{{ site02 }}', dest: '{{ 
remote_backup_path }}/{{ date_time }}/{{ site02 }}/{{ site02 }}.tar.gz' }



I've tried this as well:

- name: Archiving the Contents of all the websites
  archive:
    path: '{{ item.path }}'
    dest: '{{ item.dest }}'
    exclude_path:
    - /var/www/html/abcd.com/test/images 
    owner: centos
    group: centos
    mode: 0740
    format: gz
  with_items:
  - { path: '{{ websites_path }}/{{ site01 }}', dest: '{{ 
remote_backup_path }}/{{ date_time }}/{{ site01 }}/{{ site01 }}.tar.gz', }
  - { path: '{{ websites_path }}/{{ site02 }}', dest: '{{ 
remote_backup_path }}/{{ date_time }}/{{ site02 }}/{{ site02 }}.tar.gz' }



Would someone be able to advise me on how I can exclude a particular 
directory from being archived?

Regards
JS

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6e61fdb4-460f-4507-b339-dc84e4efa6fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to