Error saying "Internal Error: this module does not support running commands via 'sudo'"

0 votes

I have installed ansible, configured my shh and the hosts in /etc/ansible/hosts file. I tried executing this playybook

# Checks the hosts provisioned by midrange
---
- name: Test su connecting as current user
  hosts: all
  gather_facts: no
  tasks:
  - name: "sudo to configued user -- tstuser01"
    #action: ping
    command: /usr/bin/whoami

it threw me the following error:

Internal Error: this module does not support running commands via 'sudo'

Feb 9 in Ansible by Syra
40 views

1 answer to this question.

0 votes

Hey @Syra, use the sudo directive in the host section, something like this:

# Checks the hosts provisioned by midrange
---
- hosts: all
  sudo: yes
  gather_facts: no
  tasks:
    - name: "sudo to configued user -- tstuser01"
      command: /usr/bin/whoami
answered Feb 9 by Monish

Related Questions In Ansible

0 votes
1 answer
+13 votes
2 answers
0 votes
1 answer