Hi@akhtar,
Ansible has a concept of privilege escalation. Ansible uses directives to achieve it. You can specify a user to run your task as shown below.
- hosts: Httpd
remote_user: root/apache
tasks:
- name: Start service
service:
name: httpd
state:started
remote_user: name