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
|
|
|
|
2016-05-06 20:45:41 +02:00
|
|
|
{% set cloudmaps = salt['pillar.get']('salt:cloud:maps', {}) -%}
|
|
|
|
{% set cloudprofiles = salt['pillar.get']('salt:cloud:profiles', {}) -%}
|
|
|
|
{% set cloudproviders = salt['pillar.get']('salt:cloud:providers', {}) -%}
|
|
|
|
|
2016-09-20 05:38:01 +02:00
|
|
|
{%- if salt_settings.use_pip %}
|
2014-07-20 16:59:38 +02:00
|
|
|
python-pip:
|
|
|
|
pkg.installed
|
|
|
|
|
2017-04-10 09:54:56 +02:00
|
|
|
salt-cloud-pip-packages:
|
2014-07-20 16:59:38 +02:00
|
|
|
pip.installed:
|
2017-04-10 09:54:56 +02:00
|
|
|
- pkgs:
|
|
|
|
- apache-libcloud
|
|
|
|
{%- if grains['os_family'] not in ['Debian', 'RedHat'] %}
|
|
|
|
- crypto
|
|
|
|
{%- endif %}
|
|
|
|
- pycrypto
|
2014-07-20 16:59:38 +02:00
|
|
|
- require:
|
|
|
|
- pkg: python-pip
|
2016-09-20 05:38:01 +02:00
|
|
|
{%- endif %}
|
2014-07-20 16:59:38 +02:00
|
|
|
|
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 }}
|
2016-09-20 05:38:01 +02:00
|
|
|
{%- if salt_settings.use_pip %}
|
2014-07-20 16:59:38 +02:00
|
|
|
- require:
|
2017-04-10 09:54:56 +02:00
|
|
|
- pip: salt-cloud-pip-packages
|
2016-09-20 05:38:01 +02:00
|
|
|
{%- endif %}
|
2015-03-24 18:08:08 +01:00
|
|
|
{% endif %}
|
2014-07-20 16:59:38 +02:00
|
|
|
|
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:
|
2016-03-29 19:28:47 +02:00
|
|
|
- name: {{ salt_settings.config_path }}/pki/cloud/{{ cert }}.pem
|
2015-06-09 23:05:49 +02:00
|
|
|
- source: salt://{{ slspath }}/files/key
|
2014-07-20 16:59:38 +02:00
|
|
|
- template: jinja
|
|
|
|
- user: root
|
2017-01-13 13:52:18 +01:00
|
|
|
- group:
|
|
|
|
{%- if grains['kernel'] in ['FreeBSD', 'OpenBSD', 'NetBSD'] %}
|
|
|
|
wheel
|
|
|
|
{%- else %}
|
|
|
|
root
|
|
|
|
{%- endif %}
|
2014-07-20 16:59:38 +02:00
|
|
|
- mode: 600
|
2015-04-04 01:30:26 +02:00
|
|
|
- makedirs: True
|
2014-07-20 16:59:38 +02:00
|
|
|
- defaults:
|
|
|
|
key: {{ cert }}
|
|
|
|
type: {{ type }}
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
|
2015-04-13 22:08:11 +02:00
|
|
|
{%- for dir, templ_path in salt_settings.cloud.template_sources.items() %}
|
2015-04-03 23:33:25 +02:00
|
|
|
salt-cloud-{{ dir }}:
|
|
|
|
file.recurse:
|
2016-03-29 19:28:47 +02:00
|
|
|
- name: {{ salt_settings.config_path }}/cloud.{{ dir }}.d
|
2015-04-13 22:08:11 +02:00
|
|
|
- source: {{ templ_path }}
|
2014-07-20 16:59:38 +02:00
|
|
|
- template: jinja
|
2015-04-04 01:30:26 +02:00
|
|
|
- makedirs: True
|
2015-04-03 23:33:25 +02:00
|
|
|
{%- endfor %}
|
2015-04-06 17:24:41 +02:00
|
|
|
|
2016-05-06 20:45:41 +02:00
|
|
|
{% 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) }}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% for key, value in cloudproviders.items() %}
|
|
|
|
/etc/salt/cloud.providers.d/{{ key }}:
|
|
|
|
file.managed:
|
|
|
|
- contents: |
|
|
|
|
{{ value|yaml(False) | indent(8) }}
|
|
|
|
{% endfor %}
|
|
|
|
|
2015-04-06 17:24:41 +02:00
|
|
|
salt-cloud-providers-permissions:
|
|
|
|
file.directory:
|
2016-03-29 19:28:47 +02:00
|
|
|
- name: {{ salt_settings.config_path }}/cloud.providers.d
|
2015-04-06 17:24:41 +02:00
|
|
|
- user: root
|
2017-01-13 13:52:18 +01:00
|
|
|
- group:
|
|
|
|
{%- if grains['kernel'] in ['FreeBSD', 'OpenBSD', 'NetBSD'] %}
|
|
|
|
wheel
|
|
|
|
{%- else %}
|
|
|
|
root
|
|
|
|
{%- endif %}
|
2015-04-06 17:24:41 +02:00
|
|
|
- file_mode: 600
|
|
|
|
- dir_mode: 700
|
|
|
|
- recurse:
|
|
|
|
- user
|
|
|
|
- group
|
|
|
|
- mode
|