Jul*_*oro 4 ansible ansible-lint
在Ansible角色中,我这样做:
- name: update trusted ca
shell: "{{ in_ca_dict[ansible_os_family]['update']['shell'] }}"
Run Code Online (Sandbox Code Playgroud)
与:
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"
Run Code Online (Sandbox Code Playgroud)
但ansible-lint通过告诉我molecule:
[ANSIBLE0013] Use shell only when shell functionality is required
Run Code Online (Sandbox Code Playgroud)
何时需要外壳功能,何时不要求外壳功能?
应该如何选择替代方法,我的代码对我来说似乎很好。
我刚更换
shell:
Run Code Online (Sandbox Code Playgroud)
与
command:
Run Code Online (Sandbox Code Playgroud)
这是文档:https : //blog.confirm.ch/ansible-modules-shell-vs-command/
我解决了这个
| 归档时间: |
|
| 查看次数: |
2065 次 |
| 最近记录: |