Se fizer qualquer alteração na configuração do Apache HTTP, certifique-se de testar a configuração antes de recarregar. Força a falha quando há um problema.
- name: Apache | Enable the new site
command: a2ensite site-name creates=/etc/apache2/sites-enabled/site-name
- name: Apache | Check the apache configuration
command: apache2ctl configtest
register: apache_result
ignore_errors: yes
- name: Apache | Reverting - Disable new site
action: command a2dissite site-name
when_failed: $apache_result
- name: Apache | Reverting changes - Ending playbook
action: fail msg="Apache configuration is invalid. Please check before re-running the playbook."
when_failed: $apache_result
- name: Apache | Reload Apache
service: name=apache2 state=reloaded