Ansible playbooks for a web hosting cluster running on local vSphere server.
Cloudflare is heavily used. A tunnel is used to route all traffic and a Cloudflare Origin cert is used on the loadbalancer.
Currently these playbooks assume a couple things, this is being worked on and this list will be reduced eventually.
- An ansible user with passwordless sudo and public key auth needs to already exist. I use Cubic to include this in the initial unintended install of ubuntu.
- All VMs use DHCP and a network of 10.90.90.0/24
- All VMs are Ubuntu 24
- Cloudflare tunnels are setup manually currently.
- Zabbix templates and Autodiscover actions need to be configured manually.
- A non public vault password is currently needed.
- Create a server for Ansible to run on. Install ansible.
- Clone this repo. Create a hosts file at
/etc/ansible/hostswith just the database group - Run the initial playbook.
ansible-playbook init-site.yml --ask-vault-pass - Run the
NewDatabase.ymlplaybook to create a database for Semaphore - Install Semaphore
- Setup Sempaphore by running
semaphore setup - Run Semaphore
semaphore server --config=/etc/semaphore/config.json, You can use screen or a startup manager to make this start automatically. - Go to
http://ip-of-ansible-server:3000in a web browser. - Setup your inventory using the example in this repo (
ExampleInventory) - Setup your Variable Group using
extra_vars_TEMPLATE.ymlas an example. - Setup this or your fork of this repository under Repositories.
- Setup your playbooks under Task Templates
- Run
site.ymlto deploy entire cluster - Create new sites on the cluster with
NewWordpressSite.yml
site.yml- Entire Cluster. Meant to be run on a schedule/cron. Weekly
NewDatabase.yml- Creates a database, allows the rest of the cluster to talk to it.NewWordpressSite.yml- Creates a new wordpress website on the cluster.
ClearNginxCache.yml- Clears the FastCGI cache for a website. Useful to run this after making big changes to a site.ReloadWeb.yml- Reloads the configuration for all of the Web and WPAdmin servers. Run after making nginx config changes.WordpressUpdater.yml- Updates all Plugins, all Themes, and the core Wordpress version for all WordPress sites on the cluster. Meant to be run on a schedule/cron. Daily