- name: Install python3 (Debian) when: ansible_os_family == "Debian" become: yes apt: name={{ item }} state=latest update_cache=yes loop: [python3, python3-pip] - name: Install python3 (macOS) when: ansible_os_family == "Darwin" homebrew: name=python3 state=latest - name: Create the python config and data directories file: path: "{{ item }}" state: directory loop: - ~/.config/python - ~/.local/share/python - name: Deploy python startup file file: src: "{{ role_path }}/files/startup.py" dest: ~/.config/python/startup.py state: link force: yes