Change flat network name for nosdn fdio scenario
[apex-tripleo-heat-templates.git] / puppet / services / heat-api-cloudwatch.yaml
1 heat_template_version: pike
2
3 description: >
4   Openstack Heat CloudWatch API service configured with Puppet
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   DefaultPasswords:
18     default: {}
19     type: json
20   RoleName:
21     default: ''
22     description: Role name on which the service is applied
23     type: string
24   RoleParameters:
25     default: {}
26     description: Parameters specific to the role
27     type: json
28   EndpointMap:
29     default: {}
30     description: Mapping of service endpoint -> protocol. Typically set
31                  via parameter_defaults in the resource registry.
32     type: json
33   HeatWorkers:
34     default: 0
35     description: Number of workers for Heat service.
36     type: number
37   MonitoringSubscriptionHeatApiCloudwatch:
38     default: 'overcloud-heat-api-cloudwatch'
39     type: string
40   HeatApiCloudwatchLoggingSource:
41     type: json
42     default:
43       tag: openstack.heat.api.cloudwatch
44       path: /var/log/heat/heat-api-cloudwatch.log
45   EnableInternalTLS:
46     type: boolean
47     default: false
48
49 conditions:
50   heat_workers_zero: {equals : [{get_param: HeatWorkers}, 0]}
51
52 resources:
53
54   ApacheServiceBase:
55     type: ./apache.yaml
56     properties:
57       ServiceData: {get_param: ServiceData}
58       ServiceNetMap: {get_param: ServiceNetMap}
59       DefaultPasswords: {get_param: DefaultPasswords}
60       EndpointMap: {get_param: EndpointMap}
61       RoleName: {get_param: RoleName}
62       RoleParameters: {get_param: RoleParameters}
63       EnableInternalTLS: {get_param: EnableInternalTLS}
64
65   HeatBase:
66     type: ./heat-base.yaml
67     properties:
68       ServiceData: {get_param: ServiceData}
69       ServiceNetMap: {get_param: ServiceNetMap}
70       DefaultPasswords: {get_param: DefaultPasswords}
71       EndpointMap: {get_param: EndpointMap}
72       RoleName: {get_param: RoleName}
73       RoleParameters: {get_param: RoleParameters}
74
75 outputs:
76   role_data:
77     description: Role data for the Heat Cloudwatch API role.
78     value:
79       service_name: heat_api_cloudwatch
80       monitoring_subscription: {get_param: MonitoringSubscriptionHeatApiCloudwatch}
81       logging_source: {get_param: HeatApiCloudwatchLoggingSource}
82       logging_groups:
83         - heat
84       config_settings:
85         map_merge:
86           - get_attr: [HeatBase, role_data, config_settings]
87           - get_attr: [ApacheServiceBase, role_data, config_settings]
88           - tripleo.heat_api_cloudwatch.firewall_rules:
89               '125 heat_cloudwatch':
90                 dport:
91                   - 8003
92                   - 13003
93             heat::api_cloudwatch::bind_host:
94               get_param: [ServiceNetMap, HeatApiCloudwatchNetwork]
95             heat::wsgi::apache_api_cloudwatch::ssl: {get_param: EnableInternalTLS}
96             heat::api_cloudwatch::service_name: 'httpd'
97             # NOTE: bind IP is found in Heat replacing the network name with the local node IP
98             # for the given network; replacement examples (eg. for internal_api):
99             # internal_api -> IP
100             # internal_api_uri -> [IP]
101             # internal_api_subnet - > IP/CIDR
102             heat::wsgi::apache_api_cloudwatch::bind_host:
103               get_param: [ServiceNetMap, HeatApiCloudwatchNetwork]
104             heat::wsgi::apache_api_cloudwatch::servername:
105               str_replace:
106                 template:
107                   "%{hiera('fqdn_$NETWORK')}"
108                 params:
109                   $NETWORK: {get_param: [ServiceNetMap, HeatApiCloudwatchNetwork]}
110           -
111             if:
112             - heat_workers_zero
113             - {}
114             - heat::wsgi::apache_api_cloudwatch::workers: {get_param: HeatWorkers}
115       step_config: |
116         include ::tripleo::profile::base::heat::api_cloudwatch
117       metadata_settings:
118         get_attr: [ApacheServiceBase, role_data, metadata_settings]
119       upgrade_tasks:
120         - name: Check if heat_api_cloudwatch is deployed
121           command: systemctl is-enabled openstack-heat-api-cloudwatch
122           tags: common
123           ignore_errors: True
124           register: heat_api_cloudwatch_enabled
125         - name: "PreUpgrade step0,validation: Check service openstack-heat-api-cloudwatch is running"
126           shell: /usr/bin/systemctl show 'openstack-heat-api-cloudwatch' --property ActiveState | grep '\bactive\b'
127           when: heat_api_cloudwatch_enabled.rc == 0
128           tags: step0,validation
129         - name: check for heat_api_cloudwatch running under apache (post upgrade)
130           tags: step1
131           shell: "httpd -t -D DUMP_VHOSTS | grep -q heat_api_cloudwatch_wsgi"
132           register: heat_api_cloudwatch_apache
133           ignore_errors: true
134         - name: Stop heat_api_cloudwatch service (running under httpd)
135           tags: step1
136           service: name=httpd state=stopped
137           when: heat_api_cloudwatch_apache.rc == 0
138         - name: Stop and disable heat_api_cloudwatch service (pre-upgrade not under httpd)
139           tags: step1
140           when: heat_api_cloudwatch_enabled.rc == 0
141           service: name=openstack-heat-api-cloudwatch state=stopped enabled=no