Hi

Two things, related.

Firstly, I currently run my ansible playbook with --ask-sudo-pass, 
otherwise as some of my tasks include:

become: yes
user: root

I get the error:

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "sudo: a password is required\n", "module_stdout": "", 
"msg": "MODULE FAILURE"}

(I am currently learning how to write Ansible playbooks, and using it to 
control the software installed on my local machine, which is working fine).

Secondly, if I instead use:

become: yes
user: myusername

I get:

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": 
"This command has to be run under the root user."}

This error is in relation to a dnf, for example:

- name: install vim
  dnf: name=vim state=latest
  become: yes
  become_user: root

Perhaps, since the flag is --ask-sudo-pass, and not "ask su pass" or "ask 
root pass" or something like that, my playbook is already using sudo on my 
account, and I just don't realize.
But, barring that possibility, what is a better way for me to do this?

Thanks very much. I searched for information regarding this before posting 
here, but could not find clear guidance.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3134cc86-bfc1-449d-a747-793a71bd618e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to