0

From cli I can create a file with sudo, and it won't ask for the password.

My new user does not have any password.

But when I use ansible it is not prompting for the password but giving error irrespective of a user has a password or not.

I even use--ask-pass but it is not working

- hosts: localhost
  become: true
  become_user: test-user
  tasks:
    - file:
        path: "/tmp/test/rryyuu"
        state: touch

ERROR:

fatal: [localhost]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"setup": {"failed": true, "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}}, "msg": "The following modules failed to execute: setup\n"}

Vladimir Botka
  • 58,131
  • 4
  • 32
  • 63

0 Answers0