nilsmeyer / ansible-debootstrap

An ansible role for bootstrapping new Debian based systems, including setting up partitions, file systems, encryption (luks), RAID and LVM
GNU Lesser General Public License v3.0
35 stars 19 forks source link

Added ability to use compaction for multiple devices with similar par… #43

Closed mvk15 closed 1 year ago

mvk15 commented 1 year ago

Have a server with 12 disks in software raid. Was needed to use 12 stanzas - 1 for every disk for describing disk partitions:

  - device: '/dev/sda'
    partitions:
      - {'num': '1', 'size':  '2M', 'type': 'ef02'}  # /dev/sda1
      - {'num': '2', 'size': '64M', 'type': '8300'}  # /dev/sda2
      - {'num': '3',                'type': '8300'}  # /dev/sda3
    skip_grub: False
  ---%<---- cut ----->%---
  - device: '/dev/sdl'
    partitions:
      - {'num': '1', 'size':  '2M', 'type': 'ef02'}  # /dev/sdl1
      - {'num': '2', 'size': '64M', 'type': '8300'}  # /dev/sdl2
      - {'num': '3',                'type': '8300'}  # /dev/sdl3
    skip_grub: False

After the change is needed only one stanza:

  - device: ['/dev/sda','/dev/sdb','/dev/sdc','/dev/sdd','/dev/sde','/dev/sdf','/dev/sdg','/dev/sdh','/dev/sdi','/dev/sdj','/dev/sdk','/dev/sdl']
    partitions:
      - {'num': '1', 'size':  '2M', 'type': 'ef02'}  # /dev/sd[a-l]1
      - {'num': '2', 'size': '64M', 'type': '8300'}  # /dev/sd[a-l]2
      - {'num': '3',                'type': '8300'}  # /dev/sd[a-l]3
    skip_grub: False
nilsmeyer commented 1 year ago

Very good idea, thank you for the PR.