- name: Validate python_version value assert: that: - (python_version|string).split(".") | length == 2 - (python_version|string).split(".")[0] - (python_version|string).split(".")[1] when: python_version is defined - name: Install specified version of python interpreter and development files when: - python_version is defined - ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - not python_use_pyenv package: name: python{{ python_version }}-dev state: present become: yes - name: Install python using pyenv when: - python_version is defined - python_use_pyenv include_tasks: pyenv.yaml