gpt4 book ai didi

ANSIBLE0013 仅当需要 shell 功能时才使用 shell

转载 作者:行者123 更新时间:2023-12-02 15:40:53 25 4
gpt4 key购买 nike

在 Ansible 角色中,我这样做:

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

与:

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 通过 分子 告诉我:

[ANSIBLE0013] Use shell only when shell functionality is required

什么时候需要 shell 功能,什么时候不需要?

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

最佳答案

我刚刚更换

shell: 

command:

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

我解决了这个问题

关于ANSIBLE0013 仅当需要 shell 功能时才使用 shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49755521/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com