-
Notifications
You must be signed in to change notification settings - Fork 18
Home
The repository contains a toolkit to automate various IT tasks. The toolkit is designed to run from a master machine, and remotely executes tasks on all target machines. To use the toolkit, make sure ansible 1.9+ is installed on the master machine.
If the latest version of Anisble is not available in the distro repository, add the ansible maintained repo http://docs.ansible.com/ansible/intro_installation.html#latest-releases-via-apt-ubuntu
This will set up the typical development stack on all the Ubuntu machines defined in the inventory.
First, add the IP and username for the machine into the respective inventory file in the inventories folder. There are separate inventories for developer, QA and TL machines, since the software needed by each might be different. These inventories are stored in the inventories folder. A single inventory entry looks like this. The IP provided is the internal IP of the machine.
[ttpl17]
172.132.45.182
[ttpl17:vars]
server_runs_as="ttpl17" // This is the username of the machine
server_runs_as_group={{server_runs_as}}
user_email="[email protected]" // Email of the user. Not used in provisioning, only for documentation
user_name="Sudhir Sapkal" // Name of the user. Not used in provisioning, only for documentation
user_password="pw4$ttpl017" // System password. Not used in provisioning, since provisioning is done by the 'ashwin' user which has sudo access
Next, run the below script to perform the installations
ansible-playbook -i inventories/devs --skip-tags "createuser" environment-setup.yml
- The script installs the LAMP stack, apart from the development tools needed. To know more about what software the script installs visit - http://git.tekdi.net/ashwin.date/ansible-ttpl-it-automation/wikis/list-of-installed-software
Once the software is set up a virtual host needs to be created so that users can start using their localhost. To do this, run the create-site.yml
ansible script. The script needs the following variables
- which_host (The host from the selected inventory within which the virtualhost needs to be created, eg: ttpl55)
- site_server_name (The domain that needs to be used eg: ttpl55.local)
- site_id (Alphanumeric only. No spaces or special chars. Usually same as which_host, unless you expect to create more than 1 host eg: in case of PHP 5.6 & 7.0)
- php_install_version (The version of PHP to use for this host. Must be either
5.6
or7.0
) - site_ssl (Decides if the site needs to be set up with https support 0 = no ssl, 1 = ssl)
- ssl_key_file_path (The SSL key path in case you want to use a pre-created key & cert)
- ssl_cert_file_path (The SSL certificate path in case you want to use a pre-created key & cert)
- ssl_selfsigned (Set this to 1 in case you wish to use a self-signed certificate)
Set up a PHP 5.6 virtualhost on ttpl55, with self signed SSL certificate so it loads on https://ttpl55.local/
ansible-playbook -i inventories/devs create-site.yml --extra-vars='{"which_host":"ttpl55", "site_server_name":"ttpl55.local", "site_id":"ttpl5556", "site_ssl": 1, "ssl_selfsigned": 1, "php_install_version":"5.6"}'
Set up a PHP 7.0 virtualhost on ttpl55, without SSL that loads on http://ttpl55-php7.local/
ansible-playbook -i inventories/devs create-site.yml --extra-vars='{"which_host":"ttpl55", "site_server_name":"ttpl55-php7.local", "site_id":"ttpl5570", "php_install_version":"7.0"}'
Note that both the above commands can be run for the same host, one after the other to set up 2 hosts running PHP 5.6 & PHP 7.0 on the same machine.