Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 349
Juliatzin Avatar asked Apr 10 '18 13:04

Juliatzin


1 Answers

I just replaced

shell: 

with

command:

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

And I solved this

like image 200
Juliatzin Avatar answered Oct 18 '22 01:10

Juliatzin