---

- name: "WordPress Import | create wordpress uploads subdirectories"
  file:
    path="{{ www_root }}/{{ item[0] }}/shared/{{ item[1] }}"
    owner="{{ admin_user }}"
    group="{{ admin_user_group }}"
    state="directory"
    recurse="yes"
  with_nested:
    - "wordpress_sites.keys()"
    - ["blogs.dir", "uploads"]

- name: "WordPress Import | download wordpress uploads"
  become_user: "{{ admin_user }}"
  command: aws s3 sync {{ wordpress_uploads_s3_dir }}/uploads {{ www_root }}/{{ item.key }}/shared/uploads --exclude 'group-documents/*' --exclude 'humcore/*' --exclude 'cache/*' --only-show-errors --delete
  with_dict: "wordpress_sites"
  when: "wordpress_uploads_s3_dir is defined"

- include: "scripts.yml"

---

- name: "WordPress Import | create wordpress uploads subdirectories"
  file:
    path="{{ www_root }}/{{ item[0] }}/shared/{{ item[1] }}"
    owner="{{ web_user }}"
    group="{{ web_group }}"
    state="directory"
    recurse="yes"
  with_nested:
    - "wordpress_sites.keys()"
    - ["blogs.dir", "uploads"]

- name: "WordPress Import | download wordpress uploads"
  command: aws s3 sync {{ wordpress_uploads_s3_dir }}/uploads {{ www_root }}/{{ item.key }}/shared/uploads --exclude 'group-documents/*' --exclude 'humcore/*' --exclude 'cache/*' --only-show-errors --delete
  with_dict: "wordpress_sites"
  when: "wordpress_uploads_s3_dir is defined"

- include: "scripts.yml"

Improve idempodence by creating uploads directory owned by web_user.
Improve idempodence by creating uploads directory owned by web_user.
