Saltstack Official Linux Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

39 lines
974B

  1. {%- from "linux/map.jinja" import storage with context %}
  2. {%- if storage.enabled %}
  3. parted:
  4. pkg.installed
  5. {%- for disk_name, disk in storage.disk.iteritems() %}
  6. {%- if disk.type is defined %}
  7. create_disk_label:
  8. module.run:
  9. - name: partition.mklabel
  10. - device: {{ disk.name|default(disk_name) }}
  11. - label_type: {{ disk.get('type', 'gpt') }}
  12. - unless: fdisk -l | grep {{ disk.get('type', 'gpt') }}
  13. {%- endif %}
  14. {% set end_size = 0 -%}
  15. {%- for partition in disk.get('partitions', []) %}
  16. {%- if not salt['partition.exists'](disk.get('name', disk_name)+'p'~loop.index) %}
  17. create_partition_{{ disk.name|default(disk_name) }}_{{ loop.index }}:
  18. module.run:
  19. - name: partition.mkpart
  20. - device: {{ disk.name|default(disk_name) }}
  21. - part_type: primary
  22. - fs_type: {{ partition.type }}
  23. - start: {{ end_size }}MB
  24. - end: {{ end_size + partition.size }}MB
  25. {%- endif %}
  26. {% set end_size = end_size + partition.size -%}
  27. {%- endfor %}
  28. {%- endfor %}
  29. {%- endif %}