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
- include: remount_usr_rw.yml
when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr")
- name: Install mysqltuner
copy:
src: mysqltuner.pl
@ -47,6 +50,9 @@
# 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
@ -82,12 +88,8 @@
# my-add.sh
- name: Install apg
apt:
name: apg
tags:
- mysql
- packages
- include: remount_usr_rw.yml
when: (mysql_scripts_dir or general_scripts_dir) | search ("/usr")
- name: Ensure /usr/share/scripts exists
file:
@ -104,3 +106,10 @@
mode: "0700"
tags:
- mysql
- name: Install apg
apt:
name: apg
tags:
- mysql
- packages