我需要在Ansible 2.4中实现openssl命令pkcs12最新的Ansible版本提供了一个名为openssl_pkcs12的模块,但是如何在Ansible 2.4中实现呢?到目前为止,我已经尝试将此命令置于openssl_certificate的操作中,如下所示:
name: openssl create hostcertificate.key
openssl_certificate:
action: pkcs12
attributes: '"-nocerts" "-nodes"'
src: <path-to-certificate>.p12
path: <destination-path>.key
mode: '400'
state: present
但是会抛出“ openssl_certificate模块不支持的参数”错误,因为openssl_certificate模块不支持此操作。如何在此版本中实现此功能?
此外,我需要自动执行以下openssl命令,所以请检查上面的Ansible脚本中是否还有其他错误:
openssl pkcs12 -nocerts -nodes -out <destination-path>.key -in <path-to-certificate>.p12
提前感谢
这可以通过使用'shell'模块来简单解决。我通过使用以下任务完成了它:
- name: openssl create hostcertificate.key
shell: "openssl pkcs12 -nocerts -nodes -out <destination-path>/hostcertificate.key -in <path-to-key>/hostcertificate.p12"