Vineet Naik
2015-07-10 05:46:20 UTC
Hi,
I am using the pip module to install python dependencies. What I am trying
to achieve is -
To be able to define the dependencies in one of the vars_files as follows
```
pydeps:
- name: requests
virtualenv: /tmp/testvenv
- name: boto
editable: yes
- requirements: /tmp/requirements.txt
virtualenv: /tmp/anothertestenv
```
Basically, the fields in the above list of dicts can be any valid options
accepted by the pip module - http://docs.ansible.com/pip_module.html.
Those options that are not required can be omitted just like they can be
omitted when specifying the args to the module.
And then in tasks,
```
- name: Install using pip
pip: "{% for k, v in item.items() %}{{ k }}={{ v }} {% endfor %}"
with_items: pydeps
```
However, this fails with the following error:
```
TASK: [Install using pip]
*****************************************************
fatal: [localhost] => A variable inserted a new parameter into the module
args. Be sure to quote variables if they contain equal signs (for example:
"{{var}}").
FATAL: all hosts have already failed -- aborting
```
None of the fields contain an equal sign.
I have also tried the following:
```
- name: Install using pip
pip: >
name={{ item.name }}
{{ 'chdir='~item.chdir if item.get('chdir') else '' }}
{{ 'virtualenv='~item.virtualenv if item.get('virtualenv') else ''
}}
# ... and so on
with_items: pydeps
```
But it also fails with the same error if any of the key is missing for an
item.
What's the correct way to do this?
Thanks
I am using the pip module to install python dependencies. What I am trying
to achieve is -
To be able to define the dependencies in one of the vars_files as follows
```
pydeps:
- name: requests
virtualenv: /tmp/testvenv
- name: boto
editable: yes
- requirements: /tmp/requirements.txt
virtualenv: /tmp/anothertestenv
```
Basically, the fields in the above list of dicts can be any valid options
accepted by the pip module - http://docs.ansible.com/pip_module.html.
Those options that are not required can be omitted just like they can be
omitted when specifying the args to the module.
And then in tasks,
```
- name: Install using pip
pip: "{% for k, v in item.items() %}{{ k }}={{ v }} {% endfor %}"
with_items: pydeps
```
However, this fails with the following error:
```
TASK: [Install using pip]
*****************************************************
fatal: [localhost] => A variable inserted a new parameter into the module
args. Be sure to quote variables if they contain equal signs (for example:
"{{var}}").
FATAL: all hosts have already failed -- aborting
```
None of the fields contain an equal sign.
I have also tried the following:
```
- name: Install using pip
pip: >
name={{ item.name }}
{{ 'chdir='~item.chdir if item.get('chdir') else '' }}
{{ 'virtualenv='~item.virtualenv if item.get('virtualenv') else ''
}}
# ... and so on
with_items: pydeps
```
But it also fails with the same error if any of the key is missing for an
item.
What's the correct way to do this?
Thanks
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/be3a5ed3-cdc9-493b-90ae-5d0916b8a505%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/be3a5ed3-cdc9-493b-90ae-5d0916b8a505%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.