--- - name: Ensure configuration file is available to Apache template: dest: "/etc/apache2/sites-available/25-{{ vhost_name }}.conf" src: templates/apache_vhost.j2 mode: 0644 backup: yes - name: Create auth user file htpasswd: path: "{{ auth_user_file }}" name: "{{ nagios_admin_user }}" password: "{{ nagios_admin_password }}" owner: root group: www-data mode: 0640 - name: Ensure vhost is enabled file: state: link src: "/etc/apache2/sites-available/25-{{ vhost_name }}.conf" path: "/etc/apache2/sites-enabled/25-{{ vhost_name }}.conf" notify: Restart Apache2