salt.states.virtualenv#
Setup of Python virtualenv sandboxes.
New in version 0.17.0.
Note
This state module is loaded under the virtualenv virtual name. Use
virtualenv.managed (and not virtualenv_mod.managed) in your
state SLS files.
- salt.states.virtualenv_mod.manage(name, venv_bin=None, requirements=None, system_site_packages=False, distribute=False, use_wheel=False, clear=False, python=None, extra_search_dir=None, never_download=None, prompt=None, user=None, cwd=None, index_url=None, extra_index_url=None, pre_releases=False, no_deps=False, pip_download=None, pip_download_cache=None, pip_exists_action=None, pip_ignore_installed=False, proxy=None, use_vt=False, env_vars=None, no_use_wheel=False, pip_upgrade=False, pip_pkgs=None, pip_no_cache_dir=False, pip_cache_dir=None, process_dependency_links=False, no_binary=None, **kwargs)#
This function is an alias of
managed.Create a virtualenv and optionally manage it with pip
- name
Path to the virtualenv.
- venv_bin: virtualenv
The name (and optionally path) of the virtualenv command. This can also be set globally in the minion config file as
virtualenv.venv_bin. The special valuevenvselects the python standard libraryvenvmodule instead of a virtualenv binary; a python interpreter (e.g./usr/bin/python3.11) may also be given, in which case the environment is created with<interpreter> -m venv.Changed in version 3006.28: A python interpreter is now accepted as
venv_bin.- requirements: None
Path to a pip requirements file. If the path begins with
salt://the file will be transferred from the master file server.- use_wheel: False
Prefer wheel archives (requires pip >= 1.4).
- python: None
Python executable used to build the virtualenv. When Salt is installed from a onedir package. You will likely want to specify which python interperter should be used.
Changed in version 3006.28: Also honoured with
venv_bin: venv: the environment is created by running<python> -m venv, so distros whose virtualenv binary is outdated (e.g. EL8) can still build environments for any installed interpreter.- user: None
The user under which to run virtualenv and pip.
- cwd: None
Path to the working directory where pip install is executed.
- no_deps: False
Pass --no-deps to pip install.
- pip_exists_action: None
Default action of pip when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
- proxy: None
Proxy address which is passed to pip install.
- env_vars: None
Set environment variables that some builds will depend on. For example, a Python C-module may have a Makefile that needs INCLUDE_PATH set to pick up a header file while compiling.
- no_use_wheel: False
Force to not use wheel archives (requires pip>=1.4)
- no_binary
Force to not use binary packages (requires pip >= 7.0.0) Accepts either :all: to disable all binary packages, :none: to empty the set, or a list of one or more packages
- pip_upgrade: False
Pass --upgrade to pip install.
- pip_pkgs: None
As an alternative to requirements, pass a list of pip packages that should be installed.
- process_dependency_links: False
Run pip install with the --process_dependency_links flag.
New in version 2017.7.0.
Also accepts any keyword argument accepted by
virtualenv.create-- includingsystem_site_packages,distribute,clear,extra_search_dir,never_download,prompt,index_url,extra_index_url,pre_releases,pip_download,pip_download_cache,pip_ignore_installed,use_vt,pip_no_cache_dirandpip_cache_dir. Refer to that execution module for argument semantics. Some kwargs, such as thepipoption, require- distribute: True./var/www/myvirtualenv.com: virtualenv.managed: - system_site_packages: False - requirements: salt://REQUIREMENTS.txt - env_vars: PATH_VAR: '/usr/local/bin/'
Current versions of Salt use onedir packages and will use onedir python interpreter by default. If you've installed Salt via out package repository. You will likely want to provide the path to the interpreter with which you would like to be used to create the virtual environment. The interpreter can be specified by providing the python option.
- salt.states.virtualenv_mod.managed(name, venv_bin=None, requirements=None, system_site_packages=False, distribute=False, use_wheel=False, clear=False, python=None, extra_search_dir=None, never_download=None, prompt=None, user=None, cwd=None, index_url=None, extra_index_url=None, pre_releases=False, no_deps=False, pip_download=None, pip_download_cache=None, pip_exists_action=None, pip_ignore_installed=False, proxy=None, use_vt=False, env_vars=None, no_use_wheel=False, pip_upgrade=False, pip_pkgs=None, pip_no_cache_dir=False, pip_cache_dir=None, process_dependency_links=False, no_binary=None, **kwargs)#
Create a virtualenv and optionally manage it with pip
- name
Path to the virtualenv.
- venv_bin: virtualenv
The name (and optionally path) of the virtualenv command. This can also be set globally in the minion config file as
virtualenv.venv_bin. The special valuevenvselects the python standard libraryvenvmodule instead of a virtualenv binary; a python interpreter (e.g./usr/bin/python3.11) may also be given, in which case the environment is created with<interpreter> -m venv.Changed in version 3006.28: A python interpreter is now accepted as
venv_bin.- requirements: None
Path to a pip requirements file. If the path begins with
salt://the file will be transferred from the master file server.- use_wheel: False
Prefer wheel archives (requires pip >= 1.4).
- python: None
Python executable used to build the virtualenv. When Salt is installed from a onedir package. You will likely want to specify which python interperter should be used.
Changed in version 3006.28: Also honoured with
venv_bin: venv: the environment is created by running<python> -m venv, so distros whose virtualenv binary is outdated (e.g. EL8) can still build environments for any installed interpreter.- user: None
The user under which to run virtualenv and pip.
- cwd: None
Path to the working directory where pip install is executed.
- no_deps: False
Pass --no-deps to pip install.
- pip_exists_action: None
Default action of pip when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
- proxy: None
Proxy address which is passed to pip install.
- env_vars: None
Set environment variables that some builds will depend on. For example, a Python C-module may have a Makefile that needs INCLUDE_PATH set to pick up a header file while compiling.
- no_use_wheel: False
Force to not use wheel archives (requires pip>=1.4)
- no_binary
Force to not use binary packages (requires pip >= 7.0.0) Accepts either :all: to disable all binary packages, :none: to empty the set, or a list of one or more packages
- pip_upgrade: False
Pass --upgrade to pip install.
- pip_pkgs: None
As an alternative to requirements, pass a list of pip packages that should be installed.
- process_dependency_links: False
Run pip install with the --process_dependency_links flag.
New in version 2017.7.0.
Also accepts any keyword argument accepted by
virtualenv.create-- includingsystem_site_packages,distribute,clear,extra_search_dir,never_download,prompt,index_url,extra_index_url,pre_releases,pip_download,pip_download_cache,pip_ignore_installed,use_vt,pip_no_cache_dirandpip_cache_dir. Refer to that execution module for argument semantics. Some kwargs, such as thepipoption, require- distribute: True./var/www/myvirtualenv.com: virtualenv.managed: - system_site_packages: False - requirements: salt://REQUIREMENTS.txt - env_vars: PATH_VAR: '/usr/local/bin/'
Current versions of Salt use onedir packages and will use onedir python interpreter by default. If you've installed Salt via out package repository. You will likely want to provide the path to the interpreter with which you would like to be used to create the virtual environment. The interpreter can be specified by providing the python option.