ANSIBLE0013仅在需要shell功能时使用shell

时间:2018-04-10 13:55:47

标签: ansible ansible-lint

在Ansible角色中,我这样做:

- name: update trusted ca
  shell: "{{ in_ca_dict[ansible_os_family]['update']['shell'] }}"

with:

package_name: ca-certificates
  RedHat:
    path:
      6: /usr/local/share/ca-certificates
      7: /etc/pki/ca-trust/source/anchors
    update:
      shell: /bin/update-ca-trust
  Debian:
    path: /usr/local/share/ca-certificates
    update:
      shell: /usr/sbin/update-ca-certificates
      cache: "no"

ansible-lint告诉我molecule

[ANSIBLE0013] Use shell only when shell functionality is required

何时需要shell功能以及何时不需要?

如何替代方式,我的代码对我来说似乎很好。

1 个答案:

答案 0 :(得分:4)

我刚刚更换了

shell: 

command:

以下是文档:https://blog.confirm.ch/ansible-modules-shell-vs-command/

我解决了这个问题