Saltstack Official Linux Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

67 líneas
1.6KB

  1. {%- from "linux/map.jinja" import storage with context %}
  2. {%- if storage.enabled %}
  3. parted:
  4. pkg.installed
  5. xfsprogs:
  6. pkg.installed
  7. {%- for disk_name, disk in storage.disk.iteritems() %}
  8. {%- set disk_name = disk.name|default(disk_name) %}
  9. create_disk_label_{{ disk_name }}:
  10. module.run:
  11. - name: partition.mklabel
  12. - device: {{ disk_name }}
  13. - label_type: {{ disk.get('type', 'dos') }}
  14. - unless: "fdisk -l {{ disk_name }} | grep -i 'Disklabel type: {{ disk.get('type', 'dos') }}'"
  15. - require:
  16. - pkg: parted
  17. {% set end_size = 0 -%}
  18. {%- for partition in disk.get('partitions', []) %}
  19. create_partition_{{ disk_name }}_{{ loop.index }}:
  20. module.run:
  21. - name: partition.mkpart
  22. - device: {{ disk_name }}
  23. - part_type: primary
  24. - fs_type: {{ partition.type }}
  25. - start: {{ end_size }}MB
  26. - end: {{ end_size + partition.size }}MB
  27. - unless: "blkid {{ disk_name }}{{ loop.index }} {{ disk_name }}p{{ loop.index }}"
  28. - require:
  29. - module: create_disk_label_{{ disk_name }}
  30. - pkg: xfsprogs
  31. {% set end_size = end_size + partition.size -%}
  32. {%- endfor %}
  33. probe_partions_{{ disk_name }}:
  34. module.run:
  35. - name: partition.probe
  36. - device: {{ disk_name }}
  37. {%- for partition in disk.get('partitions', []) %}
  38. {%- if partition.get('mkfs') and partition.type == "xfs" %}
  39. mkfs_partition_{{ disk_name }}_{{ loop.index }}:
  40. module.run:
  41. - name: xfs.mkfs
  42. - device: {{ disk_name }}{{ loop.index }}
  43. - unless: "blkid {{ disk_name }}{{ loop.index }} {{ disk_name }}p{{ loop.index }} | grep xfs"
  44. - require:
  45. - module: create_partition_{{ disk_name }}_{{ loop.index }}
  46. {%- endif %}
  47. {%- endfor %}
  48. {%- endfor %}
  49. {%- endif %}