Hey,
I have several servers and each server runs Nginx and Php-fpm.
On each server I have several Vhosts, each Vhost (or a group of several) is owned by a linux user and is tied to a Php-fpm tool.
I think that I need to have the following roles:
- User
- Nginx Vhost
- Php-fpm pool
My goal is to be able to add/remove vhosts and php pools using config file. Eventually, I want to have the following files set:
/etc/nginx/sites-enabled/{{ vhost }}
/etc/php5/fpm/pool.d/{{ username}}.{{ poolname }}.conf
/home/{{ username }}/{{ vhost }}/public
The problem is that I’m very confused of how to structure it.
One way of doing it, is to define my physical servers as [groups] and the hosts as my vhosts. Then I can set a group var that will use the same connection settings for all the hosts/vhosts.
For each host/vhost I’ll set a var that will indicate it’s linux user and a var for the php pool. Then the playbook will load var files according to the user and pool.
Is that a good idea? Is there another way of doing it?
Is it possible to define a JSON var and then iterate it inside a playbook?
Thanks for reading