You should specify the environment vars that you need (such as
HTTP_PROXY) in your playbook.
Take a look at this: http://docs.ansible.com/ansible/playbooks_environment.html

Also, the pip module has various virtualenv options - no need to do
this with brittle shell commands.
Same for mkdir and chown - this should be done using the file module.

http://docs.ansible.com/ansible/file_module.html
http://docs.ansible.com/ansible/pip_module.html


Dick

On 14 March 2017 at 11:36, Pedro Ferro <[email protected]> wrote:
> Hi,
>
>
>
> I’m working in a VM, with Ubuntu 14.04, beyond a proxy.
>
>
>
> If I do this in the terminal I’ve success:
>
> sudo mkdir -p /usr/lib/ckan/default
>
>
> sudo chown `whoami` /usr/lib/ckan/default
>
>
> virtualenv --no-site-packages /usr/lib/ckan/default
>
>
> . /usr/lib/ckan/default/bin/activate
>
>
> pip install -e 'git+https://github.com/ckan/[email protected]#egg=ckan'
>
>
>
> If I  do the “same” trough an Ansible playbook
>
>
> ...
> '#create vitualenv and activate it
>     - name: mkdir  /usr/lib/ckan/default
>       shell: mkdir -p /usr/lib/ckan/default
>
>     - name: whoami` /usr/lib/ckan/default
>       shell: chown `whoami` /usr/lib/ckan/default
>
>     - name: virtualenv
>       shell: virtualenv --no-site-packages /usr/lib/ckan/default
>
>     - name: activate virtualenv
>       shell: . /usr/lib/ckan/default/bin/activate
>
> #install ckan 2.5.3 from github
>     - name: install ckan 2.5.3
>       pip:
>         name: 'git+https://github.com/ckan/[email protected]#egg=ckan'
>
> I always get this error:
>
>
> PLAY [localhost]
> ***************************************************************
>
> TASK [setup]
> *******************************************************************
> ok: [localhost]
>
> TASK [Stop service apache2]
> ****************************************************
> changed: [localhost]
>
> TASK [Stop service nginx]
> ******************************************************
> ok: [localhost]
>
> TASK [mkdir  ~/ckan/lib]
> *******************************************************
> changed: [localhost]
>  [WARNING]: Consider using file module with state=directory rather than
> running
> mkdir
>
>
> TASK [create symlinks]
> *********************************************************
> changed: [localhost]
>  [WARNING]: Consider using file module with state=link rather than running
> ln
>
>
> TASK [mkdir  ~/ckan/etc]
> *******************************************************
> changed: [localhost]
>
> TASK [create symlinks]
> *********************************************************
> changed: [localhost]
>
> TASK [mkdir  /usr/lib/ckan/default]
> ********************************************
> changed: [localhost]
>
> TASK [whoami` /usr/lib/ckan/default]
> *******************************************
> changed: [localhost]
>  [WARNING]: Consider using file module with owner rather than running chown
>
>
> TASK [virtualenv]
> **************************************************************
> changed: [localhost]
>
> TASK [activate virtualenv]
> *****************************************************
> changed: [localhost]
>
>
> TASK [install ckan 2.5.3]
> ******************************************************
> fatal: [localhost]: FAILED! => {"changed": false, "cmd": "/usr/bin/pip2
> install -e git+https://github.com/ckan/[email protected]#egg=ckan";,
> "failed": true, "msg": "stdout: Obtaining ckan from
> git+https://github.com/ckan/[email protected]#egg=ckan\n  Cloning
> https://github.com/ckan/ckan.git (to ckan-2.5.3) to ./src/ckan\n  Complete
> output from command /usr/bin/git clone -q https://github.com/ckan/ckan.git
> /tmp/src/ckan:\n  \n----------------------------------------\nCleaning
> up...\nCommand /usr/bin/git clone -q https://github.com/ckan/ckan.git
> /tmp/src/ckan failed with error code 128 in None\nStoring debug log for
> failure in /home/pf/.pip/pip.log\n\n:stderr: fatal: unable to access
> 'https://github.com/ckan/ckan.git/': Failed to connect to github.com port
> 443: No route to host\n"}
>
>
> I've tried doing the pip instruction through shell but the result is the
> same
> #install ckan 2.5.3 from github
>     # - name: install ckan-2.5.3
>       # shell: pip install -e
> 'git+https://github.com/ckan/[email protected]#egg=ckan'
>
> I’m running the .yml file and the terminal commands from the same place in
> the shell, in my case
>
> pf@pf-VirtualBox:~$
>
>
>
>
>
> It’s probably something quiet basic but I stuck with this for so long that I
> don’t know what should I do.
>
>
>
> Any help would be appreciate.
>
>
>
>
> Pedro
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/53e2b4b9-a052-42f3-9fa1-963a7b027d4a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Dick Visser
Sr. System & Network Engineer
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOrOJo%2Bz-%2B3Y7a45gD%2BG%3D_Vo6QGinWiiJTgeqV-8zQSZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to