--- - name: Ensure /usr/share/scripts exists file: dest: /usr/share/scripts mode: "0700" state: directory tags: - mysql # mytop # mytop is installed with MariaB # the package has been removed of Stretch repositories - name: Is mytop available ? command: which mytop failed_when: False changed_when: False check_mode: no register: which_mytop - name: Install mytop apt: name: mytop state: present tags: - packages - mytop - mysql when: which_mytop.rc != 0 - name: Read debian-sys-maint password shell: cat /etc/mysql/debian.cnf | grep -m1 "password = .*" | cut -d" " -f3 register: mysql_debian_password changed_when: False tags: - mysql - name: Configure mytop template: src: mytop.j2 dest: /root/.mytop mode: "0600" force: yes tags: - mytop - mysql # mysqltuner - include: remount_usr_rw.yml when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr") - name: Install mysqltuner copy: src: mysqltuner.pl dest: "{{ mysql_scripts_dir or general_scripts_dir | mandatory }}/mysqltuner.pl" mode: "0700" tags: - mysql - mysqltuner - name: Install aha apt: name: aha tags: - mysql # automatic optimizations - include: remount_usr_rw.yml when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr") - name: Optimize script for MySQL copy: src: mysql-optimize.sh dest: "{{ mysql_scripts_dir or general_scripts_dir | mandatory }}/mysql-optimize.sh" mode: "0700" tags: - mysql - name: "Cron dir is present" file: path: "/etc/cron.{{ mysql_cron_optimize_frequency | mandatory }}" state: directory mode: "0755" owner: root group: root - name: "Enable cron to optimize MySQL" file: src: "{{ mysql_scripts_dir or general_scripts_dir | mandatory }}/mysql-optimize.sh" dest: /etc/cron.{{ mysql_cron_optimize_frequency | mandatory }}/mysql-optimize.sh state: link when: mysql_cron_optimize tags: - mysql - name: "Disable cron to optimize MySQL" file: dest: /etc/cron.weekly/mysql-optimize.sh state: absent when: not mysql_cron_optimize tags: - mysql # my-add.sh - include: remount_usr_rw.yml when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr") - name: Install my-add.sh copy: src: my-add.sh dest: "{{ mysql_scripts_dir or general_scripts_dir | mandatory }}/my-add.sh" mode: "0700" tags: - mysql - name: Install apg apt: name: apg tags: - mysql - packages