ansible-role-nagios/tasks/configure_apache.yml
2022-10-21 10:05:06 +03:00

25 lines
No EOL
684 B
YAML

---
- name: Ensure configuration file is available to Apache
template:
dest: "/etc/apache2/sites-available/25-{{ item.vhost_name }}.conf"
src: templates/apache_vhost.j2
mode: 0644
backup: yes
loop: "{{ vhosts }}"
- 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-{{ item.vhost_name }}.conf"
path: "/etc/apache2/sites-enabled/25-{{ item.vhost_name }}.conf"
loop: "{{ vhosts }}"
notify: Restart Apache2