| {%- from "manila/map.jinja" import api, cfg with context %} |
| {%- if api.enabled %} |
| include: |
| - apache |
| - manila._common |
| - manila.db.offline_sync |
| |
| manila_api_packages: |
| pkg.installed: |
| - names: {{ api.pkgs }} |
| - require_in: |
| - sls: manila.db.offline_sync |
| |
| {% if not api.get('logging', {}).get('log_appender', False) %} |
| {%- do api.update({'logging': cfg.logging})%} |
| {% endif %} |
| |
| {% if api.logging.log_appender == True %} |
| |
| {%- if api.logging.log_handlers.get('fluentd', {}).get('enabled', False) %} |
| manila_api_fluentd_logger_package: |
| pkg.installed: |
| - name: python-fluent-logger |
| - require_in: |
| - sls: manila.db.offline_sync |
| {%- endif %} |
| |
| manila_api_general_conf: |
| file.managed: |
| - name: /etc/manila/logging.conf |
| - source: salt://oslo_templates/files/logging/_logging.conf |
| - template: jinja |
| - makedirs: True |
| - mode: 0640 |
| - user: root |
| - group: manila |
| - defaults: |
| service_name: manila-api |
| _data: {{ api.logging }} |
| - require: |
| - pkg: manila_api_packages |
| {%- if api.logging.log_handlers.get('fluentd', {}).get('enabled', False) %} |
| - pkg: manila_api_fluentd_logger_package |
| {%- endif %} |
| - watch_in: |
| - service: {{ api.service }} |
| - require_in: |
| - sls: manila.db.offline_sync |
| {% endif %} |
| |
| manila_api_service_dead: |
| service.dead: |
| - name: manila-api |
| - enable: False |
| |
| manila_site_enabled: |
| apache_site.enabled: |
| - name: wsgi_manila |
| - require: |
| - pkg: manila_api_packages |
| |
| manila_apache_wsgi_config: |
| file.exists: |
| - name: /etc/apache2/sites-available/wsgi_manila.conf |
| - require: |
| - manila_site_enabled |
| |
| {{ api.service }}: |
| service.running: |
| - enable: true |
| - watch: |
| - file: /etc/manila/manila.conf |
| - file: /etc/manila/policy.json |
| - manila_apache_wsgi_config |
| - manila_site_enabled |
| {%- if grains.get('noservices') %} |
| - onlyif: /bin/false |
| {%- endif %} |
| - require: |
| - manila_api_service_dead |
| - manila_site_enabled |
| - sls: manila.db.offline_sync |
| |
| /etc/manila/policy.json: |
| file.managed: |
| - source: salt://manila/files/{{ api.version }}/policy.json |
| - template: jinja |
| - mode: 0640 |
| - group: manila |
| - require: |
| - pkg: manila_api_packages |
| |
| {%- endif %} |