瀏覽代碼

Added pillar option to redirect profile and map folders.

tags/v0.57.0
Andrew Vant 9 年之前
父節點
當前提交
fb1d7e8d3b
共有 2 個文件被更改,包括 15 次插入11 次删除
  1. +6
    -0
      pillar.example
  2. +9
    -11
      salt/cloud.sls

+ 6
- 0
pillar.example 查看文件

@@ -82,6 +82,12 @@ salt:
- cloud.providers.d/key
- cloud.profiles.d
- cloud.maps.d

# You can take profile and map templates from an alternate location
# if desired.
profiles_src: salt://templates/cloud.profiles.d
maps_src: salt://templates/cloud.maps.d

providers:
- ec2
- gce

+ 9
- 11
salt/cloud.sls 查看文件

@@ -60,21 +60,19 @@ cloud-cert-{{ cert }}-pem:
{% endfor %}

{% for providers in salt_settings.cloud.providers %}
salt-cloud-profiles-{{ providers }}:
file.managed:
- name: /etc/salt/cloud.profiles.d/{{ providers }}.conf
- template: jinja
- source: salt://salt/files/cloud.profiles.d/{{ providers }}.conf

salt-cloud-providers-{{ providers }}:
file.managed:
- name: /etc/salt/cloud.providers.d/{{ providers }}.conf
- template: jinja
- source: salt://salt/files/cloud.providers.d/{{ providers }}.conf
{% endfor %}

salt-cloud-maps-{{ providers }}:
file.managed:
- name: /etc/salt/cloud.maps.d/{{ providers }}.conf
{%- for dir in ['profiles', 'maps'] %}
{%- set default_src = 'salt://salt/files/cloud.{}.d'.format(dir) %}
{%- set source = salt_settings.cloud.get(dir + "_src", default_src) %}
salt-cloud-{{ dir }}:
file.recurse:
- name: /etc/salt/cloud.{{ dir }}.d
- source: {{ source }}
- template: jinja
- source: salt://salt/files/cloud.maps.d/{{ providers }}.conf
{% endfor %}
{%- endfor %}

Loading…
取消
儲存