2015-07-13 13:37:10 +02:00
|
|
|
#!jinja|yaml
|
|
|
|
|
2015-03-17 05:39:32 +01:00
|
|
|
{% from "salt/map.jinja" import salt_settings with context %}
|
2015-03-07 23:43:32 +01:00
|
|
|
|
2015-07-13 22:08:20 +02:00
|
|
|
{%- set cfg_salt = pillar.get('salt', {}) %}
|
|
|
|
{%- set cfg_master = cfg_salt.get('master', {}) %}
|
|
|
|
{%- set use_pip = salt['pillar.get']('salt:api:use_pip', False) %}
|
|
|
|
|
2015-03-07 23:43:32 +01:00
|
|
|
include:
|
|
|
|
- salt.master
|
2015-07-13 22:08:20 +02:00
|
|
|
{%- if use_pip %}
|
2015-07-13 13:37:10 +02:00
|
|
|
- pip.extensions
|
2015-07-13 22:08:20 +02:00
|
|
|
{%- endif %}
|
2015-03-07 23:43:32 +01:00
|
|
|
|
2015-07-13 13:46:17 +02:00
|
|
|
salt_api_install:
|
2015-03-07 23:43:32 +01:00
|
|
|
pkg.installed:
|
2015-07-13 13:46:17 +02:00
|
|
|
- name: {{ salt_settings['salt_api'] }}
|
2015-03-07 23:43:32 +01:00
|
|
|
service.running:
|
2015-07-13 13:37:10 +02:00
|
|
|
- name: {{ salt_settings.get('api_service', 'salt-api') }}
|
2015-03-07 23:43:32 +01:00
|
|
|
- require:
|
2015-07-13 22:08:20 +02:00
|
|
|
{%- if use_pip %}
|
2015-07-13 13:37:10 +02:00
|
|
|
{%- if 'rest_cherrypy' in cfg_master %}
|
2015-07-13 13:46:17 +02:00
|
|
|
- pip: salt_api_cherrypy
|
2015-07-13 22:08:20 +02:00
|
|
|
{%- elif 'rest_tornado' in cfg_master %}
|
2015-07-13 13:46:17 +02:00
|
|
|
- pip: salt_api_tornado
|
2015-07-13 22:08:20 +02:00
|
|
|
{%- endif %}
|
|
|
|
{%- else %} # if use_pip
|
|
|
|
{%- if 'rest_cherrypy' in cfg_master %}
|
|
|
|
- pkg: salt_api_cherrypy
|
|
|
|
{%- elif 'rest_tornado' in cfg_master %}
|
|
|
|
- pkg: salt_api_tornado
|
|
|
|
{%- endif %}
|
|
|
|
{%- endif %}
|
2015-03-07 23:43:32 +01:00
|
|
|
- watch:
|
|
|
|
- pkg: salt-master
|
2015-07-13 13:37:10 +02:00
|
|
|
- file: salt-master
|
|
|
|
|
2015-07-13 22:08:20 +02:00
|
|
|
{%- if use_pip %}
|
2015-07-13 13:37:10 +02:00
|
|
|
{%- if 'rest_cherrypy' in cfg_master %}
|
2015-07-13 13:46:17 +02:00
|
|
|
salt_api_cherrypy:
|
2015-07-21 00:05:56 +02:00
|
|
|
pkg:
|
|
|
|
- purged
|
|
|
|
- name: {{ salt_settings['python_cherrypy'] }}
|
|
|
|
pip:
|
|
|
|
- installed
|
2015-07-13 13:37:10 +02:00
|
|
|
- name: cherrypy
|
|
|
|
- require:
|
2015-07-13 13:46:17 +02:00
|
|
|
- pkg: salt_api_cherrypy
|
2015-07-13 13:37:10 +02:00
|
|
|
- pkg: pip_extensions
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{%- if 'rest_tornado' in cfg_master %}
|
2015-07-13 13:46:17 +02:00
|
|
|
salt_api_tornado:
|
2015-07-21 00:05:56 +02:00
|
|
|
pkg:
|
|
|
|
- purged
|
|
|
|
- name: {{ salt_settings['python_tornado'] }}
|
|
|
|
pip:
|
|
|
|
- installed
|
2015-07-13 13:37:10 +02:00
|
|
|
- name: tornado
|
|
|
|
- require:
|
2015-07-13 13:46:17 +02:00
|
|
|
- pkg: salt_api_tornado
|
2015-07-13 13:37:10 +02:00
|
|
|
- pkg: pip_extensions
|
|
|
|
{% endif %}
|
2015-07-13 22:08:20 +02:00
|
|
|
|
|
|
|
{%- else %} # if use_pip
|
|
|
|
|
|
|
|
{% if 'rest_cherrypy' in cfg_master %}
|
|
|
|
salt_api_cherrypy:
|
2015-07-21 00:05:56 +02:00
|
|
|
pkg:
|
|
|
|
- installed
|
|
|
|
- name: {{ salt_settings['python_cherrypy'] }}
|
2015-07-13 22:08:20 +02:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if 'rest_tornado' in cfg_master %}
|
|
|
|
salt_api_tornado:
|
2015-07-21 00:05:56 +02:00
|
|
|
pkg:
|
|
|
|
- installed
|
|
|
|
- name: {{ salt_settings['python_tornado'] }}
|
2015-07-13 22:08:20 +02:00
|
|
|
{% endif %}
|
|
|
|
{%- endif %}
|