robertdebock.facts
Ansible Role Facts
This role lets you add custom facts for Ansible on a system.
| GitHub | GitLab | Downloads | Version |
|---|---|---|---|
Example Playbook
Here's an example from molecule/default/converge.yml, which is tested with every push, pull request, and release.
---
- name: Set Facts
hosts: all
become: true
gather_facts: true
roles:
- role: robertdebock.facts
facts:
- key: datacenter
value: Amsterdam
- key: availability_zone
value: west
Before running this, prepare the machine. In CI, this is done with molecule/default/prepare.yml:
---
- name: Prepare
hosts: all
become: true
gather_facts: false
roles:
- role: robertdebock.bootstrap
For more details and examples, check out this guide.
Role Variables
Default settings for variables can be found in defaults/main.yml:
---
# Default settings for facts
# You can provide key-value pairs to this role to save the facts in
# `custom.fact`. For example:
# facts:
# - key: datacenter
# value: Amsterdam
# - key: availability_zone
# value: west
#
# These facts would then be accessible:
# "ansible_local": {
# "custom": {
# "availability_zone": "west",
# "datacenter": "Amsterdam"
# }
# },
facts: []
Requirements
- Python packages listed in requirements.txt.
Roles in Use
Below are the roles used to set up a system. You can also use other methods to prepare your system.
| Requirement | GitHub | GitLab |
|---|---|---|
| robertdebock.bootstrap |
Context
This role is part of a collection of compatible roles. For more information, check the documentation for these roles.
Here’s a visual of the related roles:

Compatibility
This role has been tested with various container images:
| Container | Tags |
|---|---|
| Alpine | all |
| Amazon | Candidate |
| EL | 9 |
| Debian | all |
| Fedora | all |
| Ubuntu | all |
Ansible version 2.12 or higher is required. Tests have been conducted on:
- The previous version.
- The current version.
- The development version.
If you encounter any problems, please report them on GitHub.
License
This project is licensed under Apache-2.0.
Author Information
This is created by robertdebock.
Consider sponsoring me.
ansible-galaxy install robertdebock.facts