ansibleansible-lint

ANSIBLE0013 Use shell only when shell functionality is required


In a Ansible role, I do this:

- 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"

but ansible-lint tells me through molecule:

[ANSIBLE0013] Use shell only when shell functionality is required

When should shell functionality is required and when is it not required ?

How should be the alternate way, my code seems fine to me.


Solution

  • I just replaced

    shell: 
    

    with

    command:
    

    Here is the doc: https://blog.confirm.ch/ansible-modules-shell-vs-command/

    And I solved this