redhat/almalinux
This commit is contained in:
parent
66de76e2d3
commit
eef3d27525
@ -31,33 +31,77 @@
|
|||||||
- (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 9) or
|
- (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 9) or
|
||||||
(ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 20)
|
(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:
|
copy:
|
||||||
src: hws.cnf
|
src: hws.cnf
|
||||||
dest: /etc/mysql/conf.d
|
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?
|
- name: is root password set?
|
||||||
stat:
|
stat:
|
||||||
path: /etc/mysql/jelszo
|
path: /etc/mysql/jelszo
|
||||||
register: mysql_jelszo
|
register: mysql_jelszo
|
||||||
|
when:
|
||||||
|
- (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu")
|
||||||
|
|
||||||
- name: pwgen
|
- name: pwgen
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
command: "pwgen -s 16 1"
|
command: "pwgen -s 16 1"
|
||||||
register: pwgen
|
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
|
- name: write mysql root passwd to file
|
||||||
copy:
|
copy:
|
||||||
content: "{{ mysql_root | default(pwgen.stdout) }}\n"
|
content: "{{ mysql_root | default(pwgen.stdout) }}\n"
|
||||||
dest: /etc/mysql/jelszo
|
dest: /etc/mysql/jelszo
|
||||||
mode: "0400"
|
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
|
- name: set mysql root passwd
|
||||||
shell: "echo \"SET PASSWORD FOR 'root'@'localhost' = PASSWORD('{{ mysql_root | default(pwgen.stdout) }}');\" | mysql -u root"
|
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:
|
# vim: set tabstop=2 shiftwidth=2 expandtab smarttab:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user