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