Question:- What Is A Push Mode?
Answer:- Ansible runs in push mode by default, giving it complete authority when it communicates with every system. Ansible can operate nodes through intricate orchestration procedures without having to wait for them to check-in, while using push mode.
Question:- Define Register Variable.
Answer:- Ansible register allows you to save the output of a task’s execution in a variable. This is a significant feature because the output varies by the remote host, and we can use conditions loops to perform other tasks based on it. Furthermore, each register value remains valid throughout the execution of the playbook.
Question:- How Does The Resource Module Work?
Answer:- A “Resource Module” is a discrete network component that has been mapped to a single Ansible module. Network devices divide configuration into sections that apply to a network service (like VLANs and interfaces). This is used by Ansible network resource modules to allow you to set up subsections or resources within a network system configuration.
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:
