--- - name: Create local .pip directory file: path: "~{{ item }}/.pip" state: directory become: True become_user: "{{ item }}" loop: "{{ pip_applicable_users }}" - name: Create pip.conf copy: content: | [global] {% if pip_index_url | length > 0 -%} index-url = {{ pip_index_url }} {% endif -%} {% if pip_trusted_hosts | length > 0 -%} trusted-host = {% for host in pip_trusted_hosts | unique -%} {{ host }} {% endfor -%} {% endif -%} {% if pip_proxy | length > 0 -%} proxy = {{ pip_proxy }} {% endif -%} dest: "~{{ item }}/.pip/pip.conf" become: True become_user: "{{ item }}" loop: "{{ pip_applicable_users }}" - name: Create .pydistutils.cfg copy: content: | [easy_install] index-url = {{ pip_index_url }} dest: "~{{ item }}/.pydistutils.cfg" when: pip_index_url | length > 0 become: True become_user: "{{ item }}" loop: "{{ pip_applicable_users }}"