Ansible and Wget


I am trying to wget a file from a web server from within an Ansible playbook.

Here is the Ansible snippet:

Invoking it via:

It fails with the following:

When trying to do the command that fail via regular remote ssh to mimic what ansible would do, it doesn’t work as follows:

But I can solve it using -t as follows:

Then it works.

Is there a way to set the -t (pseudo tty option) on ansible?

P.S: I could solve it by editing the sudoers file as others propose but that is a manual step I am trying to avoid.


Don’t use shell-module when there is specialized modules available. In your case:

Create directories with file-module:

Download files with get_url-module:

Note the new module call syntax in the examples above.

If you have to use sudo with password remember to give --ask-sudo-pass when needed (see e.g. Remote Connection Information).

Leave a Reply