Book Image

Salt Cookbook

By : Anirban Saha
Book Image

Salt Cookbook

By: Anirban Saha

Overview of this book

Table of Contents (18 chapters)
Salt Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Working with disks and mounts


Working with disks, configuring their mount points, and gathering useful data about them at times of emergency are some of the most critical tasks in system management. In this recipe, you will learn how Salt helps us perform all of these tasks efficiently.

How to do it...

We will use the same minion and logical volume configured in the previous recipe.

  1. Create a new state directory called disk.

  2. Create and edit /opt/salt-cookbook/staging/disk/format.sls to have the following entries:

    include:
      - lvm
    
    backup_volume:
      blockdev.formatted:
        - name: /dev/backup_vg/backup_lv
        - fs_type: ext4
        - require:
          - lvm: backup_lv
  3. Create and edit /opt/salt-cookbook/staging/disk/mount.sls to have the following entries:

    include:
      - disk.format
    
    backup_mount:
      mount.mounted:
        - name: /backup
        - device: /dev/backup_vg/backup_lv
        - fstype: ext4
        - mkmnt: True
        - opts: defaults
        - persist: True
        - mount: True
        - dump: 0
        - pass_num: 0
        - require...