# Using OpenSSL module without files

**URL:** <https://forum.ansible.com/t/using-openssl-module-without-files/32657>\
**Category:** Ansible Project\
**Created:** [April 11, 2020, 7:24am UTC](https://forum.ansible.com/t/using-openssl-module-without-files/32657 "2020-04-11T07:24:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [April 11, 2020, 7:24am UTC](https://forum.ansible.com/t/using-openssl-module-without-files/32657/1 "2020-04-11T07:24:41Z")

</div>

Hi

Our ansible deployments are using OpenSSL key materials that are stored as multiline values in yaml vars files.  
I’d like to use openssl\_certificate\_info but that seems to require a path parameter:  
[https://docs.ansible.com/ansible/latest/modules/openssl\_certificate\_info\_module.html](https://docs.ansible.com/ansible/latest/modules/openssl_certificate_info_module.html)

After inspection the majority of the openssl modules have this requirement.

I can’t think of a way to use the modules with variable based certificate materials, someone else maybe knows?

Also would this be a good feature request?  
For instance a new ‘content’ parameter which contains the key material.

Thx

Dick

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [April 11, 2020, 8:07am UTC](https://forum.ansible.com/t/using-openssl-module-without-files/32657/2 "2020-04-11T08:07:48Z")

</div>

Hi Dick,

> Our ansible deployments are using OpenSSL key materials that are  
> stored as multiline values in yaml vars files.  
> I'd like to use openssl\_certificate\_info but that seems to require a  
> path parameter:  
> [https://docs.ansible.com/ansible/latest/modules/openssl\_certificate\_info\_module.html](https://docs.ansible.com/ansible/latest/modules/openssl_certificate_info_module.html)
> 
> After inspection the majority of the openssl modules have this  
> requirement.

that's indeed true.

> I can't think of a way to use the modules with variable based  
> certificate materials, someone else maybe knows?

There isn't one.

> Also would this be a good feature request?

It is, and someone already requested this:  
[https://github.com/ansible/ansible/issues/63553](https://github.com/ansible/ansible/issues/63553)

> For instance a new 'content' parameter which contains the key  
> material.

That won't work that easily, unfortunately, as the modules are designed  
to behave similarly to the `file` module. It would require a new set of  
modules which are designed differently.

Fortunately, now that everything has been moved to collections  
([https://github.com/ansible-collections/community.crypto/](https://github.com/ansible-collections/community.crypto/)), this is  
easier to do, since it is easier to move code to module\_utils. My idea  
would be to refactor the modules to move a lot of their core  
functionality to module\_utils, and then adding a new modules which can  
work in-memory, re-use the core functionality from module\_utils, and  
thus do not require a large amount of code copy'n'paste. I have a  
couple of other things I'll work on first, but this is something that  
I'd like to do somewhen anyway.

Cheers,  
Felix
