Saltstack Official Linux Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. {% if disk.get('startsector', None) %}
  19. {% set end_size = disk.get('startsector')|int %}
  20. {% endif %}
  21. {%- for partition in disk.get('partitions', []) %}
  22. create_partition_{{ disk_name }}_{{ loop.index }}:
  23. module.run:
  24. - name: partition.mkpart
  25. - device: {{ disk_name }}
  26. - part_type: primary
  27. - fs_type: {{ partition.type }}
  28. - start: {{ end_size }}MB
  29. - end: {{ end_size + partition.size }}MB
  30. - unless: "blkid {{ disk_name }}{{ loop.index }} {{ disk_name }}p{{ loop.index }}"
  31. - require:
  32. - module: create_disk_label_{{ disk_name }}
  33. - pkg: xfsprogs
  34. {% set end_size = end_size + partition.size -%}
  35. {%- endfor %}
  36. probe_partions_{{ disk_name }}:
  37. module.run:
  38. - name: partition.probe
  39. - device: {{ disk_name }}
  40. {%- for partition in disk.get('partitions', []) %}
  41. {%- if partition.get('mkfs') and partition.type == "xfs" %}
  42. mkfs_partition_{{ disk_name }}_{{ loop.index }}:
  43. module.run:
  44. - name: xfs.mkfs
  45. - device: {{ disk_name }}{{ loop.index }}
  46. - unless: "blkid {{ disk_name }}{{ loop.index }} {{ disk_name }}p{{ loop.index }} | grep xfs"
  47. - require:
  48. - module: create_partition_{{ disk_name }}_{{ loop.index }}
  49. {%- endif %}
  50. {%- endfor %}
  51. {%- endfor %}
  52. {%- endif %}