I’m trying to run the openssl command via Ansible.
- name: Generate a Production CSR
local_action: /usr/bin/openssl req
-new -newkey rsa:2048 -nodes
-subj ‘{{ local_generate_prod_csr }}’
-days 3650 -keyout STAR_{{ domain_name }}-privatekey.pem
-out STAR_{{ domain_name }}.pem
register: local_generate_prod_csr
Everything looks fine when I view the verbose output:
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-1384997601.86-108284890956864 && chmod a+rx $HOME/.ansible/tmp/ansible-1384997601.86-108284890956864 && echo $HOME/.ansible/tmp/ansible-1384997601.86-108284890956864’]
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-1384997601.86-123003779483972 && chmod a+rx $HOME/.ansible/tmp/ansible-1384997601.86-123003779483972 && echo $HOME/.ansible/tmp/ansible-1384997601.86-123003779483972’]
<127.0.0.1> REMOTE_MODULE /usr/bin/openssl req -new -newkey rsa:2048 -nodes -subj ‘/C=US/ST=California/L=Los Angeles/O=IT/CN=.selfishxmas.com’ -days 3650 -keyout STAR_selfishxmas.com-privatekey.pem -out STAR_selfishxmas.com.pem
<127.0.0.1> REMOTE_MODULE /usr/bin/openssl req -new -newkey rsa:2048 -nodes -subj '/C=US/ST=California/L=Los Angeles/O=IT/CN=.selfishxmas.com’ -days 3650 -keyout STAR_selfishxmas.com-privatekey.pem -out STAR_selfishxmas.com.pem
but it results in:
fatal: [162.243.95.241] => failure encoding into utf-8
fatal: [162.243.67.77] => failure encoding into utf-8
If I take the command from the verbose output,
/usr/bin/openssl req -new -newkey rsa:2048 -nodes -subj ‘/C=US/ST=California/L=Los Angeles/O=IT/CN=*.selfishxmas.com’ -days 3650 -keyout STAR_selfishxmas.com-privatekey.pem -out STAR_selfishxmas.com.pem
And copy and paste it into the terminal window I get the standard output:
Generating a 2048 bit RSA private key
…+++
…+++
writing new private key to ‘STAR_selfishxmas.com-privatekey.pem’