patternMinor
ansible task -easy_install with requirements.txt file
Viewed 0 times
filewithrequirementseasy_installtxtansibletask
Problem
I want to run easy_install task in order to install many modules in virtual environment.
Is there an option to install all modules in requirements.txt file? as I understand it accept only one module at a time.
Another option is to do it with
iterate over both the name and the version of each module
I want certain versions obviously...
I can not work with Pip task, only easy_install.
Thanks
Is there an option to install all modules in requirements.txt file? as I understand it accept only one module at a time.
Another option is to do it with
with_items but how can I make Ansible iterate over both the name and the version of each module
- name: Install things
easy_install:
name: pip
state: latestI want certain versions obviously...
I can not work with Pip task, only easy_install.
Thanks
Solution
You can loop with dictionaries using
loop. It doesn't look like the easy_install module handles versions with a module attribute, so you might have t pass the version on the name attribute.- name: install things with easy_install
easy_install:
name: "{{ item.name }}=={{item.version}}"
state: present
loop:
- { name: 'pip', version: '18.1' }Code Snippets
- name: install things with easy_install
easy_install:
name: "{{ item.name }}=={{item.version}}"
state: present
loop:
- { name: 'pip', version: '18.1' }Context
StackExchange DevOps Q#5561, answer score: 1
Revisions (0)
No revisions yet.