Ansible Playbook

 





the state : ensure each time we run the playbook the packages are of the latest version.

Absent 


The absent : does the un-installation or removes the package for the above



ansible all -m gather_facts --limit <ip_address_of_host_machine> | grep ansible_distribution



we can run this as this one if this is centos host

we copy the complete content above and copy paste it below and rewrite the code to install it for centosmachine

dnf  | CentOs

The package names on Centos is also different that needs to be changed


You can improve your ansible script by consolidating multiple packages inside one play.




we instead use variable for this one.

Now edit the inventory file. host file.

There is a small change that we will make in the yaml file.
we change apt to package: - Package is a generic package manager which handles all kinds of package











Comments

Popular posts from this blog

Ansible Core Modules and Aliases

Learn -Ansible - Tutorial

Ansible Versions