zaxos.lvm-ansible-role

lvm-ansible-role

This is an Ansible role designed to create and mount single LVM (Logical Volume Manager) volumes.

Requirements

  • CentOS/RHEL 7
  • Ansible version 2.5 or higher

Installation

To install the role, use the following command:

$ ansible-galaxy install zaxos.lvm-ansible-role

Example Playbook

Here’s an example of how to use the role in a playbook:

- hosts: servers
  vars:
    lvm_volumes:
    - vg_name: vg_data
      lv_name: lv_data
      disk: sdb
      filesystem: xfs
      mount: /mnt
            
  roles:
    - role: zaxos.lvm-ansible-role

Example Volume Configuration

Here’s how to configure a volume:

- vg_name: vg_data  # (Required) Name of the volume group.
  lv_name: lv_data  # (Required) Name of the logical volume.
  disk: sdb        # (Required) The disk to use.
  filesystem: xfs  # (Optional) Filesystem type; defaults to 'xfs'.
  filesystem_mkfs_opts: "-n ftype=1"  # (Optional) Additional options for creating the filesystem.
  mount: /mnt      # (Required) Mount point for the volume.
  state: present/absent  # (Optional) Default is 'present'; set to 'absent' to remove.
  lv_size: 100%VG  # (Optional) Size of the logical volume; default is '100%VG'.
  create_partition: False  # (Optional) Default is 'False'; set to 'True' to create a GPT partition before creating the volume group.
  mounted: True   # (Optional) Default is 'True'; set to 'False' to unmount the volume.
  owner: "root"   # (Optional) Default owner is "root".
  group: "root"   # (Optional) Default group is "root".
  mode: "0644"    # (Optional) Default mode is "0755".
  mount_options: defaults  # (Optional) Default options for mounting.

Role Variables

Here are some important variables to consider:

  • lvm_volumes: A list of volumes to manage.
  • lvm_auto_remount: Default is "True". If this is "True", when the mount path of a volume is changed, the old mount path will be automatically unmounted and removed from the fstab file.
Informazioni sul progetto

Ansible role to create and mount single lvm volumes

Installa
ansible-galaxy install zaxos.lvm-ansible-role
Licenza
gpl-2.0
Download
25.2k
Proprietario