Created
March 15, 2017 05:14
-
-
Save jsidhu/cc7806e35e0c0d798b88d3736bddadf9 to your computer and use it in GitHub Desktop.
Ansible snippet to create a self signed ssl certificate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - name: Generate DH Params (may take several minutes!) | |
# command: openssl dhparam \ | |
# -out "/data/jenkins_home/ssl/dhparam.pem" 2048 | |
# args: | |
# creates: "/data/jenkins_home/ssl/dhparam.pem" | |
# | |
# - name: Generate ECC Key | |
# command: openssl ecparam \ | |
# -genkey \ | |
# -name prime256v1 \ | |
# -out "/data/jenkins_home/ssl/key.pem" | |
# args: | |
# creates: "/data/jenkins_home/ssl/key.pem" | |
- name: Generate RSA Key | |
command: openssl genrsa \ | |
-out "/data/jenkins_home/ssl/key.pem" 2048 | |
args: | |
creates: "/data/jenkins_home/ssl/key.pem" | |
- name: Generate CSR | |
command: openssl req \ | |
-new \ | |
-subj '/C=US/ST=CA/L=Mountain View/O=Jasmeet/CN={{ fqdn }}' | |
-key "/data/jenkins_home/ssl/key.pem" \ | |
-out "/data/jenkins_home/ssl/csr.pem" | |
args: | |
creates: "/data/jenkins_home/ssl/csr.pem" | |
- name: Generate Self-signed Certificate | |
command: openssl req \ | |
-x509 \ | |
-days 1825 \ | |
-key "/data/jenkins_home/ssl/key.pem" \ | |
-in "/data/jenkins_home/ssl/csr.pem" \ | |
-out "/data/jenkins_home/ssl/cert.pem" | |
args: | |
creates: "/data/jenkins_home/ssl/cert.pem" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment