Change flat network name for nosdn fdio scenario
[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   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   EnableLoadBalancer:
34     default: true
35     description: Whether to deploy a LoadBalancer, set to false when an external load balancer is used.
36     type: boolean
37   HAProxyStatsPassword:
38     description: Password for HAProxy stats endpoint
39     hidden: true
40     type: string
41   HAProxyStatsUser:
42     description: User for HAProxy stats endpoint
43     default: admin
44     type: string
45   HAProxySyslogAddress:
46     default: /dev/log
47     description: Syslog address where HAproxy will send its log
48     type: string
49   HAProxyStatsEnabled:
50     default: true
51     description: Whether or not to enable the HAProxy stats interface.
52     type: boolean
53   RedisPassword:
54     description: The password for the redis service account.
55     type: string
56     hidden: true
57   MonitoringSubscriptionHaproxy:
58     default: 'overcloud-haproxy'
59     type: string
60   SSLCertificate:
61     default: ''
62     description: >
63       The content of the SSL certificate (without Key) in PEM format.
64     type: string
65   DeployedSSLCertificatePath:
66     default: '/etc/pki/tls/private/overcloud_endpoint.pem'
67     description: >
68         The filepath of the certificate as it will be stored in the controller.
69     type: string
70   InternalTLSCAFile:
71     default: '/etc/ipa/ca.crt'
72     type: string
73     description: Specifies the default CA cert to use if TLS is used for
74                  services in the internal network.
75   InternalTLSCRLPEMFile:
76     default: '/etc/pki/CA/crl/overcloud-crl.pem'
77     type: string
78     description: Specifies the default CRL PEM file to use for revocation if
79                  TLS is used for services in the internal network.
80
81 conditions:
82
83   public_tls_enabled:
84     not:
85       equals:
86       - {get_param: SSLCertificate}
87       - ""
88
89 resources:
90
91   HAProxyPublicTLS:
92     type: OS::TripleO::Services::HAProxyPublicTLS
93     properties:
94       ServiceData: {get_param: ServiceData}
95       ServiceNetMap: {get_param: ServiceNetMap}
96       DefaultPasswords: {get_param: DefaultPasswords}
97       EndpointMap: {get_param: EndpointMap}
98       RoleName: {get_param: RoleName}
99       RoleParameters: {get_param: RoleParameters}
100
101   HAProxyInternalTLS:
102     type: OS::TripleO::Services::HAProxyInternalTLS
103     properties:
104       ServiceData: {get_param: ServiceData}
105       ServiceNetMap: {get_param: ServiceNetMap}
106       DefaultPasswords: {get_param: DefaultPasswords}
107       EndpointMap: {get_param: EndpointMap}
108       RoleName: {get_param: RoleName}
109       RoleParameters: {get_param: RoleParameters}
110
111 outputs:
112   role_data:
113     description: Role data for the HAproxy role.
114     value:
115       service_name: haproxy
116       monitoring_subscription: {get_param: MonitoringSubscriptionHaproxy}
117       config_settings:
118         map_merge:
119           - tripleo.haproxy.firewall_rules:
120               '107 haproxy stats':
121                 dport: 1993
122             tripleo::haproxy::haproxy_log_address: {get_param: HAProxySyslogAddress}
123             tripleo::haproxy::haproxy_stats_user: {get_param: HAProxyStatsUser}
124             tripleo::haproxy::haproxy_stats_password: {get_param: HAProxyStatsPassword}
125             tripleo::haproxy::redis_password: {get_param: RedisPassword}
126             tripleo::haproxy::ca_bundle: {get_param: InternalTLSCAFile}
127             tripleo::haproxy::crl_file: {get_param: InternalTLSCRLPEMFile}
128             tripleo::haproxy::haproxy_stats: {get_param: HAProxyStatsEnabled}
129             enable_load_balancer: {get_param: EnableLoadBalancer}
130             tripleo::profile::base::haproxy::certificates_specs:
131               map_merge:
132                 - get_attr: [HAProxyPublicTLS, role_data, certificates_specs]
133                 - get_attr: [HAProxyInternalTLS, role_data, certificates_specs]
134           - if:
135               - public_tls_enabled
136               - tripleo::haproxy::service_certificate: {get_param: DeployedSSLCertificatePath}
137               - {}
138           - get_attr: [HAProxyPublicTLS, role_data, config_settings]
139           - get_attr: [HAProxyInternalTLS, role_data, config_settings]
140       step_config: |
141         include ::tripleo::profile::base::haproxy
142       upgrade_tasks:
143         - name: Check if haproxy is deployed
144           command: systemctl is-enabled haproxy
145           tags: common
146           ignore_errors: True
147           register: haproxy_enabled
148         - name: "PreUpgrade step0,validation: Check service haproxy is running"
149           shell: /usr/bin/systemctl show 'haproxy' --property ActiveState | grep '\bactive\b'
150           when: haproxy_enabled.rc == 0
151           tags: step0,validation
152         - name: Stop haproxy service
153           tags: step2
154           when: haproxy_enabled.rc == 0
155           service: name=haproxy state=stopped
156         - name: Start haproxy service
157           tags: step4 # Needed at step 4 for mysql
158           when: haproxy_enabled.rc == 0
159           service: name=haproxy state=started
160       metadata_settings:
161         list_concat:
162           - {get_attr: [HAProxyPublicTLS, role_data, metadata_settings]}
163           - {get_attr: [HAProxyInternalTLS, role_data, metadata_settings]}