- Notifications
You must be signed in to change notification settings - Fork1
Ansible Version Manager (AVM)
License
ahelal/avm
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Ansible Version Manager (AVM) is a tool to manage multi Ansible installation by creating a python virtual environment for each version.
- Running multiple version of Ansible on the same host.
- Using the development version of ansible for testing and using stable version for production.
- Make your CI run multiple versions for testing i.e. travis, concourse, jenkins, ... or test-kitchen or molecule.
- Create a wrapper script to manage Ansible within your teams and make upgrading roll back easier for many users with different OS and shells.
- If you need add python packages to and make it accessible to Ansible without effecting your global python installation. i.e. boto, dnspython, netaddr or others
- Change in variable names
- Stopped using bash arrays
i.e. ANSIBLE_VERSIONS[0]
to be more Posix and use flat variablesi.e. ANSIBLE_VERSIONS_0
For more info checkSetup variables
You have two options using asetup script orcommand to install
Create a wrapper script this would be useful for CI or if you want your team to have unified installation.
#!/bin/shset -e# What version of AVM setup to useexport AVM_VERSION="v1.0.0"## Install Ansible 1.9.6 using pip and label it 'v1.9'export ANSIBLE_VERSIONS_0="1.9.6"export INSTALL_TYPE_0="pip"export ANSIBLE_LABEL_0="v1.9"## Install Ansible 2.2.3.0 using pip and label it 'v2.2'export ANSIBLE_VERSIONS_1="2.2.3.0"export INSTALL_TYPE_1="pip"export ANSIBLE_LABEL_1="v2.2"## Install Ansible 2.3.1.0 using pip and label it 'v2.3'export ANSIBLE_VERSIONS_2="2.3.1.0"export INSTALL_TYPE_2="pip"export ANSIBLE_LABEL_2="v2.3"## Install Ansible from devel using git and label it 'devel'export ANSIBLE_VERSIONS_2="devel"export INSTALL_TYPE_2="git"export ANSIBLE_LABEL_2="devel"# Whats the default versionexport ANSIBLE_DEFAULT_VERSION="v1.9"## Create a temp dir to download avmavm_dir="$(mktemp -d2> /dev/null|| mktemp -d -t'mytmpdir')"git clone https://github.com/ahelal/avm.git"${avm_dir}"> /dev/null2>&1## Run the setup/bin/sh"${avm_dir}/setup.sh"exit 0
You would need first to install avm
git clone https://github.com/ahelal/avm.gitcd avm./setup.sh
then you can use the avm cli to install
# Install stable release (defaults to pip)avm install --version 2.2.0.0 --label production# Install development releaseavm install --version devel --label dev --type git# if you have some python lib to install in the virtual env you can also add python requirements.txt fileavm install --version 2.0.0.0 --label legacy --requirements /path/to/requirements.txt
Once install you can useavm the cli to switch between version. for more info runavm --help
Usage: avm info avm list avm path <version> avm use <version> avm activate <version> avm install (-v version) [-t type] [-l label] [-r requirements]Options: info Show ansible version in use list List installed versions path <version> Print binary path of specific version use <version> Use a <version> of ansible activate <version> Activate virtualenv for <version>
If you are usingSetup wrapper script you can override any of the following variables in your script.
Name | default | Description |
---|---|---|
AVM_VERSION | master | avm version to install. Supports releases, tags, branches. if set to "local" will usepwd as source of installation. |
AVM_VERBOSE | Setup verbosity could be empty, v, vv or vvv | |
SETUP_USER | $USER | The setup user that will have avm and use avm. |
SETUP_USER_HOME | $USER home dir | The home dir of setup user. |
AVM_IGNORE_SUDO | Simply ignore sudo errors. | |
DEFAULT_INSTALL_TYPE | pip | Default installation type if not defined. |
AVM_UPDATE_VENV | 0 | |
ANSIBLE_BIN_PATH | /usr/local/bin | Path to install the ansible and avm binary. |
ANSIBLE_VERSIONS_X | ||
ANSIBLE_LABEL_X | ||
INSTALL_TYPE_X | ||
UBUNTU_PKGS |
Currently tested under
- OSX
- Ubuntu 14.04, 16.04
- Alpine 3.4 (early support)
- bash
- dash
- zsh
- busybox ash
Experimental support for Alpine in docker
if your installing fornon root user you require
apk add sudoecho"auth sufficient pam_rootok.so"> /etc/pam.d/su
if your creating an image that does not have python or gcc you can do a cleanup at the end
apk del build-dependencies
Setup verbosity could be empty orv,vv orvvv
i.e.AVM_VERBOSE="vv" your_setup.sh
v : Show verbose messages, but mute stdout, stderrvv : Show verbose messages and stdout, stderrvvv : Show verbose messages, stdout, stderr and set -x
By default avm uses theAVM_VERSION to download and checkout that branch. if you want to debug and change the script you can useAVM_VERSION=local to use a local version of avm.
License (MIT)
Your contribution is welcome.
About
Ansible Version Manager (AVM)
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.