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