0

I need to install the paramiko module of python on multiple machines using the salt stack.

I looked at the documentation about how to do this, but was not able to understand the syntax.

Can someone please explain me line-by-line what happens in the following snippet:

python-pip:
  pkg.installed

virtualenvwrapper:
  pip.installed:
    - require:
      - pkg: python-pip

Also, can you add an example snippet for a recipe installing multiple python modules via pip using salt?

0

2 Answers 2

2
python-pip: # The name of the package this state installs, this must be unique in your salt states
  pkg.installed # The state (pkg) and action (installed)

virtualenvwrapper: # The name of the package
  pip.installed: # The state (pip) and action (installed)
    - require: # Require means only install this if the following is already installed
      - pkg: python-pip # pkg python-pip which is mentioned earlier

Another way to write the first part:

instaled python pip:
  pkg.installed:
    - name: python-pip

If you wanted to install multiple packages:

installed python pip, paramiko and complete:
  pkg.installed:
    - pkgs: 
      - python-pip
      - python-complete
      - python-paramiko

Alternatively, paramiko is in pip:

 paramiko:
   pip.installed

Also, to install multiple things from pip:

 install lots from pip:
   pip.installed:
     - names:
       - paramiko
       - boto3
       - pycurl

Remember, the docs are your friend, but they are not exhaustive, #salt on freenode irc is also a great place to ask.

1

First first block is installing the package python-pip via your distro's package manager like yum or apt-get

The second block is install virtualenvwrapper via pip like pip install virtualenvwrapper but its also saying in order to run that command you need to have the package python-pip installed

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .