Last active
July 19, 2018 21:21
-
-
Save Aethylred/4e9d4dca6ed44b477c9e4157afb113cc to your computer and use it in GitHub Desktop.
Iterate over a pip requirements.txt file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Debug pip with large requirements file | |
hosts: 127.0.0.1 | |
connection: local | |
become: yes | |
tasks: | |
- name: Get the requirements file | |
slurp: | |
src: /opt/awx/requirements/requirements.txt | |
register: reqfile | |
- name: Install Python module requirements | |
pip: | |
name: "{{ item | regex_search('^(?P<mod>\\S*)==(?P<ver>\\S*)','\\g<mod>') | first }}" | |
version: "{{ item | regex_search('^(?P<mod>\\S*)==(?P<ver>\\S*)','\\g<ver>') | first }}" | |
with_items: "{{ (reqfile.content|b64decode).splitlines()|map('regex_replace', '\\s*#.*$', '')|list }}" | |
when: | |
- item is defined | |
- item != '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Will be fixed after pip 10.0.2 pypa/pip#5366 (comment)