# local\_action results in a "failure encoding into utf-8"

**URL:** <https://forum.ansible.com/t/local-action-results-in-a-failure-encoding-into-utf-8/13949>\
**Category:** Ansible Project\
**Created:** [November 21, 2013, 1:39am UTC](https://forum.ansible.com/t/local-action-results-in-a-failure-encoding-into-utf-8/13949 "2013-11-21T01:39:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Neudorfer1](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@David\_Neudorfer1](https://forum.ansible.com/u/David_Neudorfer1)\
**Post date:** [November 21, 2013, 1:39am UTC](https://forum.ansible.com/t/local-action-results-in-a-failure-encoding-into-utf-8/13949/1 "2013-11-21T01:39:04Z")

</div>

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’

---

<div class="post-metadata">

**Author:** ![David\_Neudorfer1](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@David\_Neudorfer1](https://forum.ansible.com/u/David_Neudorfer1)\
**Post date:** [November 21, 2013, 2:23am UTC](https://forum.ansible.com/t/local-action-results-in-a-failure-encoding-into-utf-8/13949/2 "2013-11-21T02:23:31Z")

</div>

Changing it from

local\_action: /usr/bin/openssl

to

local\_action: shell /usr/bin/openssl

fixed my problem. If this isn’t best practice I’d love to know! Thanks.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [November 21, 2013, 2:42am UTC](https://forum.ansible.com/t/local-action-results-in-a-failure-encoding-into-utf-8/13949/3 "2013-11-21T02:42:39Z")

</div>

Looks like it is trying to look for /usr/bin/openssl as a module name and freaking out.

I think the error reporting should be better in this case, but it should still be some kind of error.

If you can file a ticket we can improve the error message I think.

Please open a ticket at [github.com/ansible/ansible](http://github.com/ansible/ansible).

Thanks!
