# An ansible role to configure python3.6 on a Raspberry Pi. # to get started, ensure you have ansible installed: # $ sudo apt install ansible # Then run this playbook: # $ ansible-playbook -i localhost, python3.6.yml # Then you can get started: # $ python3.6 # --- - hosts: all vars: version: 3.6.4 threads: 4 tasks: - name: "python{{version}} runtime&build dependencies" become: yes apt: name={{item}} with_items: - build-essential - tk-dev - libncurses5-dev - libncursesw5-dev - libreadline6-dev - libdb5.3-dev - libgdbm-dev - libsqlite3-dev - libssl-dev - libbz2-dev - libexpat1-dev - liblzma-dev - zlib1g-dev - name: "Download python{{version}}" get_url: url="https://www.python.org/ftp/python/{{version}}/Python-{{version}}.tar.xz" dest="/tmp/Python-{{version}}.tar.xz" - name: "Unarchive python{{version}}" unarchive: src="/tmp/Python-{{version}}.tar.xz" dest="/tmp/" copy=no creates="/tmp/Python-{{version}}" - name: "configure python{{version}} build" command: ./configure args: chdir: "/tmp/Python-{{version}}" creates: "/tmp/Python-{{version}}/Makefile" - name: "build python{{version}}" # not using make module to be able to use -j and creates option to fully skip step command: make -j{{threads}} args: chdir: "/tmp/Python-{{version}}" creates: "/tmp/Python-{{version}}/python" - name: "install python{{version}}" become: yes make: chdir: "/tmp/Python-{{version}}" target: altinstall