Skip to content

Commit 0c7efad

Browse files
author
Miguel Medinilla
committed
Use separate php-rh-8.yml task file for Rocky/RH
It makes easier to maintain the php tasks for RedHat. We already had a task file only for php7.4 and RedHat. It is the same php-rh-7.4.yml file but adding a task to remove old php7 (required for 2.9 upgrades from 2.7/2.8). To avoid installing recommended packages, the following options have been added to yum task: * allowerasing: true * install_weak_deps: false
1 parent e419192 commit 0c7efad

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

tasks/main.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,24 @@
3636
when:
3737
- ansible_distribution == "Ubuntu"
3838

39-
- import_tasks: "php-rh.yml"
39+
- import_tasks: "php-rh-74.yml"
4040
environment:
4141
- PATH: "{{ ansible_env.PATH }}:{{ php_rh_centos_path }}"
4242
tags:
4343
- "atom-php"
4444
when:
4545
- ansible_os_family in ["RedHat","Rocky"]
46-
- php_version|int < 74
46+
- php_version|int == 74
47+
48+
- import_tasks: "php-rh-8.yml"
49+
environment:
50+
- PATH: "{{ ansible_env.PATH }}:{{ php_rh_centos_path }}"
51+
tags:
52+
- "atom-php"
53+
when:
54+
- ansible_os_family in ["RedHat","Rocky"]
55+
- php_version|int >= 80
56+
4757

4858
- import_tasks: "php-rh-74.yml"
4959
environment:

tasks/php-rh-8.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
3+
- name: Remove old PHP 7 packages
4+
yum:
5+
name: "php7*"
6+
state: absent
7+
- name: "Install PHP packages in RH/Centos"
8+
yum:
9+
name:
10+
- "php{{ php_version }}-php-cli"
11+
- "php{{ php_version }}-php-ldap"
12+
- "php{{ php_version }}-php-fpm"
13+
- "php{{ php_version }}-php-mysqlnd"
14+
- "php{{ php_version }}-php-xml"
15+
- "php{{ php_version }}-php-opcache"
16+
- "php{{ php_version }}-php-devel"
17+
- "php{{ php_version }}-php-mbstring"
18+
- "php{{ php_version }}-php-pecl-apcu"
19+
- "php{{ php_version }}-php-pecl-memcache"
20+
- "php{{ php_version }}-php-pecl-memprof"
21+
- "php{{ php_version }}-php-pecl-zip"
22+
- "zlib-devel" # needed for memcached
23+
- "unzip"
24+
- "java-1.8.0-openjdk-headless" # needed for fop
25+
allowerasing: true
26+
install_weak_deps: false
27+
state: "latest"
28+
29+
- name: "Create /usr/bin/php link"
30+
file:
31+
src: "{{ php_rh_centos_path }}/php"
32+
dest: "/usr/bin/php"
33+
state: "link"
34+
35+
- name: "Set php.ini memory to 512"
36+
lineinfile:
37+
path: "{{ php_rh_centos_etc_path }}/php.ini"
38+
regexp: '^memory_limit'
39+
line: 'memory_limit = 512M'
40+
41+
- name: "Enable php{{ php_version }}-php-fpm service"
42+
systemd:
43+
name: "php{{ php_version }}-php-fpm"
44+
state: "restarted"
45+
enabled: "yes"

0 commit comments

Comments
 (0)