ahuffman.lvm

Ansible Role

ahuffman.lvm

This tool sets up Logical Volume Groups (VGs), Logical Volumes (LVs), filesystems, mount points, and the fstab configuration.

Variables

Variable Name Description Required Default Value Type
lvm_vgs Defines logical volume groups yes [{}] list of dictionaries.
lvm_lvs Defines details of logical volumes, including filesystem, permissions, and mount points yes [{}] list of dictionaries.

lvm_vgs Parameters and Usage

lvm_vgs: A list to define multiple Logical Volume Groups

  • name: Name of the Logical Volume Group
  • vg: Name of the volume group you want to create
  • pvs: List of physical volumes used to create the Logical Volume Group
    • /dev/sdb
    • /dev/sdc

lvm_lvs Parameters and Usage

lvm_lvs: A list to define multiple Logical Volumes

  • name: Name of the Logical Volume
  • vg: Volume Group where the Logical Volume will be created
  • lv: Name of the Logical Volume
  • size: Size of the Logical Volume
  • mount: Location where the Logical Volume will be mounted
  • mount_owner: Owner of the mount point
  • mount_group: Group ownership of the mount point
  • mount_mode: Permissions for the mount point
  • mount_dump: Indicates if the filesystem should be backed up (5th column in /etc/fstab)
  • mount_passno: Filesystem check number (6th column in /etc/fstab)
  • mount_opts: Options for mounting, like defaults
  • fstype: Type of filesystem for the Logical Volume

Example Playbook

- name: "Set up standard disk layout"
  hosts: "servers"
  roles:
    - role: "ahuffman.lvm"
      lvm_vgs:
        - name: "vg1"
          vg: "vg_myvg1"
          pvs:
            - "/dev/sdb"
            - "/dev/sdc"
        - name: "vg2"
          vg: "vg_myvg2"
          pvs:
            - "/dev/sdd"
      lvm_lvs:
        - name: "Data Volume"
          vg: "vg_myvg1"
          lv: "lv_data"
          size: "25g"
          mount: "/data/mydata"
          mount_owner: "root"
          mount_group: "root"
          mount_mode: "0755"
          mount_dump: "1"
          mount_passno: "2"
          mount_opts: "defaults"
          fstype: "xfs"
        - name: "Web Content"
          vg: "vg_myvg2"
          lv: "lv_www"
          size: "20g"
          mount: "/data/www"
          mount_owner: "root"
          mount_group: "root"
          mount_mode: "0755"
          mount_dump: "1"
          mount_passno: "2"
          mount_opts: "defaults"
          fstype: "xfs"
        - name: "Temporary Space"
          vg: "vg_myvg1"
          lv: "lv_temp"
          size: "35g"
          mount: "/temp"
          mount_owner: "root"
          mount_group: "root"
          mount_mode: "0755"
          mount_dump: "1"
          mount_passno: "2"
          mount_opts: "defaults"
          fstype: "xfs"

License

MIT

Author Information

Andrew Huffman

Informazioni sul progetto

An Ansible Role to create Logical Volume Groups, Logical Volumes, filesystems, mountpoints, etc.

Installa
ansible-galaxy install ahuffman.lvm
Licenza
mit
Download
16.1k
Proprietario