Saltstack Official Linux Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

67 行
1.5KB

  1. {%- from "linux/map.jinja" import storage with context %}
  2. {%- if storage.enabled %}
  3. linux_lvm_pkgs:
  4. pkg.installed:
  5. - pkgs: {{ storage.lvm_pkgs }}
  6. {%- for vgname, vg in storage.lvm.iteritems() %}
  7. {%- if vg.get('enabled', True) %}
  8. {%- for dev in vg.devices %}
  9. lvm_{{ vg.get('name', vgname) }}_pv_{{ dev }}:
  10. lvm.pv_present:
  11. - name: {{ dev }}
  12. - require:
  13. - pkg: linux_lvm_pkgs
  14. - require_in:
  15. - lvm: lvm_vg_{{ vg.get('name', vgname) }}
  16. {%- endfor %}
  17. lvm_vg_{{ vg.get('name', vgname) }}:
  18. lvm.vg_present:
  19. - name: {{ vg.get('name', vgname) }}
  20. - devices: {{ vg.devices|join(',') }}
  21. {%- for lvname, volume in vg.get('volume', {}).iteritems() %}
  22. lvm_{{ vg.get('name', vgname) }}_lv_{{ volume.get('name', lvname) }}:
  23. lvm.lv_present:
  24. - name: {{ volume.get('name', lvname) }}
  25. - vgname: {{ vg.get('name', vgname) }}
  26. - size: {{ volume.size }}
  27. - require:
  28. - lvm: lvm_vg_{{ vg.get('name', vgname) }}
  29. {%- if volume.mount is defined %}
  30. - require_in:
  31. - mount: {{ volume.mount.path }}
  32. {%- if not volume.mount.get('file_system', None) in ['nfs', 'nfs4', 'cifs', 'tmpfs', None] %}
  33. - cmd: mkfs_{{ volume.mount.device}}
  34. {%- endif %}
  35. {%- endif %}
  36. {%- endfor %}
  37. {%- endif %}
  38. {%- endfor %}
  39. /etc/lvm/lvm.conf:
  40. file.managed:
  41. - source: salt://linux/files/lvm.conf
  42. - template: jinja
  43. - require:
  44. - pkg: linux_lvm_pkgs
  45. lvm_services:
  46. service.running:
  47. - enable: true
  48. - names: {{ storage.lvm_services }}
  49. - require:
  50. - file: /etc/lvm/lvm.conf
  51. - watch:
  52. - file: /etc/lvm/lvm.conf
  53. {%- endif %}