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