Skip to content

Instantly share code, notes, and snippets.

@jcheetwood
Created June 14, 2016 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcheetwood/9905a7cf28bb145a28766cb729da47a4 to your computer and use it in GitHub Desktop.
Save jcheetwood/9905a7cf28bb145a28766cb729da47a4 to your computer and use it in GitHub Desktop.
SaltStack Virtualenv SLS Example
virtualenv_create:
virtualenv.managed:
- name: /home/ec2-user/{application_dir}/.virtualenv
- python: /usr/bin/python3
- requirements: requirements.txt
- cwd: /home/ec2-user/{application_dir}
- user: root
@jcheetwood
Copy link
Author

 Comment: An exception occurred in this state: Traceback (most recent call last):
            File "/usr/lib/python2.6/site-packages/salt/state.py", line 1703, in call
              **cdata['kwargs'])
            File "/usr/lib/python2.6/site-packages/salt/loader.py", line 1649, in wrapper
              return f(*args, **kwargs)
            File "/usr/lib/python2.6/site-packages/salt/states/virtualenv_mod.py", line 188, in managed
              use_vt=use_vt,
            File "/usr/lib/python2.6/site-packages/salt/modules/virtualenv_mod.py", line 191, in create
              'Cannot find requested python ({0}).'.format(python)
          CommandExecutionError: Cannot find requested python (python3.4).
 Started: 22:05:19.685144
Duration: 580.454 ms

@iggy
Copy link

iggy commented Jun 15, 2016

  virtualenv.managed:
    - name: /srv/sopel/.virtualenvs/sopel
    # - requirements: salt://sopel/files/requirements.txt
    - requirements: /srv/sopel/requirements.txt
    - cwd: /srv/sopel
    - user: sopel
    # - venv_bin: /usr/bin/pyvenv-3.4
    - python: python3.4
    - pip_upgrade: True

This works for me (say hello to saltstackbot).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment