Merge "Unset the UpgradeInitCommand on converge"
[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         yaql:
96           expression: $.data.apache_upgrade + $.data.panko_api_upgrade
97           data:
98             apache_upgrade:
99               get_attr: [ApacheServiceBase, role_data, upgrade_tasks]
100             panko_api_upgrade:
101               - name: Check if httpd is deployed
102                 command: systemctl is-enabled httpd
103                 tags: common
104                 ignore_errors: True
105                 register: httpd_enabled
106               - name: "PreUpgrade step0,validation: Check if httpd is running"
107                 shell: >
108                   /usr/bin/systemctl show 'httpd' --property ActiveState |
109                   grep '\bactive\b'
110                 when: httpd_enabled.rc == 0
111                 tags: step0,validation
112               - name: Stop panko-api service (running under httpd)
113                 tags: step1
114                 service: name=httpd state=stopped
115                 when: httpd_enabled.rc == 0
116               - name: Install openstack-panko-api package if it was not installed
117                 tags: step3
118                 yum: name=openstack-panko-api state=latest