5
$ ansible all -m ansible.builtin.shell  -a 'echo $TERM'
ERROR! this task 'ansible.builtin.shell' has extra params, which is only
allowed in the following modules: import_role, win_command,
include_vars, include_tasks, raw, win_shell, command, add_host, 
meta, include_role, shell, import_tasks, group_by, set_fact, script, include

can anyone help me to find out whats the issue

this is the one with -vvv tag

$ ansible -vvv centos -m ansible.builtin.shell  -a 'echo $TERM'
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/chandru/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
ERROR! this task 'ansible.builtin.shell' has extra params, which is only allowed in the following modules: group_by, include_tasks, set_fact, raw, add_host, win_shell, win_command, include_vars, meta, import_role, command, script, include, shell, import_tasks, include_role

2 Answers 2

7

This is due to a bug in Ansible which was introduced as part of the transition to FQCN: https://github.com/ansible/ansible/pull/71824

As a workaround, you can simply replace ansible.builtin.shell with the old-school shell name.

1
  • Thanks a lot it worked
    – Chandru Ck
    Commented Feb 6, 2021 at 16:25
-1

u can try it:

 $ ansible all -m shell  -a 'echo $TERM'

my env:

root@ubuntu:~/ansiblelearn# ansible --version
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 9, 2022 at 5:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .