robertdebock.facts

Ansible Role Facts

This role lets you add custom facts for Ansible on a system.

GitHub GitLab Downloads Version
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

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 GitHub Build Status GitLab Build Status

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: dependencies

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.

Informazioni sul progetto

Place custom facts for Ansible on a system.

Installa
ansible-galaxy install robertdebock.facts
Licenza
apache-2.0
Download
598
Proprietario
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.