---
# tasks file for ndenv
- name: Run specified tasks on current platform
  include: "{{ ansible_os_family }}.yml"
- block:
  - name: Check whether ndenv is installed
    shell: "{{ ndenv_login_shell }} -lc 'ndenv versions'"
    register: result_ndenv_versions
    ignore_errors: yes
    changed_when: no
  - name: Install ndenv
    shell: "{{ ndenv_login_shell }} -lc 'anyenv install ndenv'"
    when: "result_ndenv_versions.rc != 0"
  - name: Install nodejs
    shell: "{{ ndenv_login_shell }} -lc 'ndenv install {{ ndenv_node_version }}'"
    when: "ndenv_node_version is defined and ndenv_node_version not in result_ndenv_versions.stdout"
  - name: Check default version
    shell: "{{ ndenv_login_shell }} -lc 'ndenv global'"
    register: result_ndenv_global
    changed_when: no
    when: "ndenv_node_version is defined and ndenv_set_global"
  - name: Set default version
    shell: "{{ ndenv_login_shell }} -lc 'ndenv global {{ ndenv_node_version }}'"
    when: "ndenv_node_version is defined and ndenv_set_global and ndenv_node_version not in result_ndenv_global.stdout"
  become: yes
  become_user: "{{ anyenv_owner }}"

---
# tasks file for ndenv
- name: Run specified tasks on current platform
  include: "{{ ansible_os_family }}.yml"
- block:
  - name: Check whether ndenv is installed
    shell: "{{ ndenv_login_shell }} -lc 'ndenv versions'"
    register: result_ndenv_versions
    ignore_errors: yes
    changed_when: no
  - name: Install ndenv
    shell: "{{ ndenv_login_shell }} -lc 'anyenv install ndenv'"
    when: "result_ndenv_versions.rc != 0"
  - name: Install nodejs
    shell: "{{ ndenv_login_shell }} -lc 'ndenv install {{ item }}'"
    when: "item not in result_ndenv_versions.stdout"
    with_items: "{{ ndenv_node_versions }}"
  - name: Check default version
    shell: "{{ ndenv_login_shell }} -lc 'ndenv global'"
    register: result_ndenv_global
    changed_when: no
    when: "ndenv_global_version is defined"
  - name: Set default version
    shell: "{{ ndenv_login_shell }} -lc 'ndenv global {{ ndenv_global_version }}'"
    when: "ndenv_global_version is defined and ndenv_global_version not in result_ndenv_global.stdout"
  become: yes
  become_user: "{{ anyenv_owner }}"

Fix tasks to accept new spec of variables.
Fix tasks to accept new spec of variables.
