From 37f4e28f8b08c46aae8b9e01c868035bcfc91eab Mon Sep 17 00:00:00 2001 From: Rottler Tamas Date: Sun, 16 Nov 2025 16:12:36 +0100 Subject: [PATCH] redhat/almalinux --- tasks/main.yml | 10 ++++--- tasks/redhat.yml | 39 ++++++++++++++++++++++---- templates/000-default_fpm.conf | 6 ++-- templates/other-vhosts-access-log.conf | 2 +- 4 files changed, 44 insertions(+), 13 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index d019316..76de3c5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -14,13 +14,13 @@ setype: httpd_sys_rw_content_t target: "/var/www/.*" when: - - ansible_distribution == "RedHat" + - ansible_distribution == "RedHat" or ansible_distribution == "AlmaLinux" - ansible_selinux.status == 'enabled' - name: /var/www restorecon command: "restorecon -r /var/www" when: - - ansible_distribution == "RedHat" + - ansible_distribution == "RedHat" or ansible_distribution == "AlmaLinux" - ansible_selinux.status == 'enabled' - name: www subdirs @@ -40,7 +40,7 @@ - name: include redhat specific include_tasks: redhat.yml - when: ansible_distribution == "RedHat" + when: ansible_distribution == "RedHat" or ansible_distribution == "AlmaLinux" - name: conf-available templates template: @@ -84,7 +84,9 @@ when: - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 11) or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 20) or - ansible_distribution == "RedHat" + ansible_distribution == "RedHat" or + ansible_distribution == "AlmaLinux" + # vim: set tabstop=2 shiftwidth=2 expandtab smarttab: diff --git a/tasks/redhat.yml b/tasks/redhat.yml index 68aa1fc..e6a3ce4 100644 --- a/tasks/redhat.yml +++ b/tasks/redhat.yml @@ -1,15 +1,14 @@ --- -- name: set phpver for rhel9 +- name: set phpver for rhel9-99 set_fact: phpver: "84" when: - - ansible_distribution == "RedHat" - - ansible_distribution_major_version|int() == 9 + - ansible_distribution_major_version|int() >= 9 - name: install remi repo tags: dnf dnf: - name: "https://rpms.remirepo.net/enterprise/remi-release-9.rpm" + name: "https://rpms.remirepo.net/enterprise/remi-release-{{ ansible_distribution_major_version }}.rpm" disable_gpg_check: yes #- name: dnf module php [phpver] @@ -24,8 +23,29 @@ name: - httpd - mod_ssl - - mysql + +- name: install packages, rhel9 + tags: dnf + dnf: + name: - redis + - mysql + when: + - ansible_distribution_major_version|int() == 9 + +- name: install packages, rhel10-99 + tags: dnf + dnf: + name: + - valkey + - mysql8.4 + when: + - ansible_distribution_major_version|int() >= 10 + +- name: install php packages + tags: dnf + dnf: + name: - "php{{ phpver }}-php-fpm" - "php{{ phpver }}-php-cli" - "php{{ phpver }}-php-bcmath" @@ -52,6 +72,15 @@ systemd_service: name: redis enabled: true + when: + - ansible_distribution_major_version|int() == 9 + +- name: enable valkey service + systemd_service: + name: valkey + enabled: true + when: + - ansible_distribution_major_version|int() >= 10 - name: enable php-fpm service [phpver] systemd_service: diff --git a/templates/000-default_fpm.conf b/templates/000-default_fpm.conf index 90a2c2c..17fbeb4 100644 --- a/templates/000-default_fpm.conf +++ b/templates/000-default_fpm.conf @@ -1,5 +1,5 @@ # -{% if ansible_distribution == "RedHat" %} +{% if ansible_distribution == "RedHat" or ansible_distribution == "AlmaLinux" %} # ErrorLog /var/log/httpd/notls.log # CustomLog /var/log/httpd/notls.log detailed {% else %} @@ -20,7 +20,7 @@ DocumentRoot /var/www/def/public -{% if ansible_distribution == "RedHat" %} +{% if ansible_distribution == "RedHat" or ansible_distribution == "AlmaLinux" %} ErrorLog /var/log/httpd/error.log CustomLog /var/log/httpd/access.log detailed {% else %} @@ -33,7 +33,7 @@ Require all granted -{% if ansible_distribution == "RedHat" %} +{% if ansible_distribution == "RedHat" or ansible_distribution == "AlmaLinux" %} SetHandler "proxy:unix:/var/opt/remi/php{{ phpver }}/run/php-fpm/www.sock|fcgi://localhost" {% else %} SetHandler "proxy:unix:/run/php/php{{ phpver }}-fpm.sock|fcgi://localhost" diff --git a/templates/other-vhosts-access-log.conf b/templates/other-vhosts-access-log.conf index 9c36d68..6b7049a 100644 --- a/templates/other-vhosts-access-log.conf +++ b/templates/other-vhosts-access-log.conf @@ -1,6 +1,6 @@ # Define an access log for VirtualHosts that don't define their own logfile #CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined -{% if ansible_distribution == "RedHat" %} +{% if ansible_distribution == "RedHat" or ansible_distribution == "AlmaLinux" %} CustomLog /var/log/httpd/other_vhosts_access.log detailed {% else %} CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log detailed