storage

storage

Ansible role to setup and maintain storage configuration.

Requirements

Target systems with Logical Volume Manager (LVM) available.

Role Variables

  • storage_conf Defines the storage configuration (see example below)
    • mandatory variables :
      • vg_name : Volume Group name. Will be created if inexistent.
      • lv_name : Logical Volume name.
      • lv_size : Logical Volume size. LV and underlying FS (filesystem) will be resized if value is greater than current size.
    • non mandatory variables :
      • pvs : Physical VolumeS. List of comma-separated devices to use as physical devices in the volume group. PV is created if necessary via the Ansible module 'lvg'.
      • fs_type : FS type
      • _fs_src : The filesystem source (UUID=..., LABEL=..., PARTUUID=...). If undefined, defaults to /dev/mapper/vg_name-lv_name.
      • fs_mountpoint : The mountpoint for this FS.
      • fs_mountoptions : The mount options for this FS.
      • fs_dump : The dump number for this FS (0 by default).
      • fs_passno : The passno number for this FS (0 by default).

Example :

storage_conf:
  - pvs: '/dev/sda3'
    vg_name: 'sys'
    lv_name: 'root'
    lv_size: '12G'
    fs_src: 'UUID=098bc92e-f20f-425b-b73e-a161aa0c0e9e'
    fs_type: 'xfs'
    fs_mountpoint: '/'
  - pvs: '/dev/sdb, /dev/sdc'
    vg_name: 'data'
    lv_name: 'mydata'
    lv_size: '16G'
    fs_type: 'xfs'
    fs_mountpoint: '/srv/stuff'
  # here we don't care about the PV distribution
  - vg_name: 'data'
    lv_name: 'ftp'
    lv_size: '11G'
    fs_type: 'xfs'
    fs_mountpoint: '/srv/ftp'
    fs_mountoptions: 'noatime,nosuid'
  # here we just create an unformated and unmounted LV
  - vg_name: 'data'
    lv_name: 'bigdata'
    lv_size: '800G'

Dependencies

None.

Install this role as submodule in a git repository

git submodule add https://git.sekoya.org/mb/storage.git roles/storage

Example Playbook

- hosts: servers
  roles:
     - storage

or

- hosts: servers
  roles:
     - { role: storage, when: storage_conf is defined }

License

GPLv3

Author Information

http://www.sekoya.org

Install
ansible-galaxy install mbocquet/storage
GitHub repository
License
agpl-3.0
Downloads
27