Merge "Containerized Sensu client"
[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   InternalTLSCRLPEMFile:
54     default: '/etc/pki/CA/crl/overcloud-crl.pem'
55     type: string
56     description: Specifies the default CRL PEM file to use for revocation if
57                  TLS is used for services in the internal network.
58
59 resources:
60
61   HAProxyPublicTLS:
62     type: OS::TripleO::Services::HAProxyPublicTLS
63     properties:
64       ServiceNetMap: {get_param: ServiceNetMap}
65       DefaultPasswords: {get_param: DefaultPasswords}
66       EndpointMap: {get_param: EndpointMap}
67       RoleName: {get_param: RoleName}
68       RoleParameters: {get_param: RoleParameters}
69
70   HAProxyInternalTLS:
71     type: OS::TripleO::Services::HAProxyInternalTLS
72     properties:
73       ServiceNetMap: {get_param: ServiceNetMap}
74       DefaultPasswords: {get_param: DefaultPasswords}
75       EndpointMap: {get_param: EndpointMap}
76       RoleName: {get_param: RoleName}
77       RoleParameters: {get_param: RoleParameters}
78
79 outputs:
80   role_data:
81     description: Role data for the HAproxy role.
82     value:
83       service_name: haproxy
84       monitoring_subscription: {get_param: MonitoringSubscriptionHaproxy}
85       config_settings:
86         map_merge:
87           - get_attr: [HAProxyPublicTLS, role_data, config_settings]
88           - get_attr: [HAProxyInternalTLS, role_data, config_settings]
89           - tripleo.haproxy.firewall_rules:
90               '107 haproxy stats':
91                 dport: 1993
92             tripleo::haproxy::haproxy_log_address: {get_param: HAProxySyslogAddress}
93             tripleo::haproxy::haproxy_stats_user: {get_param: HAProxyStatsUser}
94             tripleo::haproxy::haproxy_stats_password: {get_param: HAProxyStatsPassword}
95             tripleo::haproxy::redis_password: {get_param: RedisPassword}
96             tripleo::haproxy::ca_bundle: {get_param: InternalTLSCAFile}
97             tripleo::haproxy::crl_file: {get_param: InternalTLSCRLPEMFile}
98             tripleo::profile::base::haproxy::certificates_specs:
99               map_merge:
100                 - get_attr: [HAProxyPublicTLS, role_data, certificates_specs]
101                 - get_attr: [HAProxyInternalTLS, role_data, certificates_specs]
102       step_config: |
103         include ::tripleo::profile::base::haproxy
104       upgrade_tasks:
105         - name: Check if haproxy is deployed
106           command: systemctl is-enabled haproxy
107           tags: common
108           ignore_errors: True
109           register: haproxy_enabled
110         - name: "PreUpgrade step0,validation: Check service haproxy is running"
111           shell: /usr/bin/systemctl show 'haproxy' --property ActiveState | grep '\bactive\b'
112           when: haproxy_enabled.rc == 0
113           tags: step0,validation
114         - name: Stop haproxy service
115           tags: step2
116           when: haproxy_enabled.rc == 0
117           service: name=haproxy state=stopped
118         - name: Start haproxy service
119           tags: step4 # Needed at step 4 for mysql
120           when: haproxy_enabled.rc == 0
121           service: name=haproxy state=started
122       metadata_settings:
123         list_concat:
124           - {get_attr: [HAProxyPublicTLS, role_data, metadata_settings]}
125           - {get_attr: [HAProxyInternalTLS, role_data, metadata_settings]}