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