Use shell only when shell functionality is required
37 local_action: ansible.builtin.command /usr/bin/take_out_of_pool {{ inventory_hostname }}
38
39 - name: shell with jinja filter
40 shell: echo {{ "hello"|upper }}41 changed_when: false
42
43
Description
Use shell only when shell functionality is required.
Shell should only be used when piping, redirecting or chaining commands (and Ansible would be preferred for some of those!)
Bad practice
- name: command should be used here
shell: echo hello
Recommended
- name: chain two shell commands
shell: echo hello && echo goodbye