- name: restart httpd
service:
name: httpd
state: restarted
ansible-playbook -i inventory test.yml --sudo --ask-sudo-pass --ask-become-pass --sudo -vvvv
# The user that logs into the machine
remote_user: apps
# Indicates that we also want to be become the user we log in as, for running tasks
# (otherwise the user defaults to root)
become: yes
become_user: apps
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL
- name: Restart apache
shell: sudo systemctl restart httpd
What happens when you run the command as that user? If it still asks for a password either your sudoers file is an issue or user/group might be.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fe9501e5-8c46-41b9-a9c2-ab961430d8de%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/NHM3zEiRWxU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAKsMCESoL%2B-qTtMiAbAS8itAQHuW7Ak0vp8CYDa3m7UfYb715A%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fe9501e5-8c46-41b9-a9c2-ab961430d8de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/NHM3zEiRWxU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/db8a02b7-9a66-49ff-8c6a-98412f81e9b1%40googlegroups.com.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.