Saltstack Official Salt Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 satır
2.3KB

  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.use_pip %}
  21. - require:
  22. - pip: salt-cloud-pip-packages
  23. {%- endif %}
  24. {% endif %}
  25. {% for cert in pillar.get('salt_cloud_certs', {}) %}
  26. {% for type in ['pem'] %}
  27. cloud-cert-{{ cert }}-pem:
  28. file.managed:
  29. - name: {{ salt_settings.config_path }}/pki/cloud/{{ cert }}.pem
  30. - source: salt://{{ slspath }}/files/key
  31. - template: jinja
  32. - user: root
  33. - group:
  34. {%- if grains['kernel'] in ['FreeBSD', 'OpenBSD', 'NetBSD'] %}
  35. wheel
  36. {%- else %}
  37. root
  38. {%- endif %}
  39. - mode: 600
  40. - makedirs: True
  41. - defaults:
  42. key: {{ cert }}
  43. type: {{ type }}
  44. {% endfor %}
  45. {% endfor %}
  46. {% for cloud_section in ["maps", "profiles", "providers"] %}
  47. salt-cloud-{{ cloud_section }}:
  48. file.recurse:
  49. - name: {{ salt_settings.config_path }}/cloud.{{ cloud_section }}.d
  50. - source: {{ salt_settings.cloud.template_sources[cloud_section] }}
  51. - template: jinja
  52. - makedirs: True
  53. - exclude_pat: _*
  54. {% for filename in salt['pillar.get']("salt:cloud:" ~ cloud_section, {}).keys() %}
  55. /etc/salt/cloud.{{ cloud_section }}.d/{{ filename }}:
  56. file.serialize:
  57. - dataset_pillar: salt:cloud:{{ cloud_section }}:{{ filename }}
  58. - formatter: yaml
  59. - require:
  60. - file: salt-cloud-{{ cloud_section }}
  61. {%- if cloud_section == "providers" %}
  62. - require_in:
  63. - file: salt-cloud-providers-permissions
  64. {%- endif %}
  65. {% endfor %}
  66. {% endfor %}
  67. salt-cloud-providers-permissions:
  68. file.directory:
  69. - name: {{ salt_settings.config_path }}/cloud.providers.d
  70. - user: root
  71. - group:
  72. {%- if grains['kernel'] in ['FreeBSD', 'OpenBSD', 'NetBSD'] %}
  73. wheel
  74. {%- else %}
  75. root
  76. {%- endif %}
  77. - file_mode: 600
  78. - dir_mode: 700
  79. - recurse:
  80. - user
  81. - group
  82. - mode
  83. - require:
  84. - file: salt-cloud-providers