
- name: Display setup message
  ansible.builtin.debug:
    msg: |
      ****
      * Setting up WordPress files in {{ wordpress_dir }}/
      * (owned and set to be read/writable by 'www-data')
      ****

- name: Extract WordPress tar-archive
  ansible.builtin.unarchive:
    src: ./downloads/wordpress-{{ wordpress_version }}.tar.gz
    dest: "{{ gsdl3_web_dir }}"
    creates: "{{ wordpress_dir }}/wp-settings.php"
    
- name: Recursively change ownership (www-data:www-data)
  become: true
  ansible.builtin.file:
    path: "{{ wordpress_dir }}"
    owner: www-data
    group: www-data
    recurse: true
    state: directory

- name: Set permissions for directories (775) and files (664)
  become: true
  ansible.builtin.file:
    path: "{{ wordpress_dir }}"
    mode: u=rwX,g=rwX,o=rX 
    recurse: true
  notify: Restart Apache2    