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, 2019 in Ansible by Syra
1,560 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, 2019 by Monish

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,062 views
+2 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP