---
- hosts: all
  become: yes
  roles:
    - role: system
    - role: apache
    - role: php
  tasks:
    - name: Copy WordPress application to the server
      ansible.posix.synchronize:
        src: "{{ project_dir }}/"
        dest: "{{ apache_doc_root }}/"
        delete: yes
        archive: yes
        compress: yes

    - name: Deploy WordPress 1.2 wp-config.php
      template:
        src: wp-config.php.j2
        dest: "{{ apache_doc_root }}/blog/wp-config.php"

    - name: Recursively set permissions to 755 for /var/www/html
      ansible.builtin.file:
        path: /var/www/html
        mode: '0755'
        recurse: yes