8343-New-machine-id #48

Merged
xavi merged 40 commits from 8343-New-machine-id into main 2025-01-10 13:29:15 +00:00
1 changed files with 36 additions and 65 deletions
Showing only changes of commit b1410f91a0 - Show all commits

View File

@ -4,29 +4,20 @@
state: present
#install_recommends: no
- name: Ensure log directory exists /var/log/mysql
- name: Ensure required directories exist
file:
path: /var/log/mysql
path: "{{ item.path }}"
state: directory
owner: mysql
group: adm
mode: u=rwx,g=rxs,o=
- name: Ensure mysqlbin directory exists /mnt/mysqlbin
file:
path: /mnt/mysqlbin
state: directory
owner: root
group: root
mode: u=rwx,g=rx,o=rx
- name: Ensure mysqltmp directory exists /mnt/mysqltmp with sticky bit
file:
path: /mnt/mysqltmp
state: directory
mode: u=rwx,g=rwx,o=rwxt
owner: root
group: root
owner: "{{ item.owner }}"
group: "{{ item.group }}"
mode: "{{ item.mode }}"
loop:
- { path: /var/log/mysql, owner: mysql, group: adm, mode: 'u=rwx,g=rxs,o=' }
- { path: /root/scripts, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
- { path: /mnt/mysqlbin, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
- { path: /etc/systemd/system/mariadb.service.d, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
- { path: /mnt/mysqltmp, owner: root, group: root, mode: 'u=rwx,g=rwx,o=rwxt' }
- { path: /mnt/mysqlbin/binlog, owner: mysql, group: mysql, mode: 'u=rwx,g=,o=' }
- name: Set MariaDB custom configuration
copy:
@ -39,31 +30,6 @@
- "files/z9*.cnf"
notify: restart-mariadb
- name: Ensure mariadb service override directory exists
file:
path: /etc/systemd/system/mariadb.service.d
state: directory
owner: root
group: root
mode: u=rwx,g=rx,o=rx
- name: Set MariaDB custom service.d override.conf
copy:
src: mariadb_override.conf
dest: /etc/systemd/system/mariadb.service.d/override.conf
owner: root
group: root
mode: u=rw,g=r,o=r
notify: reload systemd
- name: Ensure scripts root directory exists
file:
path: /root/scripts
state: directory
owner: root
group: root
mode: u=rwx,g=rx,o=rx
- name: Set MariaDB custom root scripts
copy:
src: "{{ item }}"
@ -74,26 +40,31 @@
with_fileglob:
- "files/scripts/*.sh"
- name: Set MariaDB README root script
copy:
src: files/scripts/README.md
dest: /root/scripts/README.md
- name: Ensure required files are copied to their destinations
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: u=rw,g=r,o=r
mode: "{{ item.mode }}"
loop:
- { src: 'files/scripts/README.md', dest: '/root/scripts/README.md', mode: 'u=rw,g=r,o=r' }
- { src: 'mariadb_override.conf', dest: '/etc/systemd/system/mariadb.service.d/override.conf', mode: 'u=rw,g=r,o=r' }
- { src: 'files/scripts/mysqltuner.pl', dest: '/root/scripts/mysqltuner.pl', mode: 'u=rwx,g=rx,o=rx' }
notify:
- reload systemd
- name: Set MariaDB performance and customize root script
copy:
src: files/scripts/mysqltuner.pl
dest: /root/scripts/mysqltuner.pl
owner: root
group: root
mode: u=rwx,g=rx,o=rx
#- name: Set MariaDB Cron to /etc/cron.d
# template:
# src: templates/cron_mariadb
# dest: /etc/cron.d/vn
# owner: root
# group: root
# mode: u=rw,g=r,o=r
- name: Set MariaDB Cron to /etc/cron.d
template:
src: templates/cron_mariadb
dest: /etc/cron.d/vn
owner: root
group: root
mode: u=rw,g=r,o=r
- name: Add tmpfs in /etc/fstab
blockinfile:
path: /etc/fstab
marker: "# {mark} ANSIBLE-MANAGED TMPFS ENTRY"
block: |
tmpfs /mnt/mysqltmp tmpfs rw,size=6144M 0 0