raid-array: Add PB to create md arrays
The `raid-array.yml` playbook can create Linux *md* software RAID arrays using the `mdadm` command. Two variables are required: `md_name` and `raid_disks`. The former is a string name for the array. The latter is an array of paths of block devices to add to the array.frigate-exporter
parent
b6cc83ad82
commit
459d58bfb6
|
@ -0,0 +1,31 @@
|
||||||
|
- hosts: minio-backups
|
||||||
|
gather_facts: true
|
||||||
|
tasks:
|
||||||
|
- name: ensure mdadm is installed
|
||||||
|
package:
|
||||||
|
name: mdadm
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
- name: ensure usb hdd partitions are removed
|
||||||
|
command:
|
||||||
|
wipefs -fa {{ item }}
|
||||||
|
args:
|
||||||
|
removes: '{{ item }}-part1'
|
||||||
|
loop: '{{ raid_disks }}'
|
||||||
|
tags:
|
||||||
|
- wipefs
|
||||||
|
- name: ensure md raid array exists
|
||||||
|
command: >-
|
||||||
|
systemd-cat -t mdadm
|
||||||
|
mdadm --create --run
|
||||||
|
--name={{ md_name }}
|
||||||
|
--level=raid1
|
||||||
|
--raid-devices=2
|
||||||
|
/dev/md/{{ md_name }}
|
||||||
|
{{ raid_disks | join(' ') }}
|
||||||
|
args:
|
||||||
|
creates: /dev/disk/by-id/md-name-{{ md_name }}
|
||||||
|
tags:
|
||||||
|
- mdadm
|
||||||
|
- mdadm-create
|
Loading…
Reference in New Issue