Ansible scripts that build a Laravel Homestead-like environment.
Originally forked from konomae/ansible-laravel-settler.
This role installs PHP, PHP-FPM, and Nginx on the server.
There are also optional services to install like:
The role will also tweak sysctl.
We are using a config from this site to optimize the settings for a web server.
This role also assumes you are not going to be setting up more than 1 site on the server.
git clone https://github.com/invokemedia/ansible-laravel-settler roles/invokemedia.laravel-settler
# Add more public keys to the system?
add_ssh_users: false
# Auth file path, this is default:
ssh_auth_keys_file: "/home/{{ ansible_ssh_user }}/.ssh/authorized_keys"
# Update the cache?
settler_update_cache: yes
# Cache timeout
settler_cache_valid_time: 3600
# Flag for updating all the server packages
settler_upgrade_packages: yes
# File for timezone settings
settler_timezone_file: /usr/share/zoneinfo/America/Vancouver
# Timezone setting for PHP
settler_timezone: America/Vancouver
# the user for the system
settler_user: vagrant
# Optional installs
settler_redis: no
settler_memcached: no
settler_beanstalkd: no
settler_blackfire: no
# nginx settings
settler_nginx_default_server: 80
settler_nginx_server_name: localhost
settler_nginx_site_folder_root: /var/www/html/laravel
settler_nginx_site_public_folder: /public
You can add new users for SSH by setting add_ssh_users
to true
and then adding a ssh_list
hash.
None.
Here is how you would create a playbook to install a default nginx setup.
- hosts: web
sudo: yes
vars:
settler_update_cache: no
settler_upgrade_packages: no
settler_nginx_site_folder_root: /var/www/html
settler_nginx_site_public_folder: /public
roles:
- { role: invokemedia.laravel-settler }
Example usage with a playbook:
ansible-playbook playbook.yml
You would need to have a project sent to settler_nginx_site_folder_root
that contained a /public
and then some index file inside that.
Reload sysctl
- reload sysctlRestart nginx
- restarts nginxRestart php-fpm
- restarts php-fpmRestart memcached
- restarts memcachedRestart beanstalkd
- restarts beanstalkdRestart blackfire-agent
- restarts blackfire-agentRestart redis-server
- restarts redis-serverSet laravel folder permissions
- sets user and mode permissions on folders
MIT