ansibleguy.sw_zoneminder/tasks/debian/web.yml

60 lines
1.8 KiB
YAML

---
- name: ZoneMinder | Webserver | Managing Apache2
ansible.builtin.include_role:
name: ansibleguy.infra_apache
vars:
apache:
security: "{{ ZM_CONFIG.apache.security }}"
modules:
present: "{{ ZM_HC.apache.modules }}"
ssl: "{{ ZM_CONFIG.apache.ssl }}"
sites:
zoneminder: "{{ zm_apache_path | combine(ZM_CONFIG.apache, recursive=true) }}"
no_log: true
tags: [config, certs]
args:
apply:
tags: [config, certs]
- name: ZoneMinder | Webserver | Adding apache app-config
ansible.builtin.template:
src: 'templates/etc/apache2/sites-available/zoneminder.conf.j2'
dest: "/etc/apache2/sites-available/site_{{ ZM_CONFIG.apache.file }}_app.conf"
owner: 'root'
group: 'root'
mode: 0644
- name: ZoneMinder | Webserver | Configuring php timezone to configured one
ansible.builtin.lineinfile:
path: "/etc/php/{{ ZM_HC.php_version }}/apache2/php.ini"
line: "date.timezone = {{ ZM_CONFIG.timezone }}"
regexp: "^date.timezone"
when: ZM_CONFIG.timezone not in NONE_VALUES
- name: ZoneMinder | Webserver | Getting local timezone
ansible.builtin.shell: |
set -o pipefail
timedatectl | grep 'Time zone' | cut -d':' -f2 | cut -d' ' -f2
args:
executable: '/bin/bash'
register: controller_tz
delegate_to: localhost
changed_when: false
check_mode: false
become: false
when: ZM_CONFIG.timezone in NONE_VALUES
- name: ZoneMinder | Webserver | Configuring php timezone to locally used one
ansible.builtin.lineinfile:
path: "/etc/php/{{ ZM_HC.php_version }}/apache2/php.ini"
line: "date.timezone = {{ controller_tz.stdout }}"
regexp: "^date.timezone"
when: ZM_CONFIG.timezone in NONE_VALUES
- name: ZoneMinder | Webserver | Restarting webserver
ansible.builtin.systemd:
name: 'apache2.service'
state: restarted
changed_when: false