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