Merge "Add missing release note for cadf environment"
[apex-tripleo-heat-templates.git] / puppet / services / haproxy.yaml
1 heat_template_version: pike
2
3 description: >
4   HAproxy 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   RoleName:
17     default: ''
18     description: Role name on which the service is applied
19     type: string
20   RoleParameters:
21     default: {}
22     description: Parameters specific to the role
23     type: json
24   EndpointMap:
25     default: {}
26     description: Mapping of service endpoint -> protocol. Typically set
27                  via parameter_defaults in the resource registry.
28     type: json
29   HAProxyStatsPassword:
30     description: Password for HAProxy stats endpoint
31     hidden: true
32     type: string
33   HAProxyStatsUser:
34     description: User for HAProxy stats endpoint
35     default: admin
36     type: string
37   HAProxySyslogAddress:
38     default: /dev/log
39     description: Syslog address where HAproxy will send its log
40     type: string
41   RedisPassword:
42     description: The password for Redis
43     type: string
44     hidden: true
45   MonitoringSubscriptionHaproxy:
46     default: 'overcloud-haproxy'
47     type: string
48   InternalTLSCAFile:
49     default: '/etc/ipa/ca.crt'
50     type: string
51     description: Specifies the default CA cert to use if TLS is used for
52                  services in the internal network.
53
54 resources:
55
56   HAProxyPublicTLS:
57     type: OS::TripleO::Services::HAProxyPublicTLS
58     properties:
59       ServiceNetMap: {get_param: ServiceNetMap}
60       DefaultPasswords: {get_param: DefaultPasswords}
61       EndpointMap: {get_param: EndpointMap}
62       RoleName: {get_param: RoleName}
63       RoleParameters: {get_param: RoleParameters}
64
65   HAProxyInternalTLS:
66     type: OS::TripleO::Services::HAProxyInternalTLS
67     properties:
68       ServiceNetMap: {get_param: ServiceNetMap}
69       DefaultPasswords: {get_param: DefaultPasswords}
70       EndpointMap: {get_param: EndpointMap}
71       RoleName: {get_param: RoleName}
72       RoleParameters: {get_param: RoleParameters}
73
74 outputs:
75   role_data:
76     description: Role data for the HAproxy role.
77     value:
78       service_name: haproxy
79       monitoring_subscription: {get_param: MonitoringSubscriptionHaproxy}
80       config_settings:
81         map_merge:
82           - get_attr: [HAProxyPublicTLS, role_data, config_settings]
83           - get_attr: [HAProxyInternalTLS, role_data, config_settings]
84           - tripleo.haproxy.firewall_rules:
85               '107 haproxy stats':
86                 dport: 1993
87             tripleo::haproxy::haproxy_log_address: {get_param: HAProxySyslogAddress}
88             tripleo::haproxy::haproxy_stats_user: {get_param: HAProxyStatsUser}
89             tripleo::haproxy::haproxy_stats_password: {get_param: HAProxyStatsPassword}
90             tripleo::haproxy::redis_password: {get_param: RedisPassword}
91             tripleo::haproxy::ca_bundle: {get_param: InternalTLSCAFile}
92             tripleo::profile::base::haproxy::certificates_specs:
93               map_merge:
94                 - get_attr: [HAProxyPublicTLS, role_data, certificates_specs]
95                 - get_attr: [HAProxyInternalTLS, role_data, certificates_specs]
96       step_config: |
97         include ::tripleo::profile::base::haproxy
98       upgrade_tasks:
99         - name: Check if haproxy is deployed
100           command: systemctl is-enabled haproxy
101           tags: common
102           ignore_errors: True
103           register: haproxy_enabled
104         - name: "PreUpgrade step0,validation: Check service haproxy is running"
105           shell: /usr/bin/systemctl show 'haproxy' --property ActiveState | grep '\bactive\b'
106           when: haproxy_enabled.rc == 0
107           tags: step0,validation
108         - name: Stop haproxy service
109           tags: step2
110           when: haproxy_enabled.rc == 0
111           service: name=haproxy state=stopped
112         - name: Start haproxy service
113           tags: step4 # Needed at step 4 for mysql
114           when: haproxy_enabled.rc == 0
115           service: name=haproxy state=started
116       metadata_settings:
117         list_concat:
118           - {get_attr: [HAProxyPublicTLS, role_data, metadata_settings]}
119           - {get_attr: [HAProxyInternalTLS, role_data, metadata_settings]}