Added ANSIBLE=1 flag for pre-installing ansible

This commit is contained in:
Nayeem Syed 2016-04-29 17:18:53 +01:00
parent 31c3d48357
commit 1b6b4d151f
3 changed files with 23 additions and 2 deletions

View File

@ -47,13 +47,14 @@ By default no provisioning tools will be included but you can pick the ones
you want by providing some environmental variables. For example:
```sh
PUPPET=1 CHEF=1 SALT=1 BABUSHKA=1 \
ANSIBLE=1 PUPPET=1 CHEF=1 SALT=1 BABUSHKA=1 \
make precise
```
Will build a Ubuntu Precise x86_64 box with latest Puppet, Chef, Salt and
Will build a Ubuntu Precise x86_64 box with latest Ansible, Puppet, Chef, Salt and
Babushka pre-installed.
When using ANSIBLE=1, an optional ANSIBLE_VERSION parameter may be passed that will specify which version of ansible to install. By default it will install the latest Ansible.
## Pre built base boxes

7
debian/install-ansible.sh vendored Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
ANSIBLE_VERSION=${ANSIBLE_VERSION:-latest}
apt-get install -y build-essential python-setuptools python-jinja2 python-yaml python-paramiko python-httplib2 python-crypto sshpass
wget https://releases.ansible.com/ansible/ansible-$ANSIBLE_VERSION.tar.gz -O /tmp//ansible.tar.gz
tar -zxvf /tmp/ansible.tar.gz -C /tmp/ && rm -r /tmp/ansible.tar.gz
cd /tmp/ansible-* && make && make install

View File

@ -26,6 +26,7 @@ utils.lxc.attach apt-get update
utils.lxc.attach apt-get install ${PACKAGES[*]} -y --force-yes
utils.lxc.attach apt-get upgrade -y --force-yes
ANSIBLE=${ANSIBLE:-0}
CHEF=${CHEF:-0}
PUPPET=${PUPPET:-0}
SALT=${SALT:-0}
@ -37,6 +38,18 @@ if [ $DISTRIBUTION = 'debian' ]; then
-i ${ROOTFS}/etc/bash.bashrc
fi
if [ $ANSIBLE = 1 ]; then
if $(lxc-attach -n ${CONTAINER} -- which ansible &>/dev/null); then
log "Ansible has been installed on container, skipping"
else
info "Installing Ansible"
cp debian/install-ansible.sh ${ROOTFS}/tmp/ && chmod +x ${ROOTFS}/tmp/install-ansible.sh
utils.lxc.attach /tmp/install-ansible.sh &>>${LOG}
fi
else
log "Skipping Ansible installation"
fi
if [ $CHEF = 1 ]; then
if $(lxc-attach -n ${CONTAINER} -- which chef-solo &>/dev/null); then
log "Chef has been installed on container, skipping"