lvm-lv: Fix role, make it usable by adding "lvm_lv_mountpoint"
authorAlexander Barton <alexander.barton@tomas-daily.de>
Tue, 27 Feb 2018 10:46:56 +0000 (11:46 +0100)
committerAlexander Barton <alexander.barton@tomas-daily.de>
Tue, 27 Feb 2018 10:46:56 +0000 (11:46 +0100)
Up to now, the LVM LV became always mounted on /var/lib/mysql which
doesn't make sense (in most cases), silly me ...

Update mysql-server & postgresql.server roles accordingly.

roles/lvm-lv/defaults/main.yml
roles/lvm-lv/tasks/main.yml
roles/mysql-server/tasks/main.yml
roles/postgresql-server/tasks/main.yml

index bda9a34..37e220a 100644 (file)
@@ -4,3 +4,4 @@
 lvm_vg: ""
 lvm_lv_name: ""
 lvm_lv_size: "50g"
+lvm_lv_mountpoint: ""
index 5c0f216..37ec171 100644 (file)
     opts="-L {{ lvm_lv_name }}"
     resizefs=yes
 
-- name: create mount point "/var/lib/mysql"
+- name: create mount point "{{ lvm_lv_mountpoint }}"
   tags:
     - fs
   file: >
-    path=/var/lib/mysql
+    path={{ lvm_lv_mountpoint }}
     state=directory
 
 - name: configure and mount MySQL partition "{{ lvm_lv_name }}"
@@ -36,7 +36,7 @@
     - mount
   mount: >
     fstype=ext4
-    name=/var/lib/mysql
+    name={{ lvm_lv_mountpoint }}
     src=/dev/{{ lvm_vg }}/{{ lvm_lv_name }}
     state=mounted
     opts=rw,errors=remount-ro,noatime
index 6dc9095..046e76f 100644 (file)
@@ -11,7 +11,8 @@
     lvm_vg: "{{ mysql_server_vg }}"
     lvm_lv_name: "{{ mysql_server_lv_name }}"
     lvm_lv_size: "{{ mysql_server_lv_size }}"
-  when: mysql_server_vg != ""
+    lvm_lv_mountpoint: "/var/lib/mysql"
+  when: mysql_server_vg != "" and mysql_server_lv_name != ""
 
 - name: install MySQL packages for client and server
   tags:
index 7fc8bd8..0efa555 100644 (file)
@@ -11,7 +11,8 @@
     lvm_vg: "{{ postgresql_server_vg }}"
     lvm_lv_name: "{{ postgresql_server_lv_name }}"
     lvm_lv_size: "{{ postgresql_server_lv_size }}"
-  when: postgresql_server_vg != ""
+    lvm_lv_mountpoint: "/var/lib/postgresql"
+  when: postgresql_server_vg != "" and postgresql_server_lv_name != ""
 
 - name: install PostgreSQL {{ postgresql_major }} packages for client and server
   tags: