From eef3d27525e836d4b4785330a7c116e1e62879d5 Mon Sep 17 00:00:00 2001 From: Rottler Tamas Date: Sun, 16 Nov 2025 16:13:19 +0100 Subject: [PATCH] redhat/almalinux --- tasks/main.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 0fcf850..fc4594b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -31,33 +31,77 @@ - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 9) or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 20) +- name: install packages, rhel9 + tags: dnf + dnf: + name: + - mysql-server + - mysql + state: present + when: + - (ansible_distribution == "RedHat" and ansible_distribution_major_version|int() == 9) or + (ansible_distribution == "AlmaLinux" and ansible_distribution_major_version|int() == 9) -- name: mysql conf +- name: install packages, rhel10-99 + tags: dnf + dnf: + name: + - mysql8.4-server + - mysql8.4 + state: present + when: + - ansible_distribution == "RedHat" and ansible_distribution_major_version|int() >= 10 + +- name: enable mysqld service + systemd_service: + name: mysqld + enabled: true + +- name: mysql conf (debian) copy: src: hws.cnf dest: /etc/mysql/conf.d + when: + - (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu") + +- name: mysql conf (redhat) + copy: + src: hws.cnf + dest: /etc/my.cnf.d/ZZ_hws.cnf + when: + - ansible_distribution == "RedHat" or ansible_distribution == "AlmaLinux" + +# root jelszo csak regi borderekhez kellett - name: is root password set? stat: path: /etc/mysql/jelszo register: mysql_jelszo + when: + - (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu") - name: pwgen delegate_to: localhost command: "pwgen -s 16 1" register: pwgen - when: not mysql_jelszo.stat.exists + when: + - (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu") + - not mysql_jelszo.stat.exists - name: write mysql root passwd to file copy: content: "{{ mysql_root | default(pwgen.stdout) }}\n" dest: /etc/mysql/jelszo mode: "0400" - when: not mysql_jelszo.stat.exists + when: + - (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu") + - not mysql_jelszo.stat.exists - name: set mysql root passwd shell: "echo \"SET PASSWORD FOR 'root'@'localhost' = PASSWORD('{{ mysql_root | default(pwgen.stdout) }}');\" | mysql -u root" - when: not mysql_jelszo.stat.exists + when: + - (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu") + - not mysql_jelszo.stat.exists # vim: set tabstop=2 shiftwidth=2 expandtab smarttab: