Ansible playbook to create logical volumes under LVM on Redhat or CentOS linux.

Let us have a look at another ansible playbook which will create various logical volumes under LVM.

The playbook is not complete in the sense that roles text is not disclosed.

Roles helps us to separate/modularize the data and help us to re-use the data code parts whenever necessary.

However still it will help you to identify how the VG and LV partitioning can be mentioned in ansible playbooks.

---
- hosts:
    - dev
    - test
  roles:
    - mysqld
    - common

- hosts: prod-wellness
  vars:
    mysql_vg: vg_root
    prod_vg_lv_mapping:
      - { vg_name: vg_root, lv_name: lv_mysql, lv_size: 40G, lv_mount: /home/mysqld  }
      - { vg_name: vg_wellness_prod, lv_name: lv_wellness_prod_data, lv_size: 100G, lv_mount: /mydata/wellness_prod/data }
      - { vg_name: vg_newweb_prod, lv_name: lv_newweb_prod_data, lv_size: 200G, lv_mount: /mydata/newweb_prod/data }
      - { vg_name: vg_dbdump, lv_name: vg_dbdump, lv_size: 50G, lv_mount: /dbdump }
  roles:
    - common
    - mysqld

- hosts: prod-India-hosts
  vars:
    mysql_vg: vg_root
    prod_vg_lv_mapping:
      - { vg_name: vg_root, lv_name: lv_mysql, lv_size: 40G, lv_mount: /home/mysqld  }
      - { vg_name: vg_source_prod, lv_name: lv_source_prod_data, lv_size: 50G, lv_mount: /mydata/source_prod/data }
      - { vg_name: vg_India-hosts_prod, lv_name: lv_India-hosts_prod_data, lv_size: 50G, lv_mount: /mydata/India-hosts_prod/data }
      - { vg_name: vg_dbdump, lv_name: vg_dbdump, lv_size: 50G, lv_mount: /dbdump }
  roles:
    - common
    - mysqld

- hosts: prod-finance
  vars:
    mysql_vg: vg_root
    prod_vg_lv_mapping:
      - { vg_name: vg_root, lv_name: lv_mysql, lv_size: 40G, lv_mount: /home/mysqld  }
      - { vg_name: vg_NGELweb_prod, lv_name: lv_NGELweb_prod_data, lv_size: 50G, lv_mount: /mydata/NGELweb_prod/data }
      - { vg_name: vg_NGELweb6_prod, lv_name: lv_NGELweb6_prod_data, lv_size: 25G, lv_mount: /mydata/NGELweb6_prod/data }
      - { vg_name: vg_NGELweb_exrate_prod, lv_name: lv_NGELweb_exrate_prod_data, lv_size: 25G, lv_mount: /mydata/NGELweb_exrate_prod/data }
      - { vg_name: vg_dbdump, lv_name: vg_dbdump, lv_size: 50G, lv_mount: /dbdump }
  roles:
    - common
    - mysqld
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments