Created
October 14, 2013 16:17
-
-
Save darkone23/6978183 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # SETUP VARS: | |
| # this assumes this script is in $ANSIBLE_ROOT/scripts/setup-ansible.sh and roles are in $ANSIBLE_ROOT/roles | |
| ANSIBLE_ROOT=$(dirname $(dirname $(readlink -e $0))) | |
| # ANSIBLE_PACKAGE_NAME="ansible" # latest official release | |
| ANSIBLE_PACKAGE_NAME="git+https://github.com/ansible/ansible@devel" # mainline dev branch | |
| function install_ansible() { | |
| echo "Beginning ansible installation.." | |
| sudo su -c "apt-get remove ansible -y; apt-get install python-pip python-virtualenv -y && pip uninstall ansible -y; pip install ${ANSIBLE_PACKAGE_NAME}" | |
| echo "Finished installing.." | |
| } | |
| function configure_ansible() { | |
| echo "Beginning ansible configuration.." | |
| if [ -f ~/.ansible.cfg ]; then | |
| mv ~/.ansible.cfg ~/.ansible.cfg.bak | |
| fi | |
| cat << EOF > ~/.ansible.cfg | |
| [defaults] | |
| hostfile = ${ANSIBLE_ROOT}/scripts/hosts | |
| roles_path = ${ANSIBLE_ROOT}/roles | |
| library = ${ANSIBLE_ROOT}/library:/usr/share/ansible | |
| error_on_undefined_vars = True | |
| host_key_checking = False | |
| EOF | |
| echo "Finished configuration.." | |
| } | |
| echo "This script will install ansible as well as custom ansible configuration" | |
| echo "Installation assumes apt-get & bash" | |
| echo "Any prior installation will be destroyed" | |
| read -p "Are you sure? " -n 1 -r | |
| echo | |
| if [[ $REPLY =~ ^[Yy]$ ]]; then | |
| install_ansible | |
| configure_ansible | |
| else | |
| exit 1 | |
| fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment