Saltstack Official Salt Formula
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

111 Zeilen
2.6KB

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