Question:- What Is A Rolling Update?
Answer:- The action of referring to a group of N nodes is taken one at a time in order to prevent upgrading them all at once and getting the system offline. For example, to handle a web topology with 500+ nodes it might make sense to finish updating only 10 to 20 machines at a time and then move on to the next ones. In Ansible playbooks, the serial: keyword manages the size of the rolling update. By default, the batch size is handled all at once.
Question:- What Are Ansible Facts?
Answer:- Ansible maintains information on the host in variables after running a setup module on it for easy access in playbooks. Ansible facts are pre-defined variables that provide information about a host system.
Question:- How Do You Check Variables For A Host?
Answer:- The host_vars variable provides access to all of a hosts variables. Its a variable dictionary with the title of the variable as the key. Heres an illustration: ansible -m debug -a "var=hostvars[inventory_hostname]"
Question:- What Are Tags? How Do I Get Rid Of Tags?
Answer:- A tag is an attribute that you can apply to a play or tasks so that you can pick or deselect them when you run a playbook. There are two methods for removing tags from a list: Use the –tags or –skip-tags command line options. Using the TAGS RUN and TAGS SKIP parameters in the Ansible setup settings, disable or enable tags.
Question:- Is Ansible Compatible With SELinux?
Answer:- If you wish to use any copy/template functions in Ansible, you’ll need to install libselinux python on remote nodes that have SELinux enabled. Ansible’s yum or dnf modules can be used to install this package on remote systems that don’t already have it.
Question:- How Can You Create Encrypted Files With Ansible?
Answer:- Use the ansible-vault create command to generate an encrypted file. $ ansible-vault create filename.yaml Youll be prompted to establish a password, which you must then confirm by typing it again. You’ll now have access to a new file in which you can add and change information.
Question:- Is There Any Way To Increase Reboot Timeout Value?
Answer:- Yes, the Ansible reboot module’s 600-second wait time can be increased to specified levels. The following syntax can be used:
Question:- How Do You Put Ansible Projects To The Test?
Answer:- This is another common ansible interview question. There are three options for testing: • Asserts Asserts replicates the tests behavior in other languages, such as Python. It ensures that your system has reached the intended state, rather than just a simulation like in check mode. Asserts that the task completed the tasks objectives and that the necessary resources were modified. • Check Mode Check mode displays how things would work if no simulation had been performed. As a result, its simple to see if the project behaves the way you want it. Check mode, on the other hand, does not run scripts and commands that are used in roles and playbooks. To get around this, use check mode: no to disable check mode for specified tasks.
Question:- What Is Ansible Vault, And How Does It Work?
Answer:- Any structured data file used by Ansible can be encrypted using the Ansible Vault functionality. This can contain inventory variables like group vars/ or host vars/, variables loaded using include vars or vars files, or variable files supplied with -e @file.yml or -e @file.json on the ansible-playbook command line. Variables and defaults for the roles are also supplied! Ansible jobs, handlers, and other objects contain data, therefore the vault may encrypt them as well. You can keep an individual task file completely encrypted if you dont want to reveal the variables youre utilizing.
Question:- How Can You Get Access To Shell Environment Variables?
Answer:- Using the “env” lookup plugin, you can get at the variables that the controlling computer already has.
Question:- In A Playbook, How Do You Keep Data Hidden?
Answer:- Use Vault in playbooks if you want to maintain confidential data but still be able to publish it publicly. However, if youre using –v (verbose) mode and dont want the results to be visible to others, use:
Question:- How Can I Configure The Pre-Reboot And Post-Reboot Delays?
Answer:- After the reboot has completed successfully and the connection has been re-established in seconds, the following command can be used to force Ansible to wait:
Question:- Describe The Syntax Of The Playbook.
Answer:- Playbooks are written in YAML and have very little syntaxA playbook is a collection of one or more plays in a logical order. Each play carries out a portion of the playbooks ultimate goal by carrying out one or more responsibilities. An Ansible module is called by each task.
Question:- Describe How The Playbook Is Put Into Action.
Answer:- From top to bottom, a playbook is read. Tasks are also completed in order from top to bottom inside each play. Multiple ‘plays’ in a playbook can orchestrate multi-machine deployments, with one play operating on your webservers, another on your database servers, a third on your network infrastructure, and so on. Each play must define at least two things: • the managed nodes to target • with at least one job to execute
