Saltstack Official Salt Formula
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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