【问题标题】:Implement openssl standard commands (e.g. pkcs12) in Ansible 2.4在 Ansible 2.4 中实现 openssl 标准命令(例如 pkcs12)
【发布时间】:2020-02-24 08:13:02
【问题描述】:

我需要在 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

提前致谢

【问题讨论】:

    标签: linux openssl ansible-2.x


    【解决方案1】:

    这可以通过使用“shell”模块简单地解决。我通过使用以下 ansible 任务来做到这一点:

    - name: openssl create hostcertificate.key
      shell: "openssl pkcs12 -nocerts -nodes -out <destination-path>/hostcertificate.key -in <path-to-key>/hostcertificate.p12"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-09
      • 2016-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多