System Configuration with Ansible
DevShop is now installed using Ansible roles. This means that most system-level configuration is now managed with Ansible variables.
When you run
install.sh, it collects information about your system and passes that to the
ansible-playbookcommand. The script is idempotent, meaning you can run it many times and get the same result.
These variables are things like
install.shruns, it creates a simple Ansible inventory file in the same folder that
install.shresides. This file contains a single entry using just the hostname by default.
If the file already exists, the
install.shscript will tell ansible-playbook to use that file.
inventoryfile is the key to customizing the configuration of your server.
install.shscript uses a separate
inventoryfile than the default Ansible inventory (at
/etc/ansible/hosts). This is to remain unobtrusive to the system. In the future, we will likely start using the default inventory system.
Create a file called
inventoryin the same directory as
install.sh. You can place custom variables in there in the form of an "Ansible Inventory".
For your devshop server's inventory file you do not need to worry about groups. By default, it just includes the hostname.
If you want to add variables you can do so with this format:
devshop.mydomain.com server_hostname=devshop.mydomain.com php_memory_limit=256M
Explanation of the hostname vs
The first hostname mentioned in the file above, "devshop.mydomain.com", is what ansible will use to find the server, using a DNS lookup.
server_hostname=devshop.mydomain.comis the variable that Ansible will use to try and set the system hostname of this machine.
This list of available Ansible variables depends on the roles being used. DevShop uses Jeff Geerling's roles which are very well written, so there are many variables to use.
The easiest way to review all of the roles, variables, and templates that DevShop uses in one place is to use the
ansible-galaxycommand and DevShop's
Get that file and run
ansible-galaxy install -r requirements.yml
In each Ansible Role repository, look for the
defaults/main.ymlfile. In this file are all the available variable names you can use, along with their default values.
Also look for the
templatesfolder. Most configuration files on the system come from these templates.
php_memory_limitis in the
defaults/main.ymlfile located at https://github.com/geerlingguy/ansible-role-php/blob/master/defaults/main.yml#L48 and is written to the
templates/php.ini.j2file at https://github.com/geerlingguy/ansible-role-php/blob/master/templates/php.ini.j2#L36
You can edit your
inventoryfile, then run
install.shagain to reconfigure your system. The Ansible playbooks are smart enough to restart services if a configuration file changes.
We have developed a module that allows Aegir to become your Ansible Inventory. It is possible to setup your DevMaster front-end to manage the server's inventory and variables.