- pause:
    prompt: |
      Choice Seafile version: 
      0: Seafile Community
      1: Seafile Enterprise
      private: no
      Default:0
  register: seafile_version_options

- set_fact:
    seafile_version_meta:
      "0": "ce"
      "1": "pro"

- set_fact:
    seafile_version: "{{seafile_version_meta[seafile_version_options.user_input]}}"

- debug:
    msg: "seafile_version is {{seafile_version}}"

- name: Config .env and docker-compose for start containers
  shell: |
    cat {{installpath}}/{{appname}}/docker-compose.yml |yq eval 'del(.services.seafile-ce.profiles)' > /tmp/tmp.yml
    cat /tmp/tmp.yml > {{installpath}}/{{appname}}/docker-compose.yml
    rm -f /tmp/tmp.yml
  when: seafile_version == "ce"
  
- name: Config .env and docker-compose for start containers
  shell: |
    cat {{installpath}}/{{appname}}/docker-compose.yml |yq eval 'del(.services.seafile-pro.profiles)' |yq eval 'del(.services.elasticsearch.profiles)' > /tmp/tmp.yml
    cat /tmp/tmp.yml > {{installpath}}/{{appname}}/docker-compose.yml
    rm -f /tmp/tmp.yml
  when: seafile_version == "pro"
