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

cloud.sls 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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: root
  45. - mode: 600
  46. - makedirs: True
  47. - defaults:
  48. key: {{ cert }}
  49. type: {{ type }}
  50. {% endfor %}
  51. {% endfor %}
  52. {%- for dir, templ_path in salt_settings.cloud.template_sources.items() %}
  53. salt-cloud-{{ dir }}:
  54. file.recurse:
  55. - name: {{ salt_settings.config_path }}/cloud.{{ dir }}.d
  56. - source: {{ templ_path }}
  57. - template: jinja
  58. - makedirs: True
  59. {%- endfor %}
  60. {% for key, value in cloudmaps.items() %}
  61. /etc/salt/cloud.maps.d/{{ key }}:
  62. file.managed:
  63. - contents: |
  64. {{ value|yaml(False) | indent(8) }}
  65. {% endfor %}
  66. {% for key, value in cloudprofiles.items() %}
  67. /etc/salt/cloud.profiles.d/{{ key }}:
  68. file.managed:
  69. - contents: |
  70. {{ value|yaml(False) | indent(8) }}
  71. {% endfor %}
  72. {% for key, value in cloudproviders.items() %}
  73. /etc/salt/cloud.providers.d/{{ key }}:
  74. file.managed:
  75. - contents: |
  76. {{ value|yaml(False) | indent(8) }}
  77. {% endfor %}
  78. salt-cloud-providers-permissions:
  79. file.directory:
  80. - name: {{ salt_settings.config_path }}/cloud.providers.d
  81. - user: root
  82. - group: root
  83. - file_mode: 600
  84. - dir_mode: 700
  85. - recurse:
  86. - user
  87. - group
  88. - mode