43e7aa1860fe7b053bc02d58f8f1eb92a9154b6d
[apex-tripleo-heat-templates.git] / puppet / services / panko-api.yaml
1 heat_template_version: ocata
2
3 description: >
4   OpenStack Panko 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   MonitoringSubscriptionPankoApi:
22     default: 'overcloud-ceilometer-panko-api'
23     type: string
24   EnableInternalTLS:
25     type: boolean
26     default: false
27   PankoApiPolicies:
28     description: |
29       A hash of policies to configure for Panko API.
30       e.g. { panko-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
31     default: {}
32     type: json
33
34 resources:
35   PankoBase:
36     type: ./panko-base.yaml
37     properties:
38       ServiceNetMap: {get_param: ServiceNetMap}
39       DefaultPasswords: {get_param: DefaultPasswords}
40       EndpointMap: {get_param: EndpointMap}
41
42   ApacheServiceBase:
43     type: ./apache.yaml
44     properties:
45       ServiceNetMap: {get_param: ServiceNetMap}
46       DefaultPasswords: {get_param: DefaultPasswords}
47       EndpointMap: {get_param: EndpointMap}
48       EnableInternalTLS: {get_param: EnableInternalTLS}
49
50 outputs:
51   role_data:
52     description: Role data for the Panko API service.
53     value:
54       service_name: panko_api
55       monitoring_subscription: {get_param: MonitoringSubscriptionPankoApi}
56       config_settings:
57         map_merge:
58           - get_attr: [PankoBase, role_data, config_settings]
59           - get_attr: [ApacheServiceBase, role_data, config_settings]
60           - panko::wsgi::apache::ssl: {get_param: EnableInternalTLS}
61             panko::wsgi::apache::servername:
62               str_replace:
63                 template:
64                   "%{hiera('fqdn_$NETWORK')}"
65                 params:
66                   $NETWORK: {get_param: [ServiceNetMap, PankoApiNetwork]}
67             panko::policy::policies: {get_param: PankoApiPolicies}
68             panko::api::service_name: 'httpd'
69             panko::api::enable_proxy_headers_parsing: true
70             tripleo.panko_api.firewall_rules:
71               '140 panko-api':
72                 dport:
73                   - 8779
74                   - 13779
75             panko::api::host:
76               str_replace:
77                 template:
78                   "%{hiera('fqdn_$NETWORK')}"
79                 params:
80                   $NETWORK: {get_param: [ServiceNetMap, PankoApiNetwork]}
81             # NOTE: bind IP is found in Heat replacing the network name with the
82             # local node IP for the given network; replacement examples
83             # (eg. for internal_api):
84             # internal_api -> IP
85             # internal_api_uri -> [IP]
86             # internal_api_subnet - > IP/CIDR
87             panko::wsgi::apache::bind_host: {get_param: [ServiceNetMap, PankoApiNetwork]}
88       service_config_settings:
89         get_attr: [PankoBase, role_data, service_config_settings]
90       step_config: |
91         include tripleo::profile::base::panko::api
92       metadata_settings:
93         get_attr: [ApacheServiceBase, role_data, metadata_settings]
94       upgrade_tasks:
95         - name: Check if httpd is deployed
96           command: systemctl is-enabled httpd
97           tags: common
98           ignore_errors: True
99           register: httpd_enabled
100         - name: "PreUpgrade step0,validation: Check if httpd is running"
101           shell: >
102             /usr/bin/systemctl show 'httpd' --property ActiveState |
103             grep '\bactive\b'
104           when: httpd_enabled.rc == 0
105           tags: step0,validation
106         - name: Stop panko-api service (running under httpd)
107           tags: step1
108           service: name=httpd state=stopped
109           when: httpd_enabled.rc == 0
110         - name: Install openstack-panko-api package if it was not installed
111           tags: step3
112           yum: name=openstack-panko-api state=latest