- pause:
    prompt: |
      Choice Kafka version: 
      0: Kafka3.2
      1: Kafka3.1
      2: Kafka3.0
      3: Kafka2.8
      4: Kafka2.7
      5: Kafka2.6
      6: Kafka2.5
      7: Kafka2.4
      8: Kafka2.3
      9: Kafka2.2
      10: Kafka2.1
      11: Kafka2.0
      12: Kafka1.1
      13: Kafka1.0
      private: no
      Default:0
  register: kafka_version_options

- set_fact:
    kafka_version_meta:
      "0": "3.2"
      "1": "3.1"
      "2": "3.0"
      "3": "2.8"
      "4": "2.7.0"
      "5": "2.6.0"
      "6": "2.5.0"
      "7": "2.4.0"
      "8": "2.3.0"
      "9": "2.2.0"
      "10": "2.1.0"
      "11": "2.0.0"
      "12": "1.1.0"
      "13": "1.0.0-r5"
- set_fact:
    kafka_version: "{{kafka_version_meta[kafka_version_options.user_input]}}"

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

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