Parcourir la source

Merge pull request #305 from EvaSDK/salt-cloud-cleanups

salt-cloud handling cleanups
tags/v0.57.0
Nitin Madhok il y a 7 ans
Parent
révision
eb09c3bdc6
13 fichiers modifiés avec 26 ajouts et 45 suppressions
  1. +26
    -45
      salt/cloud.sls
  2. +0
    -0
      salt/files/cloud.maps.d/_ec2.conf
  3. +0
    -0
      salt/files/cloud.maps.d/_gce.conf
  4. +0
    -0
      salt/files/cloud.maps.d/_rsos.conf
  5. +0
    -0
      salt/files/cloud.maps.d/_saltify.conf
  6. +0
    -0
      salt/files/cloud.profiles.d/_ec2.conf
  7. +0
    -0
      salt/files/cloud.profiles.d/_gce.conf
  8. +0
    -0
      salt/files/cloud.profiles.d/_rsos.conf
  9. +0
    -0
      salt/files/cloud.profiles.d/_saltify.conf
  10. +0
    -0
      salt/files/cloud.providers.d/_ec2.conf
  11. +0
    -0
      salt/files/cloud.providers.d/_gce.conf
  12. +0
    -0
      salt/files/cloud.providers.d/_rsos.conf
  13. +0
    -0
      salt/files/cloud.providers.d/_saltify.conf

+ 26
- 45
salt/cloud.sls Voir le fichier

@@ -1,27 +1,17 @@
{% from "salt/map.jinja" import salt_settings with context %}

{% set cloudmaps = salt['pillar.get']('salt:cloud:maps', {}) -%}
{% set cloudprofiles = salt['pillar.get']('salt:cloud:profiles', {}) -%}
{% set cloudproviders = salt['pillar.get']('salt:cloud:providers', {}) -%}

{%- if salt_settings.use_pip %}
python-pip:
pkg.installed

pycrypto:
pip.installed:
- require:
- pkg: python-pip

{% if grains['os_family'] not in ['Debian', 'RedHat'] %}
crypto:
pip.installed:
- require:
- pkg: python-pip
{% endif %}

apache-libcloud:
salt-cloud-pip-packages:
pip.installed:
- pkgs:
- apache-libcloud
{%- if grains['os_family'] not in ['Debian', 'RedHat'] %}
- crypto
{%- endif %}
- pycrypto
- require:
- pkg: python-pip
{%- endif %}
@@ -32,11 +22,7 @@ salt-cloud:
- name: {{ salt_settings.salt_cloud }}
{%- if salt_settings.use_pip %}
- require:
- pip: apache-libcloud
- pip: pycrypto
{% if grains['os_family'] not in ['Debian', 'RedHat'] %}
- pip: crypto
{% endif %}
- pip: salt-cloud-pip-packages
{%- endif %}
{% endif %}

@@ -62,34 +48,27 @@ cloud-cert-{{ cert }}-pem:
{% endfor %}
{% endfor %}

{%- for dir, templ_path in salt_settings.cloud.template_sources.items() %}
salt-cloud-{{ dir }}:
{% for cloud_section in ["maps", "profiles", "providers"] %}
salt-cloud-{{ cloud_section }}:
file.recurse:
- name: {{ salt_settings.config_path }}/cloud.{{ dir }}.d
- source: {{ templ_path }}
- name: {{ salt_settings.config_path }}/cloud.{{ cloud_section }}.d
- source: {{ salt_settings.cloud.template_sources[cloud_section] }}
- template: jinja
- makedirs: True
{%- endfor %}
- exclude_pat: _*

{% for key, value in cloudmaps.items() %}
/etc/salt/cloud.maps.d/{{ key }}:
file.managed:
- contents: |
{{ value|yaml(False) | indent(8) }}
{% endfor %}

{% for key, value in cloudprofiles.items() %}
/etc/salt/cloud.profiles.d/{{ key }}:
file.managed:
- contents: |
{{ value|yaml(False) | indent(8) }}
{% for filename in salt['pillar.get']("salt:cloud:" ~ cloud_section, {}).keys() %}
/etc/salt/cloud.{{ cloud_section }}.d/{{ filename }}:
file.serialize:
- dataset_pillar: salt:cloud:{{ cloud_section }}:{{ filename }}
- formatter: yaml
- require:
- file: salt-cloud-{{ cloud_section }}
{%- if cloud_section == "providers" %}
- require_in:
- file: salt-cloud-providers-permissions
{%- endif %}
{% endfor %}

{% for key, value in cloudproviders.items() %}
/etc/salt/cloud.providers.d/{{ key }}:
file.managed:
- contents: |
{{ value|yaml(False) | indent(8) }}
{% endfor %}

salt-cloud-providers-permissions:
@@ -108,3 +87,5 @@ salt-cloud-providers-permissions:
- user
- group
- mode
- require:
- file: salt-cloud-providers

salt/files/cloud.maps.d/ec2.conf → salt/files/cloud.maps.d/_ec2.conf Voir le fichier


salt/files/cloud.maps.d/gce.conf → salt/files/cloud.maps.d/_gce.conf Voir le fichier


salt/files/cloud.maps.d/rsos.conf → salt/files/cloud.maps.d/_rsos.conf Voir le fichier


salt/files/cloud.maps.d/saltify.conf → salt/files/cloud.maps.d/_saltify.conf Voir le fichier


salt/files/cloud.profiles.d/ec2.conf → salt/files/cloud.profiles.d/_ec2.conf Voir le fichier


salt/files/cloud.profiles.d/gce.conf → salt/files/cloud.profiles.d/_gce.conf Voir le fichier


salt/files/cloud.profiles.d/rsos.conf → salt/files/cloud.profiles.d/_rsos.conf Voir le fichier


salt/files/cloud.profiles.d/saltify.conf → salt/files/cloud.profiles.d/_saltify.conf Voir le fichier


salt/files/cloud.providers.d/ec2.conf → salt/files/cloud.providers.d/_ec2.conf Voir le fichier


salt/files/cloud.providers.d/gce.conf → salt/files/cloud.providers.d/_gce.conf Voir le fichier


salt/files/cloud.providers.d/rsos.conf → salt/files/cloud.providers.d/_rsos.conf Voir le fichier


salt/files/cloud.providers.d/saltify.conf → salt/files/cloud.providers.d/_saltify.conf Voir le fichier


Chargement…
Annuler
Enregistrer