---
- name: apply nextcloud role
  collections:
    - community.general
    - ansible.posix
  hosts: web_servers
  vars:
    ansible_python_interpreter: /usr/bin/python3
    redis_daemon: "redis"
    redis_port: "6379"
  pre_tasks:
    - name: define ansible_python_interpreter group // linux distribution
      set_fact:
        ansible_python_interpreter: /usr/bin/python2
      when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7'
  roles:
    - role: redis
      when: redis_daemon == "redis" or redis_daemon == "keydb"
    - role: keepalived
      when: (groups['web_servers'] | length) > 1
        #- role: haproxy
        #  vars:
        #    #hatarget: "keydb"
        #    hatarget: "{{ redis_daemon }}"
        #    vip_port: "6380"
        #    ssl_self: false
        #  when: (groups['web_servers'] | length) > 1
    - role: web_php
    #  vars:
    #    enable_php_fpm: false
    - role: nextcloud
      vars:
        ansible_become_pass: ""
        NEXTCLOUD_VERSION: "25.0.6"
        nc_data_dir: /storage/nextcloud/data
        objectstore_s3_install: false
        #objectstore_s3_key: "229ZJOPCR6JHHU4HIP69"
        #objectstore_s3_secret: "xCnx98XN39fDKh3ACGQ9XuDJEOw7PRBxyFW4KjRs"
        #objectstore_s3_hostname: "192.168.56.71"
