Saltstack Official Salt Formula
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

cloud.sls 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. {% from "salt/map.jinja" import salt_settings with context %}
  2. {%- if salt_settings.use_pip %}
  3. python-pip:
  4. pkg.installed
  5. salt-cloud-pip-packages:
  6. pip.installed:
  7. - pkgs:
  8. - apache-libcloud
  9. {%- if grains['os_family'] not in ['Debian', 'RedHat'] %}
  10. - crypto
  11. {%- endif %}
  12. - pycrypto
  13. - require:
  14. - pkg: python-pip
  15. {%- endif %}
  16. {% if salt_settings.install_packages %}
  17. salt-cloud:
  18. pkg.installed:
  19. - name: {{ salt_settings.salt_cloud }}
  20. {%- if salt_settings.version is defined %}
  21. - version: {{ salt_settings.version }}
  22. {%- endif %}
  23. {%- if salt_settings.use_pip %}
  24. - require:
  25. - pip: salt-cloud-pip-packages
  26. {%- endif %}
  27. {% endif %}
  28. {% for cert in pillar.get('salt_cloud_certs', {}) %}
  29. {% for type in ['pem'] %}
  30. cloud-cert-{{ cert }}-pem:
  31. file.managed:
  32. - name: {{ salt_settings.config_path }}/pki/cloud/{{ cert }}.pem
  33. - source: salt://{{ slspath }}/files/key
  34. - template: jinja
  35. - user: root
  36. - group:
  37. {%- if grains['kernel'] in ['FreeBSD', 'OpenBSD', 'NetBSD'] %}
  38. wheel
  39. {%- else %}
  40. root
  41. {%- endif %}
  42. - mode: 600
  43. - makedirs: True
  44. - defaults:
  45. key: {{ cert }}
  46. type: {{ type }}
  47. {% endfor %}
  48. {% endfor %}
  49. {% for cloud_section in ["maps", "profiles", "providers"] %}
  50. salt-cloud-{{ cloud_section }}:
  51. file.recurse:
  52. - name: {{ salt_settings.config_path }}/cloud.{{ cloud_section }}.d
  53. - source: {{ salt_settings.cloud.template_sources[cloud_section] }}
  54. - template: jinja
  55. - makedirs: True
  56. - exclude_pat: _*
  57. {% for filename in salt['pillar.get']("salt:cloud:" ~ cloud_section, {}).keys() %}
  58. /etc/salt/cloud.{{ cloud_section }}.d/{{ filename }}:
  59. file.serialize:
  60. - dataset_pillar: salt:cloud:{{ cloud_section }}:{{ filename }}
  61. - formatter: yaml
  62. - require:
  63. - file: salt-cloud-{{ cloud_section }}
  64. {%- if cloud_section == "providers" %}
  65. - require_in:
  66. - file: salt-cloud-providers-permissions
  67. {%- endif %}
  68. {% endfor %}
  69. {% endfor %}
  70. salt-cloud-providers-permissions:
  71. file.directory:
  72. - name: {{ salt_settings.config_path }}/cloud.providers.d
  73. - user: root
  74. - group:
  75. {%- if grains['kernel'] in ['FreeBSD', 'OpenBSD', 'NetBSD'] %}
  76. wheel
  77. {%- else %}
  78. root
  79. {%- endif %}
  80. - file_mode: 600
  81. - dir_mode: 700
  82. - recurse:
  83. - user
  84. - group
  85. - mode
  86. - require:
  87. - file: salt-cloud-providers