- name: Set istio dir
  set_fact:
    istio_dir: "{{ istio_k8s_dir | dirname | dirname }}"

- name: Add Istio to PATH
  shell: |
    ISTIO_BIN_DIR=$(cd {{ istio_dir }}/bin; pwd)
    echo "########################################################################################"
    echo "Execute this command within your terminal to include the bin direcrtory of the istioctl client !"
    echo  export PATH='$'PATH:$ISTIO_BIN_DIR
    echo "Then, you will be able within your shell to call the istioctl client"
    echo "istioctl [command]"
    echo "########################################################################################"
  register: r

- debug: msg="{{ r.stdout.split('\n') }}"

# PATH=$PATH:$ISTIO_BIN_DIR; export PATH

#    shell: ISTIO_BIN_DIR=$(cd {{ istio_dir }}/bin; pwd) | echo $ISTIO_BIN_DIR
#    register: r

# - debug: var=r
#
# - lineinfile:
#     path: ms
#     regexp: '.istio-{{ istio.istio_version_to_use }}'
#     line: "\n# Istio\nexport PATH=$PATH:{{ r.stdout }}"
