[ 35+ ] Most Popularly Ask Ansible Interview Questions & Answers

[ 35+ ] Most Popularly Ask Ansible Interview Questions & Answers

About author

Kernel (Team Lead DevOps Engineer )

Highly Expertise in Respective Industry Domain with 10+ Years of Experience Also, He is a Technical Blog Writer for Past 4 Years to Renders A Kind Of Informative Knowledge for JOB Seeker

Last updated on 15th Jun 2020| 4209

(5.0) | 16212 Ratings

Ansible is an open-source automation tool that uses simple, human-readable language (YAML) to automate tasks like software provisioning, configuration management, and application deployment. It doesn’t require installing agents on managed systems, communicates via SSH or WinRM, uses playbooks (defined task lists) to execute actions, and promotes idempotent behavior, ensuring that multiple runs produce the same result. It’s widely used in DevOps and IT automation for its ease of use and flexibility.

1. What is Ansible?

Ans:

Ansible is the configuration management system. Used for setting up and managing an infrastructure and applications. Allows the users to use and update applications using the SSH without installing an agent on remote system.

2. Explain Configuration management?

Ans:

Configuration management in Ansible is a practice of defining and maintaining an IT infrastructure using the scripts known as Playbooks. Ansible allows to specify how systems should be configured, including the software installations, configuration files, and system updates.

3. What is the use of Ansible?

Ans:

Ansible manages IT infrastructure and delivers the software applications to remote nodes. Ansible lets use the app in the multiple nodes with a single command. However, there is a need for a some programming knowledge to understand the Ansible texts.

4. What are the features of Ansible?

Ans:

Agentless: Unlike a Puppet or Chef, no software or agent controls the nodes

Python: Built on Python, which is very simple to read and write and is one of the most vital programming languages.

SSH: Ensuring anonymous network makes it secure and simple to set up.

Features of Ansible

5. What are the benefits of Ansible?

Ans:

  • It only requires the SSH service running on targeted machines.
  • Python is only dependency needed, and, fortunately, many programs come pre-installed.
  • It requires the minimal resources; therefore, there is low overhead.
  • It becomes simple to read and understand as these activities can be written in the YAML.

6. What is the Ansible Galaxy?

Ans:

Ansible can communicate with the clients suspended in command line using the Ansible command. It also allows to make automatic stops using the Ansible-playbook command. To create primary index structure, can use the Ansible-integrated tool, the ansible-galaxy.

7. What is Ansible Inventory and its types?

Ans:

An Ansible inventory is the file or collection of files that specifies a hosts on which Ansible should operate. The inventory files list IP addresses of target systems and organize them into the groups, which allows to execute and manage tasks on the multiple hosts.

8. Describe different parts of Ansible?

Ans:

  • Inventory
  • Playbooks
  • It plays
  • Jobs
  • Modules
  • Roles
  • Holders.

9. What are Ansible Inventory types?

Ans:

There are the two main types of Ansible inventory:

Static Inventory: This is a traditional form of Ansible inventory. It consists of a static and manually maintained files where define the hosts and groups. It is simple to set up and suitable for a smaller environments.

Dynamic Inventory: Dynamic inventories are generated dynamically using the scripts. These scripts query cloud providers or other data sources to discover and define hosts and groups.

10. Is Ansible an open-source tool?

Ans:

Yes, Ansible is the open-source tool because and can rewrite modules. The automated open-source engine provides a source for an automated applications as needed.

11. How does Ansible helps to manage AWS EC2 instances?

Ans:

Ansible provides the AWS module that can be used to manage EC2 instances. To use AWS module, need to provide the AWS credentials using environment variables or configuration file.

12. Distinguish between Ansible Playbooks and Roles

Ans:

Roles : A set of a tasks and additional files to configure hosts Roles are considered a group activities in single container. And can use the MySQL setup role and postfix setup.

Examples: Web Servers etc.

Playbooks : A mapping between the roles and hosts The playbook points out what is going on there. Sometimes playbook contains a one play, but can get the number as needed.

Example: site.yml, web servers.yml, etc.

13. What does changes to Ansible?

Ans:

The variables are same as the variables in the another programming language. These are given a amount used to determine the playbooks. And can also apply the conditions using the variables:

  • – hosts: your host
  • vars:
  • port_Tomcat: 2050
  • Here, portable Tomcat port is defined, and value given to the port number is 2020.

14. Differentiate between variable name and environment variable?

Ans:

  Aspect Variable Name Environment Variable
Definition

Represents a symbolic name for a value in a program.

Represents a variable outside the program, part of the operating system or runtime environment.
Scope Limited to the block of code where it is defined (local scope). Accessible to all processes running on the system (global scope).

15. What are CDs and CIs, and what does Ansible’s relationship with them?

Ans:

On CD, engineers are developing the software that can be downloaded to production at any time. The CI, on other hand, contains each engineer that loads a standard set combination (usually daily), which results in the multiple daily combinations. Ansible is ideal CI / CD process tool, which provides a stable infrastructure for providing targeted location and sending request to it.

16. Explain Playbook?

Ans:

The playbook contains the series of YAML-based files that send commands to remote computers by text. Engineers can optimize all the complex areas by transferring text to required systems instead of using an individual commands to remotely configure a computers from the command line.

17. What is Ansible Tower?

Ans:

It is the business-based web-based solution that enhances the Ansible access to other IT teams by installing an easy-to-use UI (user interface). Its main function is to serve as basis for all the organization’s default activities, allowing the users to monitor the configuration and make a quick submissions.

18. Explain how Ansible works.?

Ans:

The control machine contains the configuration file that replaces a node system. Ansible uses the playbook on controller to extract modules from node systems. Since Ansible is useless, there is no need for external company tool to connect nodes.

19. What is the best way to make Content Reusable/ Redistributable?

Ans:

To make a content reusable and redistributable Ansible roles can be used. Ansible roles are basically level of abstraction to organize playbooks. For example, if need to execute 10 tasks on the 5 systems, writing all of them in playbook might lead to be blunders and confusion. Instead create 10 roles and call them inside a playbook.

20. Describe ad hoc commands ?

Ans:

Ad hoc commands are the simple single-line commands used to perform the specific task. And can think of ad hoc instructions as another way to write playbooks.

    Subscribe For Free Demo

    [custom_views_post_title]

    21. Differentiate between ansible and chef?

    Ans:

    Ansible: It is easy to be set up

    • It is easy to manage
    • Python is more used(YAML)
    • The self support the package is $5000 per year.

    Chef :It is not simple to set up

    • It is not simple to manage
    • Ruby is used(DSL)
    • A standard plans start at $72 anually per code.

    22. What is a YAML file, and how does use it in Ansible?

    Ans:

    YAML files are like the any other formatted text file with the few rules similar to those of JSON or XML. Ansible uses this syntax in the playbooks as it is more readable than the other formats.

    23. How do JAVA and Python utilize YAML files?

    Ans:

    In prominent programming languages like a Java and Python, YAML files are commonly used for the configuration and data serialization. In Python, libraries like a PyYAML allow to parse and generate a YAML files easily. On other hand, Java has libraries like a SnakeYAML for similar purposes.

    24. Where does tags used?

    Ans:

    Tags are attributes that set physical structure, games, functions, and roles. If comprehensive playbook is needed, it is beneficial to use the part of it instead of everything. This is where tags are be used.

    25. What protocol does Ansible use for Linux and Windows communication?

    Ans:

    • For Linux,a protocol used is SSH.
    • In Windows, a protocol used is WinRM.

    26. Explain Ansible tasks?

    Ans:

    A task is the unit of Ansible action. It helps by breaking a policy of setting up small files or code blocks. These blocks are used to perform the process automatically. For example, installing the software or software update:

    • Command: Enter
    • Command: update

    27. Explain Idempotency?

    Ans:

    Idempotency is the Ansible feature that ensures that only necessary changes are possible. One or more tasks can be performed the multiple times, but it will not replace anything already fixed or working properly. It can be used in the Ansible using the created attribute. For example, if task is to create a directory on the server, then directory will only be created if it does not already exist.

    28. What does different strategies used to evaluate Ansible projects?

    Ans:

    Manual Run: Ensures that system is in custom mode. Although it is simple way to test Ansible projects, it increases risk because the results in test site may not be the same as in production area.

    Check mode: Check mode lets know what modules would have changed if playbook had been used without testing mode. It lets check whether the project is behaving way need it to.

    29. Extend Ansible reboot module beyond 600 seconds

    Ans:

    The ansible reboot module can be upgraded for the over 600 seconds using syntax below:

    • – name: Restart a Linux system
    • restart: restart_the closing time: 1000

    30. How do I use docker modules in Ansible?

    Ans:

    • Docker modules require the Python Docker SDK installed on host using Ansible.
    • With Python 2.7 or Python 3, it can be installed using following: $ pip insert docker.

    Course Curriculum

    Learn Ansible Certification Course & Get Hired by TOP MNCs

    Weekday / Weekend BatchesSee Batch Details

    31. How does I install Ansible on CentOS system?

    Ans:

    It can be done easily in the two simple steps:

    1: Set up EPEL Repository EPEL (Extra Enterprise Linux Packages) is open-source and free community-based repository project from Fedora team that provides the high-quality Linux distribution software packages which include the RHEL (Red Hat Enterprise Linux), CentOS, and Scientific Linux.

    32. Explain few basic words or concepts in Ansible.

    Ans:

    Control Machine: The Control Machine is responsible for providing the managed servers. The machine on which Ansible is installed.

    Module: A module is the set of tasks that can be performed. Ansible has 100 built-in modules, but can also customize them.

     33. Define infrastructure as a Code (IaC)

    Ans:

    In traditional configuration management systems, minute-by-minute configuration modifications are required in hands of system administrators and the IT support team. But with IAC, all configuration information is managed and stored in the standard file system, where the system automatically controls infrastructure changes and deals with the system configuration.

     34. How do dot and array notations for variables differ?

    Ans:

    If variable contains a dot(.), colon(:), starting or ending with the underscore or any known public attribute.

    If there’s a collision between the methods and attributes of python dictionaries.

    35. How does Ansible firewalld module work?

    Ans:

    Zones: This is location for which can control which services are exposed to or a location to which one local network interface is connected.

    Services: These are typically the series of port/protocol combinations (sockets) that host may be listening on, which can then be placed in a one or more zones.

    36. Why use the term ‘{{}}’? how does combine dynamic or dynamic words?

    Ans:

    One basic rule is ‘the always use {{}} unless:.’ Terms always work with the Jinja2 to resolve the issue. So, ‘when: failed_when:’ and ‘changed_when:’ remain a template, and and should avoid adding {{}}.

     37. How does one write Functional Holder?

    Ans:

    This functionality makes it much easier to the configure multiple handles. It also separates a holders from their names, making it easier to share handles between playbooks and roles:

    • – Name: Check to restart
    • shell: check_is_started.sh
    • register: result
    • listen: Restart processes
    • – Name: Restart in the terms of step 2
    • service: name = service status = restarted
    • when: result
    • listen: Restart processes

     38. How does one keep confidential data in playbook?

    Ans:

    Encrypt Data: Encrypt sensitive information before storing it in playbooks.

    Use Vaults: Leverage tools like Ansible Vault for secure storage and retrieval of sensitive data.

    Environment Variables: Avoid hardcoding sensitive data; use environment variables instead.

    39. What are Ansible Vaults, and why used?

    Ans:

    Ansible Vault is the feature that lets keep all the secrets safe. It can encrypt all the files, all YAML playbooks, or few variables. It provides the place where can not only encrypt sensitive data but also incorporate it into the playbooks.

    40. What is the difference between Ansible and Puppet?

    Ans:

    Management and Editing: In Ansible, server pushes the configuration on nodes on other side of the puppet, and the client pulls the configuration from the server.

    Availability: Ansible has two backup nodes, and doll has more than one main node. So both try to be more accessible.

    41. What is Ansible Tower?

    Ans:

    Ansible Tower is an Ansible at a more significant business level, a web-based solution for managing the organization with a straightforward visual interface that provides a dashboard with all status summaries of all strangers, which allows for a quick submissions, and monitors all configurations.

     42. What features does Ansible Tower offer?

    Ans:

    Ansible Tower Dashboard: Ansible Tower Dashboard displays the everything that happens in Sensible location, like hosts, inventory status, recent activity, and more.

    Who Done the Work: As name suggests, you can quickly know who did work where and when, and all automated work is securely entered ansible tower.

     43. Automating password input in playbook with encrypted files: How?

    Ans:

    To automate a password input in a playbook, can use the encrypted files like Ansible Vault. And can encrypt the password and store it in the Vault-encrypted file, then use include_vars module in the playbook to include the encrypted file and decrypt the password.

     44. What is “Idempotency”?

    Ans:

    Idempotency is the essential factor that should know. Prevents unnecessary changes in managed hosts. By default, can perform one or more tasks on the server as many times as need, but it will not change anything already fixed and working correctly.

     45. What is the Ansible Galaxy?

    Ans:

    This is the tool integrated with Ansible to create the basic index structure. Galaxy is the website that allows the users to discover and share relevant content. To download roles from the website, can refer to this link: $ ansible-galaxy enter username.role_name

     46. How do I use Ansible to create encrypted files?

    Ans:

    Ansible Vault secures sensitive data in playbooks. Use ansible-vault create to make encrypted files, ansible-vault edit to modify them, and ansible-vault encrypt to encrypt existing files. Ensure secure playbook execution by including –ask-vault-pass to prompt for the vault password.

    47. What are facts in the Ansible context?

    Ans:

    Recent facts and well-known system variables, found in the playbooks, are widely used in application of conditional contexts. Additionally, they collect the ad-hoc system information.

    48. What does Ansible ad-hoc command?

    Ans:

    In Ansible, an ad-hoc command is single command that is run from a command line, without the need for playbook. Ad-hoc commands can be used for tasks that do not require the complex playbook, such as running the command on a single host or gathering information from the multiple hosts.

    49. Explain Ansible register.

    Ans:

    Ansible register is used to store output from task execution in the variable. This is useful when have different outputs from each remote host. The register value is valid throughout a playbook execution so can make use of set_fact to manipulate the data and provide input to the other tasks accordingly.

    50. How do you delegate tasks in Ansible?

    Ans:

    Task delegation is the important feature of Ansible since there might be use cases where would want to perform a task on one host with the reference to other hosts. Can do this using delegate_to keyword.

    Course Curriculum

    Get Ansible Training By Industry Experts to UPGRADE Your Skills

    • Instructor-led Sessions
    • Real-life Case Studies
    • Assignments
    Explore Curriculum

    51. What are the requirements of Ansible Server?

    Ans:

    • If using Windows user, need to have the virtual machine where Linux should be installed.
    • Also requires the python version 2.6 or higher.

    52. Is Ansible a Configuration management tool?

    Ans:

    Configuration management is a practice to handle updates and manage consistency of a product’s performance over the particular period of time. Ansible is an open-source IT Configuration Management tool, which automates the wide variety of challenges in the complex multi-tier IT application environments.

    53. How does error handling and retries in Ansible?

    Ans:

    Ansible provides the various error-handling mechanisms. can use the “failed_when” statement to specify a conditions that determine task failure. Additionally, can use the “ignore_errors” option to ignore errors and continue with playbook execution. For retries, can use the “until” and “retries” parameters in tasks to retry a task until certain condition is met.

    54. How does Ansible handle complex deployments involving multiple servers?

    Ans:

    Ansible uses the concept of inventory and groups to handle the complex deployments involving multiple servers. can define groups in the inventory file and specify which tasks or playbooks should be executed on a specific groups or hosts. Ansible also supports the parallel execution, allowing tasks to run concurrently on the multiple servers.

    55. How does dynamically generate inventory in Ansible?

    Ans:

    Ansible allows the dynamic inventory by writing custom inventory scripts or plugins. These scripts can fetch inventory information from the various sources such as cloud providers, databases, or external systems. By executing inventory script or plugin, Ansible dynamically generates an inventory based on the fetched information.

    56. Explain how Ansible integrates with version control systems like Git?

    Ans:

    Ansible can integrate with the version control systems like Git to manage playbooks and the other Ansible-related files. Playbooks and associated files can be stored in Git repository, enabling versioning, collaboration, and change tracking. Ansible can then pull latest changes from the repository and execute the updated playbooks during the deployments.

    57. Explain how Ansible can be used for a configuration drift management?

    Ans:

    Configuration drift occurs when an actual state of a system deviates from a desired state defined in Ansible playbooks. Ansible can be used to detect and remediate configuration drift by a regularly executing playbooks against target hosts. Playbooks can enforce desired configuration, ensuring that systems are in the desired state and any deviations are corrected.

    58. How can I achieve high availability with Ansible?

    Ans:

    Certainly, here’s a concise version in shorter points:

    Define Requirements: Identify components needing high availability. Determine redundancy levels and SLAs.

    Use Ansible Roles: Organize playbooks into modular roles for reusability.

    Dynamic Inventory: Utilize dynamic inventory plugins for automatic infrastructure management.

    59. How can I optimize Ansible performance for large-scale deployments?

    Ans:

    Ansible performance can be optimized by leveraging features like parallelism, asynchronous tasks, and persistent connections. can configure the forks setting to control the number of the parallel connections. Asynchronous tasks allow for a parallel execution of independent tasks. Using the persistent connections with SSH ControlMaster can reduce the connection overhead. Caching facts and using strategies like a free or linear can also improve performance.

    60. What is a handler?

    Ans:

    In Ansible, the handle is similar to a normal function but will only work if the function notifies holder. Holders are automatically loaded by roles / /handler/main yaml. The catchers will run once after all the tasks have been completed in the particular game.

    61. Explain ad-hoc instructions?

    Ans:

    However, ad-hoc commands are nothing but the command used to do something quickly and are to use one time. In contrast, playbook is used for a repetitive action, which is helpful in the logical environment. But there may be situations where need to use ad-hoc commands that can do required work and not repeat functions.

    62. How does disable cowsay?

    Ans:

    If cowsay is installed then executing the playbooks within Ansible is very smooth.

    Even if think that need to work in a professional cow free environment, then will have two options:

    • 1. Uninstall cowsay.
    • 2. Setting up value for environment variable.

    63. How does Ansible synchronize module work?

    Ans:

    Ansible synchronize is the rsync-like module for Linux machines that can use in playbooks. Features are like rsync like archive, press, delete, etc., but there are a few limitations.

    • Rsync should be installed on both tsource and target system.
    • Need to specify a delegate_to to change source from localhost to the another port.
    • Need to manage the user’s permissions as files are accessible by remote user.

    64. Describe Callback_plugin in Ansible?

    Ans:

    Callbacks are defined as the piece of code in the Ansible environment where to get is used to call the particular event, and notifications are allowed. This is an additional type of the developer-related feature and allows for the low-level extensions to be able to be loaded from the variety of locations without any problem.

    65. How does Ansible set_fact module differ from vars, vars_file, or include_var?

    Ans:

    In Ansible, set_fact is used to set a new variable values ​​on a host-by-host basis, similar to logical realities found in settings module. These changes are available in the games in playbook. In the case of vars, vars_file, or insert_var, know the value in advance, and if use set_fact, can save the agreement after adjusting it over time using a certain functions such as applying the filters or taking small components of some kind. And can also set up an existing database.

    66. When does unsafe to set mass work arguments from a variable?

    Ans:

    • All work arguments can be dictionaries typed in the dictionary which can be helpful in the some dynamic duplication situations. However, Ansible issues a warning as it introduces a security risks.
    • The values ​​that are transferred to variable usermod_args can be written over the other malicious matters ​​in real estate domains on targeted machine.

    67. Explain core and extra modules in Ansible?

    Ans:

    Core modules: Maintained by a core Ansible team, these always ship with Ansible. Issues reported have priority fixing status, compared to those in extras repo. Ansible hosts these modules on the GitHub in ansible-modules-core.

    Extras modules: These modules are maintained by Ansible community. Ansible ships them for now, but might get discontinued later. Popular extra modules can move to core modules‌ with enough use.

    68. What does Ansible do?

    Ans:

    Ansible can do following for us:

    • Configuration management
    • Application deployment
    • Task automation
    • IT orchestration.

    69. Describe module resources in Ansible?

    Ans:

    Ansible offers the many different tools that help engineers while developing the modules. Basic.py is the module that provides the access to mainstream library to access and use as starting point.

    70. Explain Red Hat Ansible is?

    Ans:

    Ansible and Ansible Tower are at end of the changing platforms that can offer following features or functionality:

    • Provision
    • Deploying applications
    • Planning workflow
    • Manage IT applications.
    Docker Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download

    71. How does connect to other devices within Ansible?

    Ans:

    • Once, Ansible is installed and basic setup is complete, a list of the names is created.
    • This can be basic, and one can begin to be evaluate accordingly. To connect to the different device, must use the Ping module. This can be used as an easy way to test the connection.
    • Ansible – m ping all.

    72. How can build modules with Ansible?

    Ans:

    • Can build or have modules within the Ansible.
    • It is open-source tool that works primarily on Python. If can edit in Python, can start creating the modules within a few hours from the start, and do not need to have same prior knowledge.

    73. What does ask_pass in Ansible?

    Ans:

    • Ask_pass is managed in the Ansible Playbook.
    • This controls whether ansible-playbook automatically commands password. Generally, the default behavior is not:
    • It is always set to be ask_pass = True.
    • If use SSH keys for authentication purposes, do not need to change this setting.

    74. Explain ask_sudo_pass is?

    Ans:

    • Ask_sudo_pass manages the Ansible Playbook to reset a Sudo’s password. Generally, default behavior is not:
    • ask_sudo_pass = True
    • One has to confirm and change this setting when a Sudo passwords are enabled most of the time.

    75. Explain ask_vault_pass?

    Ans:

    The ask_vault_pass is the Ansible command-line option used to prompt user for a password to decrypt Vault-encrypted files. It ensures that sensitive information stored in the encrypted files remains secure and requires the user input for decryption during the playbook execution.

    76. Explain Module utilities in Ansible?

    Ans:

    Module utilities in Ansible are the collection of tools and functions that provide an additional functionality for working with the Ansible modules. These utilities include modules for handling the file manipulation, string manipulation, system operations, data transformations, and more.

    77. Explain types of modules in Ansible?

    Ans:

    The following are types of modules in Ansible:

    Core Modules: These are included with the Ansible by default and cover many system administration and automation tasks.

    Community Modules: These modules are contributed by Ansible community and can be used to extend the Ansible’s functionality.

    78. How does one define hosts in Ansible inventory file?

    Ans:

    In Ansible inventory file, hosts are defined as an individual hosts or groups of hosts. Hosts can be specified by hostname or IP address, and groups can be used to organize hosts based on function or location.

    79. How does I run Ansible playbook on multiple hosts?

    Ans:

    To run an Ansible playbook on the multiple hosts, can specify the hosts in the playbook itself or use an inventory file to define a target hosts or groups of hosts. When running ansible-playbook command, can use the -i option to specify inventory file and the -l option to specify a subset of hosts to target.

    80. How do I use conditionals in Ansible?

    Ans:

    In Ansible, conditionals can be used to execute a tasks based on the results of previous tasks or on values of variables. Conditionals are defined using when keyword and can include the comparison operators, logical operators, and other expressions.

    81. How do I use Ansible to manage firewalls?

    Ans:

    Ansible can manage firewalls by installing, configuring, and managing firewall software on the hosts. This can be done using modules are ufw for Ubuntu or firewalld for Red Hat. The ufw module can be used to allow or deny traffic on the specific ports while the firewalld module can be used to manage firewall rules by zones.

    82. How does one create a custom Ansible module?

    Ans:

    To create custom Ansible module, need to write a Python script that accepts the parameters and outputs JSON. The script should be placed in the directory named library in Ansible project directory.

    83. How do you pass variables between plays in an Ansible playbook?

    Ans:

    To pass variables between the plays in Ansible playbook, can use the set_fact module to set a variable in one play, and then use vars keyword to reference that variable in later play.

    84. What is the difference between a loop and a with_items statement in Ansible?

    Ans:

    • – `with_items` is an older Ansible syntax for loops.
    • – `loop` is the newer, recommended syntax for looping in Ansible.
    • – Both are used to iterate over lists of items in tasks.
    • – Prefer using `loop` for improved code consistency and readability.

    85. How do you use Jinja2 templates in Ansible?

    Ans:

    Jinja2 templates can be used in the Ansible to dynamically generate configuration files, scripts, or the other text-based files. In a playbook, a template task is defined with the source file path and a destination file path. The source file can contain a Jinja2 syntax to inject variables and logic into generated file. For example, to generate Apache configuration file with a dynamic server name.

    86. How does one handle errors in an Ansible playbook?

    Ans:

    • Ansible provides the way to handle errors and failures during the playbook execution by using ignore_errors and failed_when options.
    • The ignore_errors option tells Ansible to ignore errors and continue executing playbook. The failed_when option allows to specify the conditions under which a task should be considered failed. ignore_errors option is used with command module to tell Ansible to continue executing a playbook even if command fails.

    87. How do you use Ansible with containers?

    Ans:

    Ansible can be used to manage containers by using the modules that interact with the container engines such as Docker, Podman, and Kubernetes. For example, to deploy Docker container using Ansible, can use the docker_container module.

    88. Differences between Ansible’s local_action and delegate_to?

    Ans:

    • In Ansible, local_action runs task on Ansible control node, local_action is useful for tasks that need to run on Ansible control node, such as file operations or tasks that interact with the local services.
    • whereas delegate_to runs a task on a specific remote host.On other hand, delegate_to is used to execute tasks on remote host instead of default target host.

    89. How does Ansible helps to manage Docker containers?

    Ans:

    To manage Docker containers with the Ansible, can use the docker_container module. This module provides the several options for managing Docker containers, including creating, starting, stopping, and deleting containers.

    90. How do I use Ansible to manage backups?

    Ans:

    Ansible can be used to manage backups by creating the task that archives the files or directories to be backed up and then copies archive to a backup server. This can be done using archive and copy modules. Additionally, cron job can be created to run backup task on a regular basis.

    Upcoming Batches

    Name Date Details

    09-Dec-2024

    (Mon-Fri) Weekdays Regular

    04-Dec-2024

    (Mon-Fri) Weekdays Regular

    07-Dec-2024

    (Sat,Sun) Weekend Regular

    08-Dec-2024

    (Sat,Sun) Weekend Fasttrack