This role sets custom Ansible facts that other roles or playbooks can utilize with conditionals. It should be applied before any other roles or playbooks that depend on these custom facts.
Please refer to the defaults/main.yml file for a list of variables and the facts that they set.
Here are two examples of tasks using custom platform-specific facts. If a Fedora environment is detected the dnf
module will be used to install a package:
- name: Install Node.js on Fedora
dnf:
name: nodejs
state: present
when: is_fedora
If a CentOS environment is detected the yum
module will be used to install a package:
- name: Install Node.js on CentOS
yum:
name: nodejs
state: present
when: is_centos