Skip to content

Instantly share code, notes, and snippets.

@meysam81
Created January 27, 2024 09:15
Show Gist options
  • Save meysam81/537a85b4265b2b340afdff75384b295e to your computer and use it in GitHub Desktop.
Save meysam81/537a85b4265b2b340afdff75384b295e to your computer and use it in GitHub Desktop.
Creating the certificate for the CA
- name: Generate CA private key
community.crypto.openssl_privatekey:
path: /etc/kubernetes/pki/ca.key
type: RSA
- name: Generate CA CSR to provide ALT names and other options
community.crypto.openssl_csr:
basicConstraints_critical: true
basic_constraints:
- CA:TRUE
common_name: kubernetes-ca
keyUsage_critical: true
key_usage:
- keyCertSign
- cRLSign
path: /etc/kubernetes/pki/ca.csr
privatekey_path: /etc/kubernetes/pki/ca.key
state: present
- name: Generate CA certificate
community.crypto.x509_certificate:
path: /etc/kubernetes/pki/ca.crt
privatekey_path: /etc/kubernetes/pki/ca.key
csr_path: /etc/kubernetes/pki/ca.csr
provider: selfsigned
state: present
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment