Merge "Workflow input parameter update in plan-environment"
[apex-tripleo-heat-templates.git] / puppet / services / zaqar.yaml
1 heat_template_version: pike
2
3 description: >
4   Openstack Zaqar service. Shared for all Heat services.
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   EndpointMap:
18     default: {}
19     description: Mapping of service endpoint -> protocol. Typically set
20                  via parameter_defaults in the resource registry.
21     type: json
22   DefaultPasswords:
23     default: {}
24     type: json
25   RoleName:
26     default: ''
27     description: Role name on which the service is applied
28     type: string
29   RoleParameters:
30     default: {}
31     description: Parameters specific to the role
32     type: json
33   Debug:
34     default: ''
35     description: Set to True to enable debugging on all services.
36     type: string
37   ZaqarDebug:
38     default: ''
39     description: Set to True to enable debugging Zaqar service.
40     type: string
41   ZaqarPassword:
42     description: The password for Zaqar
43     type: string
44     hidden: true
45   KeystoneRegion:
46     type: string
47     default: 'regionOne'
48     description: Keystone region for endpoint
49   ZaqarPolicies:
50     description: |
51       A hash of policies to configure for Zaqar.
52       e.g. { zaqar-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
53     default: {}
54     type: json
55   ZaqarWorkers:
56     type: string
57     description: Set the number of workers for zaqar::wsgi::apache
58     default: '%{::os_workers}'
59   EnableInternalTLS:
60     type: boolean
61     default: false
62
63 conditions:
64   zaqar_workers_zero: {equals : [{get_param: ZaqarWorkers}, 0]}
65   service_debug_unset: {equals : [{get_param: ZaqarDebug}, '']}
66
67 resources:
68
69   ApacheServiceBase:
70     type: ./apache.yaml
71     properties:
72       ServiceData: {get_param: ServiceData}
73       ServiceNetMap: {get_param: ServiceNetMap}
74       DefaultPasswords: {get_param: DefaultPasswords}
75       EndpointMap: {get_param: EndpointMap}
76       EnableInternalTLS: {get_param: EnableInternalTLS}
77
78 outputs:
79   role_data:
80     description: Shared role data for the Heat services.
81     value:
82       service_name: zaqar
83       config_settings:
84         map_merge:
85           - get_attr: [ApacheServiceBase, role_data, config_settings]
86           - zaqar::policy::policies: {get_param: ZaqarPolicies}
87             zaqar::keystone::authtoken::password: {get_param: ZaqarPassword}
88             zaqar::keystone::authtoken::project_name: 'service'
89             zaqar::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
90             zaqar::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri]}
91             zaqar::debug:
92               if:
93               - service_debug_unset
94               - {get_param: Debug }
95               - {get_param: ZaqarDebug }
96             zaqar::server::service_name: 'httpd'
97             zaqar::transport::websocket::bind: {get_param: [EndpointMap, ZaqarInternal, host]}
98             zaqar::wsgi::apache::ssl: false
99             zaqar::wsgi::apache::bind_host: {get_param: [ServiceNetMap, ZaqarApiNetwork]}
100             zaqar::message_pipeline: 'zaqar.notification.notifier'
101             zaqar::unreliable: true
102             zaqar::wsgi::apache::servername:
103               str_replace:
104                 template:
105                   "%{hiera('fqdn_$NETWORK')}"
106                 params:
107                   $NETWORK: {get_param: [ServiceNetMap, ZaqarApiNetwork]}
108           -
109             if:
110             - zaqar_workers_zero
111             - {}
112             - zaqar::wsgi::apache::workers: {get_param: ZaqarWorkers}
113       service_config_settings:
114         keystone:
115           zaqar::keystone::auth::password: {get_param: ZaqarPassword}
116           zaqar::keystone::auth::public_url: {get_param: [EndpointMap, ZaqarPublic, uri]}
117           zaqar::keystone::auth::admin_url: {get_param: [EndpointMap, ZaqarAdmin, uri]}
118           zaqar::keystone::auth::internal_url: {get_param: [EndpointMap, ZaqarInternal, uri]}
119           zaqar::keystone::auth::region: {get_param: KeystoneRegion}
120           zaqar::keystone::auth::tenant: 'service'
121           zaqar::keystone::auth_websocket::password: {get_param: ZaqarPassword}
122           zaqar::keystone::auth_websocket::public_url: {get_param: [EndpointMap, ZaqarWebSocketPublic, uri]}
123           zaqar::keystone::auth_websocket::admin_url: {get_param: [EndpointMap, ZaqarWebSocketAdmin, uri]}
124           zaqar::keystone::auth_websocket::internal_url: {get_param: [EndpointMap, ZaqarWebSocketInternal, uri]}
125           zaqar::keystone::auth_websocket::region: {get_param: KeystoneRegion}
126           zaqar::keystone::auth_websocket::tenant: 'service'
127
128       step_config: |
129         include ::tripleo::profile::base::zaqar
130       upgrade_tasks:
131         yaql:
132           expression: $.data.apache_upgrade + $.data.zaqar_upgrade
133           data:
134             apache_upgrade:
135               get_attr: [ApacheServiceBase, role_data, upgrade_tasks]
136             zaqar_upgrade:
137               - name: Check if zaqar is deployed
138                 command: systemctl is-enabled openstack-zaqar
139                 tags: common
140                 ignore_errors: True
141                 register: zaqar_enabled
142               - name: "PreUpgrade step0,validation: Check if openstack-zaqar is running"
143                 shell: >
144                   /usr/bin/systemctl show 'openstack-zaqar' --property ActiveState |
145                   grep '\bactive\b'
146                 when: zaqar_enabled.rc == 0
147                 tags: step0,validation
148               - name: Check for zaqar running under apache (post upgrade)
149                 tags: step1
150                 shell: "httpd -t -D DUMP_VHOSTS | grep -q zaqar_wsgi"
151                 register: zaqar_apache
152                 ignore_errors: true
153               - name: Stop zaqar service (running under httpd)
154                 tags: step1
155                 service: name=httpd state=stopped
156                 when: zaqar_apache.rc == 0
157               - name: Stop and disable zaqar service (pre-upgrade not under httpd)
158                 tags: step1
159                 when: zaqar_enabled.rc == 0
160                 service: name=openstack-zaqar state=stopped enabled=no
161               - name: Install openstack-zaqar package if it was disabled
162                 tags: step3
163                 yum: name=openstack-zaqar state=latest
164                 when: zaqar_enabled.rc != 0