---
- hosts: "{{target}}"
  user: root
  become: true
  become_user: apache
  roles:
      - servergrove.symfony2
  vars:
      symfony_project_root: /var/www/vhosts/pavilions.reginamulticulturalcouncil.ca
      symfony_project_name: rmc_pavilions
      symfony_project_composer_path: "{{symfony_project_root}}/shared/composer.phar"
      symfony_project_repo: git@gitlab.com:ns-rmc/pavilions.git
      symfony_project_env: prod
      symfony_project_console_command: bin/console
      symfony_project_config_dir: config
      symfony_project_console_opts: '--no-debug'
      symfony_project_keep_releases: 5

      symfony_project_branch: master
      symfony_project_php_path: /usr/bin/php72
      symfony_project_php_options: ''

      symfony_project_composer_opts: '--optimize-autoloader --no-interaction'
      symfony_project_shared_folders: # folders to be linked from shared directory to release dir
          - {name: log, src: var/log, path: var/log}
          - {name: user_uploads, src: /user_uploads, path: /user_uploads}
          - {name: uploads, src: public/uploads, path: public/uploads}

      symfony_project_managed_folders: # folders to be created/checked in release dir
          - {name: cache, path: var/cache}

      symfony_project_pre_cache_warmup_tasks: "{{inventory_dir}}/hooks/pre_cache_warmup.yml"

  tasks:
      - name: Run database migrations
        command: php72 bin/console doctrine:migrations:migrate --no-interaction --env=prod chdir={{symfony_project_root}}/current
      - name: Reload php-fpm
        service: name=php72-php-fpm state=reloaded
        become: false
