diff --git a/ansible.yml b/ansible.yml index 3913d1b..151a971 100644 --- a/ansible.yml +++ b/ansible.yml @@ -3,7 +3,7 @@ roles: - ansible-compile-python vars: - - python_24: true - - python_26: true - - pillow: true - - lxml: true + python_24: true + python_26: true + pillow: true + lxml: true diff --git a/defaults/main.yml b/defaults/main.yml index 4560480..a01f051 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -18,6 +18,7 @@ python_39: false python_310: false python_311: false python_312: true +python_313: false pillow: false lxml: false @@ -38,6 +39,7 @@ versions: py310: "3.10.14" py311: "3.11.9" py312: "3.12.3" + py313: "3.13.0b1" # on a final release, the url path needs to be adjusted hashes: py24: "76083277f6c7e4d78992f36d7ad9018d" @@ -55,6 +57,7 @@ hashes: py310: "05148354ce821ba7369e5b7958435400" py311: "22ea467e7d915477152e99d5da856ddc" py312: "8defb33f0c37aa4bdd3a38ba52abde4e" + py313: "e1208b22c67c77de72a5e20025b2fb53" venv_versions: py24: "1.7.2" @@ -68,6 +71,30 @@ base_install_folder: "/srv" ftp_url: "https://www.python.org/ftp/python" pkg_url: "https://files.pythonhosted.org/packages" +venv24: + version: "{{ venv_versions.py24 }}" + file_hash: "7b88d35d0a353ec70e42aa37fd8b0bd1c643419c80f022ffaafa4d6449f0" + url: "{{ pkg_url }}/16/86/{{ file_hash }}/virtualenv-1.7.2.tar.gz" + md5: "b5d63b05373a4344ae099a68875aae78" + tar_file: "/tmp/virtualenv-{{ venv_versions.py24 }}.tar.gz" + sources: "/tmp/virtualenv-{{ venv_versions.py24 }}" + +venv26: + version: "{{ venv_versions.py26 }}" + file_hash: "f425e456e017af4801bb08920e30c149a44ac0c194f2225bdb712e77701c" + url: "{{ pkg_url }}/d5/5b/{{ file_hash }}/virtualenv-1.10.tar.gz" + md5: "9745c28256c70c76d36adb3767a00212" + tar_file: "/tmp/virtualenv-{{ venv_versions.py26 }}.tar.gz" + sources: "/tmp/virtualenv-{{ venv_versions.py26 }}" + +venv27: + version: "{{ venv_versions.py27 }}" + file_hash: "706af3ee62032933a3217454609c50a5325a6bd9c2c2f495b58c456ba286" + url: "{{ pkg_url }}/37/27/{{ file_hash }}/virtualenv-16.6.1.tar.gz" + md5: "b05b03dc6ecb3caaa3d58bfcccf4e786" + tar_file: "/tmp/virtualenv-{{ venv_versions.py27 }}.tar.gz" + sources: "/tmp/virtualenv-{{ venv_versions.py27 }}" + py24: version: "{{ versions.py24 }}" major_version: "2.4" @@ -218,26 +245,12 @@ py312: install: "{{ base_install_folder }}/python{{ versions.py312 }}" bin: "{{ base_install_folder }}/python{{ versions.py312 }}/bin/python3.12" -venv24: - version: "{{ venv_versions.py24 }}" - file_hash: "7b88d35d0a353ec70e42aa37fd8b0bd1c643419c80f022ffaafa4d6449f0" - url: "{{ pkg_url }}/16/86/{{ file_hash }}/virtualenv-1.7.2.tar.gz" - md5: "b5d63b05373a4344ae099a68875aae78" - tar_file: "/tmp/virtualenv-{{ venv_versions.py24 }}.tar.gz" - sources: "/tmp/virtualenv-{{ venv_versions.py24 }}" - -venv26: - version: "{{ venv_versions.py26 }}" - file_hash: "f425e456e017af4801bb08920e30c149a44ac0c194f2225bdb712e77701c" - url: "{{ pkg_url }}/d5/5b/{{ file_hash }}/virtualenv-1.10.tar.gz" - md5: "9745c28256c70c76d36adb3767a00212" - tar_file: "/tmp/virtualenv-{{ venv_versions.py26 }}.tar.gz" - sources: "/tmp/virtualenv-{{ venv_versions.py26 }}" - -venv27: - version: "{{ venv_versions.py27 }}" - file_hash: "706af3ee62032933a3217454609c50a5325a6bd9c2c2f495b58c456ba286" - url: "{{ pkg_url }}/37/27/{{ file_hash }}/virtualenv-16.6.1.tar.gz" - md5: "b05b03dc6ecb3caaa3d58bfcccf4e786" - tar_file: "/tmp/virtualenv-{{ venv_versions.py27 }}.tar.gz" - sources: "/tmp/virtualenv-{{ venv_versions.py27 }}" +py313: + version: "{{ versions.py313 }}" + major_version: "3.13" + url: "{{ ftp_url }}/3.13.0/Python-{{ versions.py313 }}.tar.xz" + md5: "{{ hashes.py313 }}" + tar_file: "/tmp/py{{ versions.py313 }}.tar.xz" + sources: "/tmp/Python-{{ versions.3.13 }}" + install: "{{ base_install_folder }}/python{{ versions.3.13 }}" + bin: "{{ base_install_folder }}/python{{ versions.3.13 }}/bin/python3.13" diff --git a/tasks/main.yml b/tasks/main.yml index ebe4e35..fbd45af 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,126 +3,14 @@ - name: Install dependencies ansible.builtin.import_tasks: deps.yml -- name: Install Python 2.4 - ansible.builtin.import_tasks: python24.yml +- name: Install Python 2.x + ansible.builtin.import_tasks: python2x.yml -- name: Install Python 2.6 - ansible.builtin.import_tasks: python26.yml +- name: Install Python 3.x + ansible.builtin.import_tasks: python3x.yml -- name: Install Python 2.7 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py27 }}" - when: python_27 - -- name: Install Python 3.1 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py31 }}" - when: python_31 - -- name: Install Python 3.2 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py32 }}" - when: python_32 - -- name: Install Python 3.3 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py33 }}" - when: python_33 - -- name: Install Python 3.4 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py34 }}" - when: python_34 - -- name: Install Python 3.5 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py35 }}" - when: python_35 - -- name: Install Python 3.6 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py36 }}" - when: python_36 - -- name: Install Python 3.7 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py37 }}" - when: python_37 - -- name: Install Python 3.8 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py38 }}" - when: python_38 - -- name: Install Python 3.9 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py39 }}" - when: python_39 - -- name: Install Python 3.10 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py310 }}" - when: python_310 - -- name: Install Python 3.11 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: "{{ py311 }}" - when: python_311 - -- name: Install Python 3.12 - ansible.builtin.include_tasks: - file: python_generic.yml - vars: - py_data: py312 - when: python_312 - -- name: Install Virtualenv for Python 2.4 - ansible.builtin.include_tasks: - file: venv.yml - vars: - py_data: py24 - venv_data: venv24 - when: python_24 - -- name: Install Virtualenv for Python 2.6 - ansible.builtin.include_tasks: - file: venv.yml - vars: - py_data: py26 - venv_data: venv26 - when: python_26 - -- name: Install Virtualenv for Python 2.7 - ansible.builtin.include_tasks: - file: venv.yml - vars: - py_data: py27 - venv_data: venv27 - when: python_27 +- name: Install virtualenvs + ansible.builtin.import_tasks: venvs.yml - name: Miscellaneous ansible.builtin.import_tasks: misc.yml diff --git a/tasks/python2x.yml b/tasks/python2x.yml new file mode 100644 index 0000000..e15a9c1 --- /dev/null +++ b/tasks/python2x.yml @@ -0,0 +1,14 @@ +--- + +- name: Install Python 2.4 + ansible.builtin.import_tasks: python24.yml + +- name: Install Python 2.6 + ansible.builtin.import_tasks: python26.yml + +- name: Install Python 2.7 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py27 }}" + when: python_27 diff --git a/tasks/python3x.yml b/tasks/python3x.yml new file mode 100644 index 0000000..f1ea010 --- /dev/null +++ b/tasks/python3x.yml @@ -0,0 +1,92 @@ +--- + +- name: Install Python 3.1 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py31 }}" + when: python_31 + +- name: Install Python 3.2 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py32 }}" + when: python_32 + +- name: Install Python 3.3 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py33 }}" + when: python_33 + +- name: Install Python 3.4 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py34 }}" + when: python_34 + +- name: Install Python 3.5 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py35 }}" + when: python_35 + +- name: Install Python 3.6 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py36 }}" + when: python_36 + +- name: Install Python 3.7 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py37 }}" + when: python_37 + +- name: Install Python 3.8 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py38 }}" + when: python_38 + +- name: Install Python 3.9 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py39 }}" + when: python_39 + +- name: Install Python 3.10 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py310 }}" + when: python_310 + +- name: Install Python 3.11 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: "{{ py311 }}" + when: python_311 + +- name: Install Python 3.12 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: py312 + when: python_312 + +- name: Install Python 3.13 + ansible.builtin.include_tasks: + file: python_generic.yml + vars: + py_data: py313 + when: python_313 diff --git a/tasks/python_generic.yml b/tasks/python_generic.yml index 962e1ad..9ff806a 100644 --- a/tasks/python_generic.yml +++ b/tasks/python_generic.yml @@ -1,13 +1,13 @@ --- -- name: "{{ py_data.version }} | Check that it is still not installed" +- name: "Python | Check that it is still not installed | {{ py_data.version }}" become: true ansible.builtin.stat: path: "{{ py_data.bin }}" register: already_installed ignore_errors: true -- name: "{{ py_data.version }} | Download" +- name: "Python | Download | {{ py_data.version }}" ansible.builtin.get_url: url: "{{ py_data.url }}" dest: "{{ py_data.tar_file }}" @@ -15,7 +15,7 @@ mode: "0440" when: not already_installed.stat.exists -- name: "{{ py_data.version }} | Uncompress" +- name: "Python | Uncompress | {{ py_data.version }}" ansible.builtin.unarchive: src: "{{ py_data.tar_file }}" dest: /tmp @@ -23,7 +23,7 @@ creates: "{{ py_data.sources }}" when: not already_installed.stat.exists -- name: "{{ py_data.version }} | Compile and install" +- name: "Python | Compile and install | {{ py_data.version }}" become: true ansible.builtin.command: "{{ item }}" args: @@ -36,7 +36,7 @@ register: output changed_when: output.rc != 0 -- name: "{{ py_data.version }} | Create python_major_version symlink" +- name: "Python | Create symlink | {{ py_data.version }}" become: true ansible.builtin.file: src: "{{ py_data.install }}" diff --git a/tasks/venv.yml b/tasks/venv.yml index e0fc0f7..576d3ce 100644 --- a/tasks/venv.yml +++ b/tasks/venv.yml @@ -1,6 +1,6 @@ --- -- name: "Virtualenv {{ py_data.version }} | Check if it is already installed" +- name: "Virtualenv | Check if it is already installed | {{ py_data.version }}" become: true ansible.builtin.stat: path: "{{ py_data.install }}/bin/virtualenv" @@ -8,7 +8,7 @@ ignore_errors: true when: should_install -- name: "Virtualenv for {{ py_data.version }} | Download" +- name: "Virtualenv | Download | {{ py_data.version }}" ansible.builtin.get_url: url: "{{ venv_data.url }}" dest: "{{ venv_data.tar_file }}" @@ -16,14 +16,14 @@ mode: "0440" when: should_install and not already_installed.stat.exists -- name: "Virtualenv for {{ py_data.version }} | Uncompress" +- name: "Virtualenv | Uncompress | {{ py_data.version }}" ansible.builtin.unarchive: src: "{{ venv_data.tar_file }}" dest: /tmp copy: false when: should_install and not already_installed.stat.exists -- name: " {{ py_data.version }} | Install virtualenv" +- name: " Virtualenv | Install | {{ py_data.version }}" become: true ansible.builtin.command: "{{ item }}" args: diff --git a/tasks/venvs.yml b/tasks/venvs.yml new file mode 100644 index 0000000..d3aa9b0 --- /dev/null +++ b/tasks/venvs.yml @@ -0,0 +1,25 @@ +--- + +- name: Install Virtualenv for Python 2.4 + ansible.builtin.include_tasks: + file: venv.yml + vars: + py_data: py24 + venv_data: venv24 + when: python_24 + +- name: Install Virtualenv for Python 2.6 + ansible.builtin.include_tasks: + file: venv.yml + vars: + py_data: py26 + venv_data: venv26 + when: python_26 + +- name: Install Virtualenv for Python 2.7 + ansible.builtin.include_tasks: + file: venv.yml + vars: + py_data: py27 + venv_data: venv27 + when: python_27