redhat/almalinux

This commit is contained in:
ROTTLER Tamas 2025-11-16 16:13:19 +01:00
parent 66de76e2d3
commit eef3d27525

View File

@ -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: