Ansible Interview Questions

1. What is  inventory file used for and default inventory host location?

2. What is ansible configuration file used for and its default path?

3. Do you write your inventory file?

4. How many types of variables and precedence?

5. Write the command to find the python version on nodes?

6. What is the file structure of ansible roles?

7. What happen when one node or instance is unreachable?

8. What happen when one task  is failed in playbook?

9. I have 20 servers , I want to install one package in 5 servers and other package in next 5 servers..like that How to write in ansible script for that…Explain?

10. What is the architecture of ansible?

11. How do I supply variables while executing the playbook in ansible?


12. Explain about the tags in ansible?


13. How to execute failure playbook again?



14. How is ansible diffrent than any other configuration management tool?


15. Ansible playbooks are written in what format?


16. What is a module in Ansible?

17. What is inventory used for in ansible?

18. Name three places where ansible variables can be stored?

19. What connection anible establishes with  linux and windows node.

20. Diffrence between Remote and local execution in ansible.

21. What is the purpose and location of  ansible.cfg file.

22. Name any two settings from anible.cfg file.

23. Please write below a sample inventory file with host, group & group of groups syntax in it.


24. What is the diffrence between group_vars & host_vars directory?

25. What are adhocs commands used for & write below syntax of a ad hocs command?

26. Write below ad hoc command to gather fact varibales on all the hosts from the inventory file?

27. What format does ansible ad hoc command returns the output?

28. Name three types of modules in ansible?

29. Name any 10 modules in ansible that you have used.

30. How to list all the ansible core modules from command line.

31. How to display all the options/attributes for apt module from command line.

32. How can you check mandatory option for any module from command line?

33. What is setup module used for?

34. Write down sample global play declaration

35. Write down any two tasks from playbook with its proper format and names.

36. Whats is the diffrence between sudo and become module and its purpose.

37. Write down playbook syntax of starting ntp service on webserver and dbservers host group at once.

38. How to take user input from a playbook?

39. What is debug module used for in playbooks?

40. How to store output of any task into a varible from playbook?

41. What are handlers used for in ansible and how is it diffrent from tasks?

42. Conditional execution in ansible is used for what purpose and write down its syntax with small description?

43. What are templates used for and its format?

44. What are ansible roles and its purpose?

45. Command to generate ansible roles directory structure.

46. Name 5 directories from ansible roles.

Ansible interview Questions


47. What is {{ }} symbol used for in ansible.

48. Write down all the places where we can define variables according to its precedence.

49. Write down syntax of dictionary variable?

TRUE or FALSE


50. Setup module gets executed after executing any ad hoc command.
True
False

51. Anible playbooks are written in XML format.
True
False

52. ansible.cfg file is list of plays.
True
False



53. Fact variables is generated by ansible and we do not need to create fact varibales.
True
False

54. Anible is written in Python langueage.
True
False

55. Ansible works on Master and client relationship, where ansible control server package is installed on master and ansible client package is installed on all the clients.
True
False

56. Ansible loop module is with_items.
True
False

57. All the templates in ansible roles has to be defined in main.yml file inside templates directory.
True
False

58. All the roles uploaded in ansible galaxy website is written and owned by Ansible inc(organization).
True
False

59. Ansible can only get installed on Linux machine but can manage Linux and windows nodes.
True
False


60. Write a Ansible task that can copy the file to remote location with the ownership of Jboss?


61. What is local action in Ansible?


62. What are the roles in Ansible?


63. Write a playbook for installation of apache in ubuntu and centos?


64.How to create a role in ansible?


65. Different types of inventories in ansible?


66. if we want system information of machine how we will get the data with ansible like we use facter in puppet ?

67. In which language we write playbooks in ansible?

68. Activity that we use with ansibles or advantage Functionality or purpose of ansible using in your project?

69. How to launch an LDAP server using ansible?

70. How ansible works.. and what are the playbook written other than the basic playbooks ?

71. For example there are 4 aps server running and 4 websers running and we have a new code change and this change should automatically copy to these different servers using ansible, how I will come to know new code is generated.
Use Jenkins with POLL SCM option and after artifact is generated  using ansible to push suing copy module.
72. Have u done any automation like app goes down then for self healing of the app kind of the thing. 73 .Have  u written any playbook. Explain it
74. what is a dynamic inventory  in ansible?
75.  How can you manage cloud services with ansible?
76. How can you protect sensitive information in ansible?
77. How can you save the output of module execution in ansible?
78. How can you manage error handling?
79. what are conditionals in ansible?
80. write a playbook to create AMI on AWS?
81. How can you the fact varibales in ansible?
82. can we create an ansible module ?
83 .  How can you do provisioning with ansible?
84 . BASH Vs Python Vs Configuration Management Tools?
85.  How can you update a single table in a Database with ansible?

Comments