- pause:
    prompt: |
      Choice Redis version: 
      0: Redis7.0
      1: Redis6.2
      2: Redis6.0
      3: Redis5.0
      4: Redis4.0
      5: Redis3.2
      6: Redis3.0
      7: Redis2.8
      private: no
      Default:0
  register: redis_version_options

- set_fact:
    redis_version_meta:
      "0": "7.0"
      "1": "6.2"
      "2": "6.0"
      "3": "5.0"
      "4": "4.0"
      "5": "3.2"
      "6": "3.0"
      "7": "2.8"
      
- set_fact:
    redis_version: "{{redis_version_meta[redis_version_options.user_input]}}"

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

- name: Config .env for start containers
  shell: |
    sed -i 's/APP_VERSION=.*/APP_VERSION={{redis_version}}/g' {{installpath}}/{{appname}}/.env
