|
@@ -0,0 +1,54 @@
|
|
|
|
|
+---
|
|
|
|
|
+- name: Ensure Apache Storage Configuration
|
|
|
|
|
+ hosts: webservers
|
|
|
|
|
+ vars_files:
|
|
|
|
|
+ - storage_vars.yml
|
|
|
|
|
+ tasks:
|
|
|
|
|
+ - name: correct partitions in /dev/vdb
|
|
|
|
|
+ parted:
|
|
|
|
|
+ device: /dev/vdb
|
|
|
|
|
+ state: present
|
|
|
|
|
+ number: "{{ item.number }}"
|
|
|
|
|
+ part_start: "{{ item.start }}"
|
|
|
|
|
+ part_end: "{{ item.end }}"
|
|
|
|
|
+ loop: "{{ partitions }}"
|
|
|
|
|
+
|
|
|
|
|
+ - name: Ensure Volume Groups Exist
|
|
|
|
|
+ lvg:
|
|
|
|
|
+ vg: "{{ item.name }}"
|
|
|
|
|
+ pvs: "{{ item.devices }}"
|
|
|
|
|
+ loop: "{{ volume_groups }}"
|
|
|
|
|
+
|
|
|
|
|
+ - name: Create each Logical Volume (LV) if needed
|
|
|
|
|
+ lvol:
|
|
|
|
|
+ vg: "{{ item.vgroup }}"
|
|
|
|
|
+ lv: "{{ item.name }}"
|
|
|
|
|
+ size: "{{ item.size }}"
|
|
|
|
|
+ loop: "{{ logical_volumes }}"
|
|
|
|
|
+ when: item.name not in ansible_lvm["lvs"]
|
|
|
|
|
+
|
|
|
|
|
+ - name: Ensure XFS Filesystem exists on each LV
|
|
|
|
|
+ filesystem:
|
|
|
|
|
+ dev: "/dev/{{item.vgroup }}/{{ item.name }}"
|
|
|
|
|
+ fstype: xfs
|
|
|
|
|
+ loop: "{{ logical_volumes }}"
|
|
|
|
|
+
|
|
|
|
|
+ - name: Ensure the correct capacity for each LV
|
|
|
|
|
+ lvol:
|
|
|
|
|
+ vg: "{{ item.vgroup }}"
|
|
|
|
|
+ lv: "{{ item.name }}"
|
|
|
|
|
+ size: "{{ item.size }}"
|
|
|
|
|
+ resizefs: yes
|
|
|
|
|
+ force: yes
|
|
|
|
|
+ loop: "{{ logical_volumes }}"
|
|
|
|
|
+
|
|
|
|
|
+ - name: Each Logical Volume is mounted
|
|
|
|
|
+ mount:
|
|
|
|
|
+ path: "{{ item.mount_path }}"
|
|
|
|
|
+ src: "/dev/{{ item.vgroup }}/{{ item.name}}"
|
|
|
|
|
+ fstype: xfs
|
|
|
|
|
+ opts: noatime
|
|
|
|
|
+ state: mounted
|
|
|
|
|
+ loop: "{{ logical_volumes }}"
|
|
|
|
|
+
|
|
|
|
|
+
|