Debian Codegraph @

ansible_collections/community/zabbix/molecule/zabbix_web/prepare.yml

raw
1 ---
2 - name: Prepare
3 hosts: all
4
5 pre_tasks:
6 # issues on redhat with curl, so install curl-minimal.
7 - name: "Installing packages"
8 ansible.builtin.package:
9 name:
10 - "curl{% if ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] | int > 8 %}-minimal{% endif %}"
11 - sudo
12 update_cache: "{{ (ansible_facts['os_family'] in ['Debian', 'Suse']) | ternary(true, omit) }}"
13 register: installation_dependencies
14 until: installation_dependencies is succeeded
15
16 - name: "Configure SUDO."
17 ansible.builtin.lineinfile:
18 dest: /etc/sudoers
19 line: "Defaults !requiretty"
20 state: present
21
22 - name: Enabling PHP 8.0
23 ansible.builtin.dnf:
24 name: "@php:8.0/common"
25 when:
26 - ansible_facts['os_family'] == 'RedHat'
27 - ansible_facts['distribution_major_version'] == "8"
28
29 - name: Set PHP packages (Centos 8+)
30 ansible.builtin.set_fact:
31 php_packages:
32 - php
33 - php-cli
34 - php-common
35 - php-devel
36 - php-fpm
37 - php-gd
38 - php-ldap
39 - php-mbstring
40 - php-opcache
41 - php-pdo
42 - php-pear
43 - php-pecl-apcu
44 - php-xml
45 when: ansible_facts['os_family'] == 'RedHat'
46
47 - name: Workaround for geerlingguy.php missing ubuntu-24.04 support
48 when:
49 - ansible_facts['distribution'] == "Ubuntu"
50 - ansible_facts['distribution_major_version'] >= '24'
51 block:
52 - name: Set PHP Version
53 ansible.builtin.set_fact:
54 __php_default_version_debian: "8.3"
55
56 - name: Set PHP packages
57 ansible.builtin.set_fact:
58 __php_packages:
59 - php{{ __php_default_version_debian }}-common
60 - php{{ __php_default_version_debian }}-cli
61 - php{{ __php_default_version_debian }}-dev
62 - php{{ __php_default_version_debian }}-fpm
63 - libpcre3-dev
64 - php{{ __php_default_version_debian }}-gd
65 - php{{ __php_default_version_debian }}-curl
66 - php{{ __php_default_version_debian }}-imap
67 - php-json
68 - php{{ __php_default_version_debian }}-opcache
69 - php{{ __php_default_version_debian }}-xml
70 - php{{ __php_default_version_debian }}-mbstring
71 - php{{ __php_default_version_debian }}-apcu
72 - php{{ __php_default_version_debian }}-sqlite3
73
74 - name: Set PHP Version (Suse)
75 ansible.builtin.set_fact:
76 __php_default_version_suse: "8"
77 when: ansible_facts['os_family'] == 'Suse'
78
79 - name: Workaround for geerlingguy roles
80 ansible.builtin.set_fact:
81 ansible_distribution: "{{ ansible_facts['distribution'] }}"
82 ansible_distribution_major_version: "{{ ansible_facts['distribution_major_version'] }}"
83 ansible_distribution_version: "{{ ansible_facts['distribution_version'] }}"
84 ansible_os_family: "{{ ansible_facts['os_family'] }}"
85 ansible_processor_count: "{{ ansible_facts['processor_count'] }}"
86
87 roles:
88 - role: geerlingguy.apache
89 when:
90 - zabbix_web_http_server == "apache"
91 - role: geerlingguy.nginx
92 when:
93 - zabbix_web_http_server == "nginx"
94 - role: geerlingguy.php
95 - role: zabbix_server
96
97 post_tasks:
98 - name: Suse | Create default php-fpm config
99 ansible.builtin.copy:
100 remote_src: true
101 src: "/etc/php{{ __php_default_version_suse }}/fpm/php-fpm.conf.default"
102 dest: "/etc/php{{ __php_default_version_suse }}/fpm/php-fpm.conf"
103 when: ansible_facts['os_family'] == 'Suse'
104
105 - name: "Remove file"
106 ansible.builtin.file:
107 path: "{{ item }}"
108 state: absent
109 loop:
110 - /var/www/html/index.html