diff options
Diffstat (limited to 'playbooks/ssl.yaml')
| -rw-r--r-- | playbooks/ssl.yaml | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/playbooks/ssl.yaml b/playbooks/ssl.yaml new file mode 100644 index 0000000..6b5e53d --- /dev/null +++ b/playbooks/ssl.yaml @@ -0,0 +1,24 @@ +--- +- name: "Create self-signed SSL cert" + shell: + cmd: | + ssl_hostname="{{ ansible_nodename }}.{{ fqdn }}" + if [ ! -f "/etc/ssl/certs/${ssl_hostname}.crt" ] && [ ! -f "/etc/ssl/private/${ssl_hostname}.key" ]; then + openssl req -x509 -nodes -sha256 -days 3650 -newkey rsa:4096 -keyout "/tmp/${ssl_hostname}.key" -out "/tmp/${ssl_hostname}.crt" <<EOF + US + New Jersey + Basking Ridge + Verizon Wireless + Verizon Cloud Platform + ${ssl_hostname} + carlos.konstanski@verizonwireless.com + EOF + cp -f "/tmp/${ssl_hostname}.crt" "/etc/ssl/certs/" + cp -f "/tmp/${ssl_hostname}.key" "/etc/ssl/private/" + chmod 644 "/etc/ssl/certs/${ssl_hostname}.crt" + chown root: "/etc/ssl/certs/${ssl_hostname}.crt" + chmod 640 "/etc/ssl/private/${ssl_hostname}.key" + chown root:ssl-cert "/etc/ssl/private/${ssl_hostname}.key" + fi + args: + executable: /bin/bash |
