Last active
March 24, 2017 07:18
-
-
Save coolbung/2624e103156f7b790791 to your computer and use it in GitHub Desktop.
Script to install typical tools needed by TTPL Devs
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 | |
read -p "Enter non-admin username (eg: ttpl1) : " non_admin_username | |
php71_name="${non_admin_username}-php71.local" | |
php7_name="${non_admin_username}-php7.local" | |
php5_name="${non_admin_username}-php5.local" | |
non_admin_home_dir="/home/${non_admin_username}" | |
if [ ! -d "$non_admin_home_dir" ]; then | |
echo "Invalid username" | |
exit 1 | |
fi | |
if [[ -r /etc/lsb-release ]]; then | |
. /etc/lsb-release | |
if [[ ( $ID == "ubuntu" ) || ( $DISTRIB_ID == "Ubuntu" ) ]]; then | |
echo "Running Ubuntu $UBUNTU_VERSION_NAME $DISTRIB_CODENAME" | |
sudo apt-add-repository -y ppa:ansible/ansible | |
sudo apt-get update | |
sudo apt-get -y install ansible | |
sudo wget -q https://github.com/techjoomla/infra-automation/archive/master.zip -O /tmp/master.zip | |
sudo unzip -oq /tmp/master.zip -d /tmp | |
sudo ansible-playbook -i "hosts," -c local /tmp/infra-automation-master/environment-setup.yml --skip-tags "createuser,ansible,aptupdate,python,chrome" --extra-vars="server_runs_as=$non_admin_username" | |
sudo ansible-playbook -i "localhost," -c local /tmp/infra-automation-master/create-site.yml --extra-vars="which_host=localhost site_domain=$php5_name site_id=php5 php_install_version=5.6 server_runs_as=$non_admin_username server_runs_as_group=$non_admin_username" | |
sudo ansible-playbook -i "localhost," -c local /tmp/infra-automation-master/create-site.yml --extra-vars="which_host=localhost site_domain=$php7_name site_id=php7 php_install_version=7.0 server_runs_as=$non_admin_username server_runs_as_group=$non_admin_username" | |
sudo ansible-playbook -i "localhost," -c local /tmp/infra-automation-master/create-site.yml --extra-vars="which_host=localhost site_domain=$php71_name site_id=php71 php_install_version=7.1 server_runs_as=$non_admin_username server_runs_as_group=$non_admin_username" | |
echo "Updating Launcher Icons" | |
gsettings set com.canonical.Unity.Launcher favorites "['application://nautilus.desktop', 'application://firefox.desktop', 'application://google-chrome.desktop', 'application://geany.desktop', 'application://gnome-terminal.desktop', 'application://skype.desktop', 'application://filezilla.desktop', 'application://virtualbox.desktop', 'unity://running-apps', 'unity://expo-icon', 'unity://devices']" | |
else | |
echo "Not running an Ubuntu distribution. ID=$ID, VERSION=$VERSION" | |
fi | |
else | |
echo "Not running a distribution with /etc/lsb-release available" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment