mrlesmithjr/ansible-manage-lvm

Enhancement request

Closed this issue · 5 comments

Hi,

Thanks for a great ansible role, very useful! However there is one feature that I'd like to have included. The ability to partition the disks. As it is now the role is assuming the disks are partitioned and ready to be used.

Perhaps the variable declaration could look something like this:

- hosts: test-nodes
  vars:
    lvm_groups:
      - vgname: test-vg
        disks:
          - device: /dev/sdb
            number: 1
          - device: /dev/sdc
            number: 2
        create: true
        lvnames:
          - lvname: test_1
            size: 5g
            create: true
            filesystem: ext4
            mount: true
            mntp: /mnt/test_1
          - lvname: test_2
            size: 10g
            create: true
            filesystem: ext4
            mount: true
            mntp: /mnt/test_2
    manage_lvm: true
    pri_domain_name: 'test.vagrant.local'
  roles:
    - role: ansible-manage-lvm
  tasks:

and corresponding part in the role:

- name: Partition disk
  parted:
    device: "{{ item.1.device }}"
    number: "{{ item.1.number }}"
    flags: [lvm]
    state: present
  with_subelements:
    - "{{ lvm_groups }}"
    - disks
  register: parted

Unfortunately I dont know how to create a list out of that to be used by the pvs option in the lvg module.

Regards,

/Johan

@markgoddard Thoughts on this one?

@mrlesmithjr IMHO I would go with the unix philosophy here and keep this role for LVM. Other roles exist for partitioning, if a good one were found it could be recommended in the README of this role. That's just my 2 cents though.

@markgoddard Exactly what my thoughts were as well. @johsod Now it looks like I have another role to create when time permits.

One or more roles doesn't really matter I guess. My idea was to not have to specify the disk and partition information twice, but I guess a new role could leverage from variable declaration for ansible-manage-lvm.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.