|
| 1 | +# tls_keystores |
| 2 | + |
| 3 | +Creates Java keystores (JKS) and truststores from TLS certificates and private keys. It is designed to work with certificates issued by FreeIPA. |
| 4 | + |
| 5 | +## Features |
| 6 | +- Creates JKS keystores from certificate and private key files |
| 7 | +- Creates JKS truststores with CA certificates |
| 8 | +- Configurable keystore and truststore paths and aliases |
| 9 | + |
| 10 | +## Requirements |
| 11 | +- Java keytool (part of Java installation) |
| 12 | +- community.general Ansible collection |
| 13 | +- Certificate and private key files must exist on target host |
| 14 | + |
| 15 | +## Role Variables |
| 16 | + |
| 17 | +| Variable | Type | Required | Default | Description | |
| 18 | +|----------|------|----------|---------|-------------| |
| 19 | +| `keystore_password` | `str` | Yes | `undef` | Password for both keystore and truststore | |
| 20 | +| `keystore_alias` | `str` | Yes | `undef` | Alias name for the certificate in the keystore | |
| 21 | +| `keystore_output_path` | `str` | No | `/etc/pki/tls/private/keystore.jks` | Path to output JKS keystore file | |
| 22 | +| `keystore_cert_path` | `str` | No | `/etc/pki/tls/certs/host.crt` | Path to the certificate file | |
| 23 | +| `keystore_key_path` | `str` | No | `/etc/pki/tls/private/host.key` | Path to the private key file | |
| 24 | +| `truststore_alias` | `str` | No | `ipa-ca` | Alias name for the CA certificate in the truststore | |
| 25 | +| `truststore_path` | `str` | No | `/etc/pki/tls/private/truststore.jks` | Path to output JKS truststore file | |
| 26 | +| `ca_cert_path` | `str` | No | `/etc/ipa/ca.crt` | Path to the CA certificate file | |
| 27 | + |
| 28 | +## Example Playbook |
| 29 | + |
| 30 | +```yaml |
| 31 | +- hosts: java_servers |
| 32 | + tasks: |
| 33 | + - name: Create Java keystores and truststores with default paths |
| 34 | + ansible.builtin.import_role: |
| 35 | + name: tls_keystores |
| 36 | + vars: |
| 37 | + keystore_password: "MySecurePassword123" |
| 38 | + keystore_alias: "service-cert" |
| 39 | + keystore_cert_path: "/etc/pki/tls/certs/host.crt" |
| 40 | + keystore_key_path: "/etc/pki/tls/private/host.key" |
| 41 | + truststore_alias: "ipa-ca" |
| 42 | + ca_cert_path: "/etc/ipa/ca.crt" |
| 43 | + |
| 44 | + - name: Create Java keystores for EFM Gateway with custom paths |
| 45 | + ansible.builtin.import_role: |
| 46 | + name: tls_keystores |
| 47 | + vars: |
| 48 | + keystore_password: "MySecurePassword123" |
| 49 | + keystore_alias: "efm-gateway" |
| 50 | + keystore_output_path: "/opt/cloudera/cem/certs/keystore.jks" |
| 51 | + truststore_path: "/opt/cloudera/cem/certs/truststore.jks" |
| 52 | + keystore_cert_path: "/etc/pki/tls/certs/gateway.crt" |
| 53 | + keystore_key_path: "/etc/pki/tls/private/gateway.key" |
| 54 | + truststore_alias: "freeipa-ca" |
| 55 | + ca_cert_path: "/etc/ipa/ca.crt" |
| 56 | +``` |
| 57 | +
|
| 58 | +## License |
| 59 | +
|
| 60 | +``` |
| 61 | +Copyright 2025 Cloudera, Inc. |
| 62 | + |
| 63 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 64 | +you may not use this file except in compliance with the License. |
| 65 | +You may obtain a copy of the License at |
| 66 | + |
| 67 | + https://www.apache.org/licenses/LICENSE-2.0 |
| 68 | + |
| 69 | +Unless required by applicable law or agreed to in writing, software |
| 70 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 71 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 72 | +See the License for the specific language governing permissions and |
| 73 | +limitations under the License. |
| 74 | +``` |
0 commit comments