Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Ansible Interview Questions and Answers

Related differences

Ansible vs TerraformAnsible vs Puppet

Ques 26. What is the purpose of the 'delegate_to' keyword in Ansible?

The 'delegate_to' keyword is used to run a task on a different host than the one specified in the playbook. It is useful for offloading tasks to specific hosts.

Example:

delegate_to: backup_server

Is it helpful? Add Comment View Comments
 

Ques 27. Explain Ansible dynamic variables.

Dynamic variables in Ansible are variables whose values are generated or fetched dynamically during playbook execution. They provide flexibility in configuration.

Is it helpful? Add Comment View Comments
 

Ques 28. How can you check if a file or directory exists in Ansible?

The 'stat' module in Ansible can be used to check the existence of a file or directory. The result can be checked using the 'stat.exists' attribute.

Example:

stat:
  path: /path/to/file.txt

Is it helpful? Add Comment View Comments
 

Ques 29. Explain Ansible Tower Workflows.

Ansible Tower Workflows allow the creation of complex job workflows by combining multiple playbooks and job templates. They provide a visual representation of the workflow.

Is it helpful? Add Comment View Comments
 

Ques 30. How can you override variables in Ansible?

Variables in Ansible can be overridden at different levels, including playbooks, inventory files, and the command line. The precedence order determines which value is used.

Example:

ansible-playbook site.yml -e 'variable_name=new_value'

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2026 WithoutBook