set_fact Module

May 8, 2026 ยท View on GitHub

Set variables on the current execution host for use by subsequent tasks.

Parameters

ParameterDescriptionTypeRequiredDefault
anyVariables to set, in key-value formatstring or mapNo-

Examples

1. Set string

- name: set string
  set_fact:
    a: b
    c: d

2. Set nested map

- name: set map
  set_fact:
    a:
      b: c