Ansible – The fetch module to retrieve files
While the copy module helps to copy a file from the controller node to managed nodes, the fetch module helps to retrieve files from a managed node to controller node. In the below example we will…
While the copy module helps to copy a file from the controller node to managed nodes, the fetch module helps to retrieve files from a managed node to controller node. In the below example we will…
Usually the Handlers work with a single task. However the “blocks” feature in Ansible helps us to group multiple tasks under one block section and attach handlers or rescue feature to it. In the below…
Do not misunderstand the concept error handling in this document with error handling in usual software programming terminology. Usually when one writes a program, a syntax check will check for syntax including indentation, spacing, etc. But…
At times when certain tasks are executed by a playbook, it may be desired to run certain other task immediately. However, if the first task did not get executed successfully for what ever reason, we may…
At times one may want to run certain tasks or command only if certain conditions are met. For example add a user called “RedhatUser01” only if the managed node is a Redhat node. Similarly add…
At times you may want to execute a single tasks with multiple variable values one after the other. For example create 3 user accounts using one task. One way is to write three tasks in the…
This document is indented to demonstrate various playbooks that makes use of different modules and their functionalities. Pinging managed nodes [root@centos9vm ~]# cat inventory ====== ======= = 192.168.48.128 192.168.48.129 [testGRP] 192.168.48.128 192.168.48.129 ===== ===== [root@centos9vm…
Ansible got a set of modules that will allow playbooks to run different operations in managed nodes. This includes configurations to install yum packages using dnf utility, copy files from controller node to manage nodes,…
Ansible templates allows users to dynamically generate text-based files using templates, variables, and facts for configuration and other purposes. The difference between Ansible Facts and Templates is as follows: An ansible Fact stores variables that…