Indicating differences between files using --diff
In the check mode, you can use the --diff
option to show the changes that would be applied to a file. To be able to see the --diff
option in use, we need to change our playbooks/setup_apache.yaml
playbook to match the following:
- hosts: localhost tasks: - name: Ensure Apache is installed yum: name: httpd state: present - name: Ensure Apache in enabled service: name: httpd state: running enabled: True - name: Ensure Apache userdirs are properly configured template: src: '../templates/userdir.conf' dest: '/etc/httpd/conf.d/userdir.conf'
As you can see, we added a task, which will ensure a certain state of the /etc/httpd/conf.d/userdir.conf
file.
We also need to create a template file placed in templates/userdir.conf
with the following...