linux - 在 Ansible 2.4 中实现 openssl 标准命令(例如 pkcs12)
问题描述
我需要在 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
但它会抛出“ Unsupported paramaters for (openssl_certificate) module ”错误,因为 openssl_certificate 模块不支持此操作。我怎样才能为这个版本实现这个?
此外,我需要自动化以下 openssl 命令,因此请检查我在上述 Ansible 脚本中是否犯了任何其他错误:
openssl pkcs12 -nocerts -nodes -out <destination-path>.key -in <path-to-certificate>.p12
提前致谢
解决方案
这可以通过使用“shell”模块简单地解决。我通过使用以下 ansible 任务来做到这一点:
- name: openssl create hostcertificate.key
shell: "openssl pkcs12 -nocerts -nodes -out <destination-path>/hostcertificate.key -in <path-to-key>/hostcertificate.p12"
推荐阅读
- python - 是否可以使用悬停或选择工具处理文本?
- json - 使用密封类或带有 Moshi 的接口时无法为类创建转换器
- oracle - 无法插入第三列数据
- asp.net - 单击按钮从每个中继器下载多个图像
- python - 如何在 Jupyter Notebook 中将图例置于交互模式图之外
- matlab - 手指接触荧光粉的面积测量 - 批处理
- android - 如何从领域响应中更新回收站视图项
- java - 如何测试是否在要测试的方法内创建的对象上调用了方法
- php - 解析错误:语法错误,意外的 'mailuid' (T_STRING)
- asp.net - 从网络聊天 iframe 中隐藏秘密