• Status: Solved
  • Priority: High
  • Security: Private
  • Views: 79
  • Last Modified:

help me understand the shell script

help me to understand the below lines in below shell script..

Why we need to use virtualenv "$ANSIBLE_ROOT" .... and what is the use of virtualenv here ....

and how activate and deactivate worked ...i am bit confused how activate and deactivate keywords worked here..
. "$ANSIBLE_ROOT/bin/activate"

and also how pip works with -i option...i.e. below

pip install docker-compose==1.15.0 -i https://artifactory.global.raju.com/artifactory/api/pypi/pypi-release/simple

#!/usr/bin/env sh

scl enable python27 bash <<!
set -e
export https_proxy=
if [ ! -d "$ANSIBLE_ROOT/bin" ]
    virtualenv "$ANSIBLE_ROOT"
    . "$ANSIBLE_ROOT/bin/activate"
    echo "Installing latest version of ansible"
    pip install ansible -i https://artifactory.global.raju.com/artif4actory/api/pypi/pypi-release/simple
    pip install docker-py -i https://artifactory.global.raju.com/artifactory/api/pypi/pypi-release/simple
    pip install docker-compose==1.15.0 -i https://artifactory.global.raju.com/artifactory/api/pypi/pypi-release/simple

Open in new window

BharathKumarRaju DasaraRaju
BharathKumarRaju DasaraRaju
1 Solution
Swadhin RaySenior Technical Engineer Commented:
Never used this but " virtualenv " command is usually used to create an isolated virtual environment on any instance.
Hope this below link will help you to understand more.
Let other experts also comment on this :


Open in new window

And "i" stands for ignore the installed packages (reinstalling instead).

here is the link for getting all PIP related details:


Open in new window

BharathKumarRaju DasaraRajuDevops EngineerAuthor Commented:
Thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now