Loading...
「ツール」は右上に移動しました。
利用したサーバー: wtserver1
3いいね 137 views回再生

Ansible Interview Questions with Answers Explanation (Part - V)

Ansible Interview Questions with Answers Explanation (Part - V)
Link to Part-1 of Ansible Interview Questions and Answers:
   • Ansible Interview  Questions and Answers - 1  
Playlist for All Ansible related topics:
   • All Ansible Interview Questions  
Here are the questions and answers:
1} What are Ansible's inventory variables, and how do they enhance playbook flexibility?
Answer: Inventory variables are host and group-specific variables defined in inventory files, typically in the hosts file, group_vars, or host_vars directories. These variables allow customization of tasks for specific hosts or groups, such as setting different package versions or configurations per group of servers.
2} How do you create dynamic loops with Ansible's with_items or loop directive?
Answer: Ansible allows looping over lists using with_items or the newer loop directive. These loops can dynamically apply tasks to multiple items (e.g., install multiple packages). loop is more versatile and can work with lists of dictionaries, allowing for more complex data structures to be handled in loops.
3} How does Ansible integrate with external data sources like databases or APIs?
Answer: Ansible can integrate with external data sources using custom dynamic inventories or lookup plugins. For example, you can query a database or an API to retrieve server lists, configuration settings, or application data, and dynamically use that information within playbooks. Common integrations include using the uri module for APIs or using custom Python scripts for databases.
4} What are handlers in Ansible, and when should they be used?
Answer: Handlers in Ansible are tasks that are triggered by other tasks using the notify directive. Handlers are typically used for actions like restarting services after a configuration change. They ensure that actions are only performed when necessary and can be called multiple times but executed only once at the end of a playbook.
5} What are Ansible connection plugins, and how do you customize them?
Answer: Connection plugins in Ansible define how the control node connects to managed nodes. The default connection is SSH, but other plugins like local, docker, or paramiko are also available. You can customize connection settings by modifying the inventory file or configuring connection options such as SSH keys, timeouts, or user privileges.

#ansible #ansibleinterviewquestions #devops

コメント