mysql: remount /usr if needed

This commit is contained in:
Jérémy Lecour 2017-05-23 15:11:11 +02:00 committed by Jérémy Lecour
parent da3cafca48
commit 37ef790d57
2 changed files with 28 additions and 6 deletions

View file

@ -0,0 +1,13 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when: mount.rc == 0 and not mount.stdout_lines.0 | search("rw")

View file

@ -30,6 +30,9 @@
# mysqltuner # mysqltuner
- include: remount_usr_rw.yml
when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr")
- name: Install mysqltuner - name: Install mysqltuner
copy: copy:
src: mysqltuner.pl src: mysqltuner.pl
@ -47,6 +50,9 @@
# automatic optimizations # automatic optimizations
- include: remount_usr_rw.yml
when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr")
- name: Optimize script for MySQL - name: Optimize script for MySQL
copy: copy:
src: mysql-optimize.sh src: mysql-optimize.sh
@ -82,12 +88,8 @@
# my-add.sh # my-add.sh
- name: Install apg - include: remount_usr_rw.yml
apt: when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr")
name: apg
tags:
- mysql
- packages
- name: Ensure /usr/share/scripts exists - name: Ensure /usr/share/scripts exists
file: file:
@ -104,3 +106,10 @@
mode: "0700" mode: "0700"
tags: tags:
- mysql - mysql
- name: Install apg
apt:
name: apg
tags:
- mysql
- packages