Ansible Modules

Although Ansible supports many programming languages, most of the modules are written in Python. Majority of Windows modules are developed in PowerShell scripts.

The 202205042134# defined within a module is call a fact. Run ansible all -m {module} to check all the facts that has been defined in the module specified. Since facts are variables, we could use them in #202204272036 using the Jinja syntax {{ }}.

Links to this page
  • Ansible Variables

    For conditionals, we could use the #202204300820 when. One can use comparison operators such as ==, !=, >, >=, < and <=, or in keyword to check whether the value is found in a list. It has some limitation for potential large amount of tasks. For this, it is advised to use handler or separate the tasks into a #202204272036 and then included later. The usage is shown as below:

    We could loop over a list of variables or items using the module loop. This could become handy when there is a task should be repeated with multiple variables. That being said, using loop is unfavourable due to the performance hit. A lot of times, #202204300820 has better built-in than loop. The following code shows how to use loop:

    Note: Variables stored in #202204300820 are called facts.

  • Ansible Templates

    Templates use Jinja2 templating to generate files based on defined #202205042134. Use the #202204300820 template inside #202204272036. The following shows its usage:

  • Ansible Playbooks

    Playbooks are YAML files that are used for #202204272021 configuration. Structurally, it contains plays, 202205042134#, 202204300820#, and 202204300825#. They could be run by the command line ansible-playbook or #202204300954. It is shown as below:

  • Ansible Collection

    Collection is a data structure used to store several #202204272021 components such as 202204272036#, 202204300820#, 202205042207# (could be multiple of them), 202204300825#, documentations and tests. The components could be updated asynchronously and independently without affecting the Ansible runtime. It is usually used for #content delivery in tar ball.

#automation