Created
April 11, 2016 16:03
-
-
Save sgnn7/56679b4246d4637d0fac994480ae6056 to your computer and use it in GitHub Desktop.
Apply custom patches to ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
echo WARNING! This script will add various junk to your | |
echo WARNING! machine so it is best to run it in a VM! | |
echo Fetching latest ansible | |
prerequisites="git \ | |
python \ | |
python-boto \ | |
python-crypto \ | |
python-httplib2 \ | |
python-jinja2 \ | |
python-netaddr \ | |
python-paramiko \ | |
python-pip \ | |
python-selinux \ | |
python-setuptools \ | |
python-yaml" | |
needs_prereqs=0 | |
for prereq in ${prerequisites}; do | |
if ! dpkg-query -l "${prereq}" &>/dev/null; then | |
needs_prereqs=1 | |
break | |
fi | |
done | |
if [ $needs_prereqs -eq 1 ]; then | |
sudo apt-get update | |
sudo apt-get install -y $prerequisites | |
fi | |
current_dir=$(pwd) | |
if [ ! -d ansible ]; then | |
git clone https://github.com/ansible/ansible | |
fi | |
pushd ansible >/dev/null | |
git submodule init | |
git submodule update | |
echo Adding Ansible module fixes | |
pushd lib/ansible/modules/core >/dev/null | |
for patch_file in ${current_dir}/ansible_patches/*; do | |
if [ ! -f "$(basename $patch_file)" ]; then | |
echo "- Applying $(basename $patch_file)..." | |
# Copied so we know if we applied it or not | |
cp "${patch_file}" . | |
git apply "${patch_file}" | |
fi | |
done | |
popd >/dev/null | |
popd >/dev/null | |
echo Done | |
echo Run \"source ./ansible/hacking/env-setup\" to be able to use Ansible |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment