Merge "Apply mongod timeout via cib-push"
[apex-tripleo-heat-templates.git] / puppet / extraconfig / tls / tls-cert-inject.yaml
1 heat_template_version: 2015-04-30
2
3 description: >
4   This is a template which will build the TLS Certificates necessary
5   for the load balancer using the given parameters.
6
7 parameters:
8   # Can be overriden via parameter_defaults in the environment
9   SSLCertificate:
10     default: ''
11     description: >
12       The content of the SSL certificate (without Key) in PEM format.
13     type: string
14   SSLIntermediateCertificate:
15     default: ''
16     description: >
17       The content of an SSL intermediate CA certificate in PEM format.
18     type: string
19   SSLKey:
20     default: ''
21     description: >
22       The content of the SSL Key in PEM format.
23     type: string
24     hidden: true
25
26   # Can be overriden by parameter_defaults if the user wants to try deploying
27   # this in a distro that doesn't support this path.
28   DeployedSSLCertificatePath:
29     default: '/etc/pki/tls/private/overcloud_endpoint.pem'
30     description: >
31         The filepath of the certificate as it will be stored in the controller.
32     type: string
33
34   # Passed in by the controller
35   NodeIndex:
36     default: 0
37     type: number
38   server:
39     description: ID of the controller node to apply this config to
40     type: string
41
42 resources:
43   ControllerTLSConfig:
44     type: OS::Heat::SoftwareConfig
45     properties:
46       group: script
47       inputs:
48         - name: cert_path
49         - name: cert_chain_content
50       outputs:
51         - name: chain_md5sum
52         - name: cert_modulus
53         - name: key_modulus
54       config: |
55         #!/bin/sh
56         cat << EOF | tee ${cert_path} > /dev/null
57         ${cert_chain_content}
58         EOF
59         chmod 0440 ${cert_path}
60         chown root:haproxy ${cert_path}
61         md5sum ${cert_path} > ${heat_outputs_path}.chain_md5sum
62         openssl x509 -noout -modulus -in ${cert_path} \
63           | openssl md5 | cut -c 10- \
64           > ${heat_outputs_path}.cert_modulus
65         openssl rsa -noout -modulus -in ${cert_path} \
66           | openssl md5 | cut -c 10- \
67           > ${heat_outputs_path}.key_modulus
68
69   ControllerTLSDeployment:
70     type: OS::Heat::SoftwareDeployment
71     properties:
72       config: {get_resource: ControllerTLSConfig}
73       server: {get_param: server}
74       input_values:
75         cert_path: {get_param: DeployedSSLCertificatePath}
76         cert_chain_content:
77           list_join:
78             - ''
79             - - {get_param: SSLCertificate}
80               - {get_param: SSLIntermediateCertificate}
81               - {get_param: SSLKey}
82
83 outputs:
84   deploy_stdout:
85     description: Deployment reference
86     value: {get_attr: [ControllerTLSDeployment, chain_md5sum]}
87   deployed_ssl_certificate_path:
88     description: The location that the TLS certificate was deployed to.
89     value: {get_param: DeployedSSLCertificatePath}
90   key_modulus_md5:
91     description: MD5 checksum of the Key SSL Modulus
92     value: {get_attr: [ControllerTLSDeployment, key_modulus]}
93   cert_modulus_md5:
94     description: MD5 checksum of the Certificate SSL Modulus
95     value: {get_attr: [ControllerTLSDeployment, cert_modulus]}