2015-03-17 05:39:32 +01:00
|
|
|
{% from "salt/map.jinja" import salt_settings with context %}
|
2014-07-20 16:59:38 +02:00
|
|
|
|
|
|
|
python-pip:
|
|
|
|
pkg.installed
|
|
|
|
|
|
|
|
pycrypto:
|
|
|
|
pip.installed:
|
|
|
|
- require:
|
|
|
|
- pkg: python-pip
|
|
|
|
|
2014-11-13 02:56:15 +01:00
|
|
|
{% if grains['os_family'] not in ['Debian', 'RedHat'] %}
|
2014-11-05 20:59:26 +01:00
|
|
|
crypto:
|
|
|
|
pip.installed:
|
|
|
|
- require:
|
|
|
|
- pkg: python-pip
|
2014-11-06 19:33:53 +01:00
|
|
|
{% endif %}
|
2014-11-05 20:59:26 +01:00
|
|
|
|
2014-07-20 16:59:38 +02:00
|
|
|
apache-libcloud:
|
|
|
|
pip.installed:
|
|
|
|
- require:
|
|
|
|
- pkg: python-pip
|
|
|
|
|
2015-03-24 18:08:08 +01:00
|
|
|
{% if salt_settings.install_packages %}
|
2014-07-20 16:59:38 +02:00
|
|
|
salt-cloud:
|
|
|
|
pkg.installed:
|
2015-03-17 05:39:32 +01:00
|
|
|
- name: {{ salt_settings.salt_cloud }}
|
2014-07-20 16:59:38 +02:00
|
|
|
- require:
|
|
|
|
- pip: apache-libcloud
|
|
|
|
- pip: pycrypto
|
2014-11-13 02:56:15 +01:00
|
|
|
{% if grains['os_family'] not in ['Debian', 'RedHat'] %}
|
2014-11-05 20:59:26 +01:00
|
|
|
- pip: crypto
|
2014-11-06 19:33:53 +01:00
|
|
|
{% endif %}
|
2015-03-24 18:08:08 +01:00
|
|
|
{% endif %}
|
2014-07-20 16:59:38 +02:00
|
|
|
|
2015-03-17 05:39:32 +01:00
|
|
|
{% for folder in salt_settings.cloud.folders %}
|
2014-07-20 16:59:38 +02:00
|
|
|
{{ folder }}:
|
|
|
|
file.directory:
|
|
|
|
- name: /etc/salt/{{ folder }}
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- file_mode: 744
|
|
|
|
- dir_mode: 755
|
|
|
|
- makedirs: True
|
|
|
|
{% endfor %}
|
|
|
|
|
2015-03-30 19:54:50 +02:00
|
|
|
{% for cert in pillar.get('salt_cloud_certs', {}) %}
|
2014-07-20 16:59:38 +02:00
|
|
|
{% for type in ['pem'] %}
|
|
|
|
cloud-cert-{{ cert }}-pem:
|
|
|
|
file.managed:
|
|
|
|
- name: /etc/salt/cloud.providers.d/key/{{ cert }}.pem
|
|
|
|
- source: salt://salt/files/key
|
|
|
|
- template: jinja
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 600
|
|
|
|
- defaults:
|
|
|
|
key: {{ cert }}
|
|
|
|
type: {{ type }}
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
|
2015-03-17 05:39:32 +01:00
|
|
|
{% for providers in salt_settings.cloud.providers %}
|
2014-07-20 16:59:38 +02:00
|
|
|
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
|
2015-04-03 23:33:25 +02:00
|
|
|
{% endfor %}
|
2014-07-20 16:59:38 +02:00
|
|
|
|
2015-04-03 23:33:25 +02:00
|
|
|
{%- 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 }}
|
2014-07-20 16:59:38 +02:00
|
|
|
- template: jinja
|
2015-04-03 23:33:25 +02:00
|
|
|
{%- endfor %}
|