Skip to content

Instantly share code, notes, and snippets.

@shallot
Created March 9, 2017 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shallot/5089f6f0f12c1b0eb4961bfb00eaadf0 to your computer and use it in GitHub Desktop.
Save shallot/5089f6f0f12c1b0eb4961bfb00eaadf0 to your computer and use it in GitHub Desktop.
/mnt/home:
mount.mounted:
- name: /mnt/home
- device: LABEL=home
- fstype: ext4
- mkmnt: True
- persist: False
- mount: True
- unless:
- mountpoint -q /home
home_copy:
cmd.run:
- onchanges:
- mount: /mnt/home
- name: 'cp -av /home/* /mnt/home/ | wc -l'
- unless:
- test "$(find /mnt/home/ -mindepth 1 -maxdepth 1 ! -name lost+found | sort)" = "$(find /home/ -mindepth 1 -maxdepth 1 ! -name lost+found | sort)"
/home:
mount.mounted:
- device: LABEL=home
- fstype: ext4
- mkmnt: True
- opts: defaults,nobootwait
- pass_num: 2
- persist: True
- mount: True
- require:
- home_copy
/mnt/home_umount:
mount.unmounted:
- name: /mnt/home
- onlyif:
- mountpoint -q /mnt/home
- require:
- /home
file.absent:
- name: /mnt/home
- require:
- /home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment