Using modules in playbooks is a little bit different from using them in the command line. This is mainly because we have many facts available from the previous modules and the
setup module. Certain modules don't work in the Ansible command line because they require access to those variables. Other modules will work in the command-line version, but are able to provide enhanced functionalities when used in a playbook.
One of the most frequently used examples of a module that requires facts from Ansible is the
template module. This module allows us to design an outline of a configuration file and then have Ansible insert values in the right places. To perform this, Ansible uses the Jinja2 templating language. ...