We're now investigating Ansible to provision our servers. It's quite a default nginx, php-fpm & mysql setup. However, I am wondering about installation of these packages and how to make the playbook idempotent with the services running.
For nginx, we've a default nginx.conf
and some files in conf.d/
. For php, we've a php.ini
, a php-fpm.conf
, a pool in pool.d/
and some ini files in conf.d/
. Is it the idea to overwrite all files on every ansible playbook call?
If all configurations are overwritten, is it OK to do a service nginx reload
and service php5-fpm reload
even when the server is under heavy load? For initial installations, a reload
will not start the server, so I have to check the status first and based on that, switch between start
and reload
?
If I look for playbooks with a nginx installation, they often use handlers which will restart nginx. However, this is not graceful, so I don't really like that approach:
service: name=nginx state=restarted
In general, what's the common pattern to use ansible and provision servers with services like nginx, php-fpm and mysql without forcing a restart?