0289b7a740381cc42ef71c80cba1ddd21e749267
[apex-tripleo-heat-templates.git] / puppet / services / panko-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Panko API service configured with Puppet.
5   Note, This service is deprecated in Pike release and will
6   be disabled in future releases.
7
8 parameters:
9   ServiceNetMap:
10     default: {}
11     description: Mapping of service_name -> network name. Typically set
12                  via parameter_defaults in the resource registry.  This
13                  mapping overrides those in ServiceNetMapDefaults.
14     type: json
15   DefaultPasswords:
16     default: {}
17     type: json
18   RoleName:
19     default: ''
20     description: Role name on which the service is applied
21     type: string
22   RoleParameters:
23     default: {}
24     description: Parameters specific to the role
25     type: json
26   EndpointMap:
27     default: {}
28     description: Mapping of service endpoint -> protocol. Typically set
29                  via parameter_defaults in the resource registry.
30     type: json
31   MonitoringSubscriptionPankoApi:
32     default: 'overcloud-ceilometer-panko-api'
33     type: string
34   EnableInternalTLS:
35     type: boolean
36     default: false
37   PankoApiPolicies:
38     description: |
39       A hash of policies to configure for Panko API.
40       e.g. { panko-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
41     default: {}
42     type: json
43
44 resources:
45   PankoBase:
46     type: ./panko-base.yaml
47     properties:
48       ServiceNetMap: {get_param: ServiceNetMap}
49       DefaultPasswords: {get_param: DefaultPasswords}
50       EndpointMap: {get_param: EndpointMap}
51       RoleName: {get_param: RoleName}
52       RoleParameters: {get_param: RoleParameters}
53
54   ApacheServiceBase:
55     type: ./apache.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       EnableInternalTLS: {get_param: EnableInternalTLS}
63
64 outputs:
65   role_data:
66     description: Role data for the Panko API service.
67     value:
68       service_name: panko_api
69       monitoring_subscription: {get_param: MonitoringSubscriptionPankoApi}
70       config_settings:
71         map_merge:
72           - get_attr: [PankoBase, role_data, config_settings]
73           - get_attr: [ApacheServiceBase, role_data, config_settings]
74           - panko::wsgi::apache::ssl: {get_param: EnableInternalTLS}
75             panko::wsgi::apache::servername:
76               str_replace:
77                 template:
78                   "%{hiera('fqdn_$NETWORK')}"
79                 params:
80                   $NETWORK: {get_param: [ServiceNetMap, PankoApiNetwork]}
81             panko::policy::policies: {get_param: PankoApiPolicies}
82             panko::api::service_name: 'httpd'
83             panko::api::enable_proxy_headers_parsing: true
84             tripleo.panko_api.firewall_rules:
85               '140 panko-api':
86                 dport:
87                   - 8977
88                   - 13977
89             panko::api::host:
90               str_replace:
91                 template:
92                   "%{hiera('fqdn_$NETWORK')}"
93                 params:
94                   $NETWORK: {get_param: [ServiceNetMap, PankoApiNetwork]}
95             # NOTE: bind IP is found in Heat replacing the network name with the
96             # local node IP for the given network; replacement examples
97             # (eg. for internal_api):
98             # internal_api -> IP
99             # internal_api_uri -> [IP]
100             # internal_api_subnet - > IP/CIDR
101             panko::wsgi::apache::bind_host: {get_param: [ServiceNetMap, PankoApiNetwork]}
102       service_config_settings:
103         get_attr: [PankoBase, role_data, service_config_settings]
104       step_config: |
105         include tripleo::profile::base::panko::api
106       metadata_settings:
107         get_attr: [ApacheServiceBase, role_data, metadata_settings]
108       upgrade_tasks:
109         yaql:
110           expression: $.data.apache_upgrade + $.data.panko_api_upgrade
111           data:
112             apache_upgrade:
113               get_attr: [ApacheServiceBase, role_data, upgrade_tasks]
114             panko_api_upgrade:
115               - name: Check if httpd is deployed
116                 command: systemctl is-enabled httpd
117                 tags: common
118                 ignore_errors: True
119                 register: httpd_enabled
120               - name: "PreUpgrade step0,validation: Check if httpd is running"
121                 shell: >
122                   /usr/bin/systemctl show 'httpd' --property ActiveState |
123                   grep '\bactive\b'
124                 when: httpd_enabled.rc == 0
125                 tags: step0,validation
126               - name: Stop panko-api service (running under httpd)
127                 tags: step1
128                 service: name=httpd state=stopped
129                 when: httpd_enabled.rc == 0
130               - name: Install openstack-panko-api package if it was not installed
131                 tags: step3
132                 yum: name=openstack-panko-api state=latest