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