Enable mistral to run under mod_wsgi
[apex-tripleo-heat-templates.git] / puppet / services / mistral-api.yaml
1 heat_template_version: ocata
2
3 description: >
4   Openstack Mistral API service configured with Puppet
5
6 parameters:
7   ServiceNetMap:
8     default: {}
9     description: Mapping of service_name -> network name. Typically set
10                  via parameter_defaults in the resource registry.  This
11                  mapping overrides those in ServiceNetMapDefaults.
12     type: json
13   DefaultPasswords:
14     default: {}
15     type: json
16   EndpointMap:
17     default: {}
18     description: Mapping of service endpoint -> protocol. Typically set
19                  via parameter_defaults in the resource registry.
20     type: json
21   MistralWorkers:
22     default: 1
23     description: The number of workers for the mistral-api.
24     type: number
25   MistralApiPolicies:
26     description: |
27       A hash of policies to configure for Mistral API.
28       e.g. { mistral-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
29     default: {}
30     type: json
31   EnableInternalTLS:
32     type: boolean
33     default: false
34
35 conditions:
36   mistral_workers_zero: {equals : [{get_param: MistralWorkers}, 0]}
37
38 resources:
39   ApacheServiceBase:
40     type: ./apache.yaml
41     properties:
42       ServiceNetMap: {get_param: ServiceNetMap}
43       DefaultPasswords: {get_param: DefaultPasswords}
44       EndpointMap: {get_param: EndpointMap}
45       EnableInternalTLS: {get_param: EnableInternalTLS}
46   MistralBase:
47     type: ./mistral-base.yaml
48     properties:
49       ServiceNetMap: {get_param: ServiceNetMap}
50       DefaultPasswords: {get_param: DefaultPasswords}
51       EndpointMap: {get_param: EndpointMap}
52
53 outputs:
54   role_data:
55     description: Role data for the Mistral API role.
56     value:
57       service_name: mistral_api
58       config_settings:
59         map_merge:
60           - get_attr: [MistralBase, role_data, config_settings]
61           - mistral::api::api_workers: {get_param: MistralWorkers}
62             mistral::api::bind_host: {get_param: [ServiceNetMap, MistralApiNetwork]}
63             mistral::wsgi::apache::ssl: {get_param: EnableInternalTLS}
64             mistral::policy::policies: {get_param: MistralApiPolicies}
65             tripleo.mistral_api.firewall_rules:
66               '133 mistral':
67                 dport:
68                   - 8989
69                   - 13989
70             mistral::api::service_name: 'httpd'
71             mistral::wsgi::apache::bind_host: {get_param: [ServiceNetMap, MistralApiNetwork]}
72             mistral::wsgi::apache::servername:
73               str_replace:
74                 template:
75                   "%{hiera('fqdn_$NETWORK')}"
76                 params:
77                   $NETWORK: {get_param: [ServiceNetMap, MistralApiNetwork]}
78           - if:
79             - mistral_workers_zero
80             - {}
81             - mistral::wsgi::apache::workers: {get_param: MistralWorkers}
82       service_config_settings:
83         get_attr: [MistralBase, role_data, service_config_settings]
84       step_config: |
85         include ::tripleo::profile::base::mistral::api
86       upgrade_tasks:
87         - name: Check if mistral api is deployed
88           command: systemctl is-enabled openstack-mistral-api
89           tags: common
90           ignore_errors: True
91           register: mistral_api_enabled
92         - name: "PreUpgrade step0,validation: Check if openstack-mistral-api is running"
93           shell: >
94             /usr/bin/systemctl show 'openstack-mistral-api' --property ActiveState |
95             grep '\bactive\b'
96           when: mistral_api_enabled.rc == 0
97           tags: step0,validation
98         - name: check for mistral_api running under apache (post upgrade)
99           tags: step1
100           shell: "httpd -t -D DUMP_VHOSTS | grep -q mistral_api_wsgi"
101           register: mistral_api_apache
102           ignore_errors: true
103         - name: Stop mistral_api service (running under httpd)
104           tags: step1
105           service: name=httpd state=stopped
106           when: mistral_api_apache.rc == 0
107         - name: Stop and disable mistral_api service (pre-upgrade not under httpd)
108           tags: step1
109           when: mistral_api_enabled.rc == 0
110           service: name=openstack-mistral-api state=stopped enabled=no