- name: Install {{appname}}
  include_tasks: tasks/install.yml
  vars: 
     app: "wordpress"

- block:
  - name: Create backup directory
    shell: |
       mkdir -p /data/apps/wordpress/data/backup/plugins
       mkdir -p /data/apps/wordpress/data/backup/themes
  - name: Download wp-cli
    shell: |
      cd /data/apps/wordpress/data/backup
      curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
      chmod +x wp-cli.phar
      mv wp-cli.phar wp

- block:
  - name: Delete  all config
    shell: |
       cd /data/apps/minio && docker compose down -v
       cd /data/apps/matomo && docker compose down -v
       rm -rf /data/apps/minio /data/apps/matomo
  when: wordpress_solution == ""

- block:
  - name: Delete minio  config
    shell: |
       cd /data/apps/minio && docker compose down -v
       rm -rf /data/apps/minio
  when: wordpress_solution == "matomo"

- block:
  - name: Delete matomo config
    shell: |
       cd /data/apps/matomo && docker compose down -v
       rm -rf /data/apps/matomo
  when: wordpress_solution == "minio"
