Get exact Ansible command that is being executed

Viewed 4276

Is it possible to know exactly what command the following Ansible code will execute on the remote server

- name: Ensure apache is running
    service: name=httpd state=started
    become: true

I believe the user should have the appropriate sudo rights. However, I keep getting sudo: a password is required.

Update #1

In light of provided comments, here is my full Ansible command:

ANSIBLE_KEEP_REMOTE_FILES=1 sudo -u userA ansible-playbook ssl_playbook.yml -i inventories/staging --extra-vars "target=my_server_set" --private-key=/path/to/ssh.key --u userB  -vvv
  • userB is the remote user where the SSH key specified has been configured
  • userB has limited sudo rights. I cannot change this unfortunately, I'm not the server admin.
  • userB is currently configured to access a bunch of servers via SSH/Key already, it seemed a prime candidate for Ansible. I'm currently able to manage all my middleware manually via SSH (Apache, Tomcat, Jenkins, etc) and wanted to automate it using Ansible.
1 Answers
Related