Ansible Module set fact

From NovaOrdis Knowledge Base
Revision as of 21:59, 19 January 2021 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

External

Internal

Overview

This module sets new facts (variables). The variables are set on a host-by-host basis just like facts discovered by the setup module and will be available to subsequent plays during an ansible-playbook run.

Set cacheable to yes to save variables across executions using a fact cache. Variables created with set_fact have different precedence depending on whether they are or are not cached. Per the standard Ansible variable precedence rules, many other types of variables have a higher priority, so this value may be overridden.

- name: Set bashrc.d directory path
  set_fact:
    bashrc_d: "{{ ansible_env.HOME }}/.bashrc.d"

Setting Command Output as a Fact=

Setting Command Output as a Fact