How to Use Ansible Blocks Blocks are a powerful feature in Ansible that allows you to group tasks together and apply common attributes, such as when conditions or become directives, to all tasks within the block. This can make yourAnsible playbooksmore readable and maintainable. With blocks, yo...
The local machine is where you will execute the Ansible Playbook from. This could be your local machine (e.g. laptop) or some other server that you use to manage your servers. As mentioned earlier, it needs to be able to connect to each remote server asroot. Your local machin...
Another important task system administrators undertake is the management of the firewall. In Ansible playbooks, this has been made much easier withfirewalldandufwmodules. You can configure the firewall to allow or block a port or service or even a source address. Let’s jump in and have a...
: an Ubuntu 18.04 machine with Ansible installed and configured to connect to your Ansible hosts using SSH keys. Make sure the control node has a regular user with sudo permissions and a firewall enabled, as explained in our One or more Ansible HostsHow to Use Ansible to Automate...
This category is for longer pieces of “how to” that haven’t made it into the docs (yet) or are commonly asked questions in Get Help. This also has high search priority, so please do use that search for your questions!
If I run this playbook nothing related to tags will happen and ansible will run all the tasks as usual from top to bottom. You should tell ansible which task with particular tag should run and which should be skipped. Along withansible-playbookcommand, use--tagsor-tflag and pass the tag...
The script hosted athttps://people.redhat.com/pgervase/sysadmin/partition.ymlgives one example of how to use Ansible to take a blank disk and go through the steps to create an encrypted partition, mount it, and then write to it. Like so many things with technology, there are several diff...
to the configuration filepostgresql.confwith a single line describing anincludefile where we'll locate all our changes in a separate and distinct file, thus improving clarity. The Ansible keywordblockinfileis cool, as it adds text in a file identifying itself within a nice, big labeled block....
In the previous article in this series, 8 steps to developing an Ansible role in Linux, I created an Ansible role to install Vim and configure it with some p...
In this example, we have a playbook in which we have used Ansible facts, conditionals, and another way to give command using the cmd parameter. --- hosts: all tasks: name: Here we are checking & showing the /etc/redhat-release on rhel machine based on condition block: ...