Skip to content

Instantly share code, notes, and snippets.

@kevinastone
Created October 21, 2013 21:45
Show Gist options
  • Save kevinastone/7091553 to your computer and use it in GitHub Desktop.
Save kevinastone/7091553 to your computer and use it in GitHub Desktop.
Macro for mounting devices for Salt Stack.
{% macro mount_device(app, device, dir) -%}
{{ app }}-formatted:
cmd.run:
- name: "mkfs.ext4 /dev/{{ device }}"
- unless: "file -sL /dev/{{ device }} | grep -q ext4"
{{ app }}-mounted:
mount.mounted:
- name: "{{ dir }}"
- device: /dev/{{ device }}
- fstype: ext4
- mkmnt: true
- require:
- cmd: {{ app }}-formatted
{%- endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment