3.5 KiB
3.5 KiB
Ansible-Nginx-Cluster
Ansible playbook that provisions a group of servers to run Nginx and PHP using a content store that is synced using lsyncd.
Variables
Variable | Required | Default | Choices | Description |
---|---|---|---|---|
nginx_cluster_user | yes | root | The user account that should be used for the lsyncd service & communication between cluster members | |
nginx_cluster_private_key | yes | /root/.ssh/lsyncd | Private key to use for communication between cluster members | |
nginx_cluster_temp_dir | yes | /tmp/lsyncdSyncTemp | Temp directory to use for the lsyncd service | |
nginx_cluser_sync_site_dir | yes | /var/www/html | Nginx website directory to sync between the cluster members | |
nginx_cluser_sync_config_dir | yes | /etc/nginx | Nginx directory to sync between the cluster members | |
nginx_cluser_sync_php_config_dir | yes | /etc/php.d | PHP directory to sync between the cluster members | |
nginx_cluser_lsyncd_mode | yes | rsyncssh | The lsyncd mode to use for the config | |
nginx_cluser_lsyncd_delay | yes | 0 | The lsyncd delay between event syncs. Set to 0 for instant syncing | |
nginx_cluser_lsyncd_rsync_times | yes | true | true, false | Enable the rsync times option for the sync config |
nginx_cluser_lsyncd_rsync_archive | yes | true | true, false | Enable the rsync archive option for the sync config |
nginx_cluser_lsyncd_rsync_compress | yes | true | true, false | Enable the rsync compress option for the sync config |
nginx_cluser_lsyncd_rsync_perms | yes | true | true, false | Enable the rsync perms option for the sync config |
nginx_cluser_lsyncd_rsync_acls | yes | true | true, false | Enable the rsync acls option for the sync config |
nginx_cluser_lsyncd_rsync_owner | yes | true | true, false | Enable the rsync owner option for the sync config |
Example
Execute playbook with needed variables to setup a cluster of servers syncing /var/www/html
based on the default values.
ansible-playbook -i hosts site.yml
---
# file: hosts
nginx_cluster:
hosts:
ws01:
ansible_host: 10.10.10.14
ws02:
ansible_host: 10.10.10.18
vars:
ansible_user: ansible
License
See LICENSE file for full license information.