Ansible playbook that provisions a group of servers to run Nginx and PHP using a content store that is synced using lsyncd.
Find a file
2024-11-25 05:46:20 -07:00
collections Adding community requirement 2024-11-24 21:04:17 -07:00
roles/nginx_cluster Fixing loop logic for blank values 2024-11-25 05:46:20 -07:00
.gitignore Initial commit 2023-01-17 08:09:10 -07:00
hosts.yml Adding configuration options 2024-08-01 13:47:09 -06:00
LICENSE Initial commit 2023-01-17 08:09:10 -07:00
nginx_cluster.yml Initial commit 2023-01-18 14:42:02 -07:00
README.md README Update 2023-02-06 15:26:56 -07:00
site.yml Initial commit 2023-01-18 14:42:02 -07:00

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.