- name: "install python3 & python3-pip"
  apt:
    name="{{ item }}"
    state="present"
    update_cache="yes"
    cache_valid_time="7200"
    state=latest
  with_items:
    - python3
    - python3-pip

- name: "install pyenv & friends"
  become: false
  shell: |
    curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
  args:
    creates: "{{ pyenv_home }}"

- name: "install python {{ python_version }}"
  become: false
  shell: |
    {{pyenv_home}}/bin/pyenv install {{ python_version }}
    {{pyenv_home}}/bin/pyenv global  {{ python_version }}
  args:
    creates: "{{ pyenv_home }}/versions/{{ python_version }}/bin/python"

- name: "install python3 & python3-pip"
  apt:
    name="{{ item }}"
    state="present"
    update_cache="yes"
    cache_valid_time="7200"
    state=latest
  with_items:
    - python3
    - python3-pip

- name: "install required packages"
  apt:
    name="{{ item }}"
    state="present"
    update_cache="yes"
    cache_valid_time="7200"
    state=latest
  with_items:
    - make
    - build-essential
    - libssl-dev
    - zlib1g-dev
    - libbz2-dev
    - libreadline-dev
    - libsqlite3-dev
    - wget
    - curl
    - llvm
    - libncurses5-dev
    - libncursesw5-dev
    - xz-utils
    - tk-dev

- name: "install pyenv & friends"
  become: false
  shell: |
    curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
  args:
    creates: "{{ pyenv_home }}"

- name: "install python {{ python_version }}"
  become: false
  shell: |
    {{pyenv_home}}/bin/pyenv install {{ python_version }}
    {{pyenv_home}}/bin/pyenv global  {{ python_version }}
  args:
    creates: "{{ pyenv_home }}/versions/{{ python_version }}/bin/python"

Add packages required by python-build
Add packages required by python-build

Signed-off-by: Milhouse <d4d5da4143815a8d9a95e01de54d9fa4b1015f55@gmail.com>
