Debian Codegraph @

ansible_collections/community/zabbix/roles/zabbix_web/tasks/apache.yml

raw
1 ---
2 - name: Setting Web Server Facts
3 ansible.builtin.set_fact:
4 zabbix_web_user: "{{ zabbix_web_user if zabbix_web_user is defined else _apache_user }}"
5 zabbix_web_group: "{{ zabbix_web_group if zabbix_web_group is defined else _apache_group }}"
6 zabbix_web_vhost_location: "{{ zabbix_web_vhost_location if zabbix_web_vhost_location is defined else _apache_vhost_location }}"
7 tags:
8 - always
9
10 - name: "Apache | Installing Zabbix Apache Conf"
11 package:
12 name: "{{ _zabbix_web_apache_packages + _zabbix_web_apache_php_dependencies | default([]) }}"
13 state: "{{ zabbix_web_package_state }}"
14 update_cache: true
15 disablerepo: "{{ zabbix_web_disable_repo | default(_zabbix_web_disable_repo | default(omit)) }}"
16 environment:
17 http_proxy: "{{ zabbix_http_proxy | default('') }}"
18 https_proxy: "{{ zabbix_https_proxy | default('') }}"
19 register: zabbix_apache_conf_install
20 until: zabbix_apache_conf_install is succeeded
21 become: true
22 tags:
23 - install
24 - dependencies
25 - database
26
27 - name: "Apache | Get Apache version"
28 ansible.builtin.shell: |
29 PATH=/usr/sbin:$PATH
30 set -o pipefail
31 apachectl -v | grep 'version' | awk -F '/' '{ print $2 }'| awk '{ print $1 }' | cut -c 1-3
32 changed_when: false
33 register: apachectl_version
34 check_mode: false
35 args:
36 executable: /bin/bash
37 tags:
38 - config
39
40 - name: "Apache | Set correct apache_version"
41 ansible.builtin.set_fact:
42 apache_version: "{{ apachectl_version.stdout }}"
43 tags:
44 - config
45
46 - name: "Apache | Install apache vhost"
47 ansible.builtin.template:
48 src: apache_vhost.conf.j2
49 dest: "{{ zabbix_web_vhost_location }}"
50 owner: "{{ zabbix_web_user }}"
51 group: "{{ zabbix_web_group }}"
52 mode: 0644
53 when: zabbix_web_create_vhost
54 become: true
55 notify:
56 - restart apache
57 tags:
58 - config
59
60 - name: "Apache | Enable Site (Debian Only)"
61 ansible.builtin.file:
62 src: "{{ zabbix_web_vhost_location }}"
63 dest: /etc/apache2/sites-enabled/zabbix.conf
64 state: link
65 owner: "{{ zabbix_web_user }}"
66 group: "{{ zabbix_web_group }}"
67 mode: 0644
68 become: true
69 when: ansible_facts['os_family'] == 'Debian' and zabbix_web_create_vhost
70 tags:
71 - config