Ansible Module include vars: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 7: Line 7:
=Overview=
=Overview=
The module Loads YAML/JSON variables dynamically from a file or directory, recursively, during task runtime. If loading a directory, the files are sorted alphabetically before being loaded.
The module Loads YAML/JSON variables dynamically from a file or directory, recursively, during task runtime. If loading a directory, the files are sorted alphabetically before being loaded.
=File Location=
=Use Cases=
=Use Cases=
====Load Variables in a Playbook before Roles and Task Execution====
====Load Variables in a Playbook before Roles and Task Execution====

Revision as of 21:14, 5 July 2021

External

Internal

Overview

The module Loads YAML/JSON variables dynamically from a file or directory, recursively, during task runtime. If loading a directory, the files are sorted alphabetically before being loaded.

File Location

Use Cases

Load Variables in a Playbook before Roles and Task Execution

- name: some play
  hosts: localhost
  pre_tasks:
    - include_vars: 
        file: 'vars/some-vars.yaml' # Filename relative to the playbook root directory
  roles:
    - ...
  tasks:
    - ...