Ansible: Including Variables

From Glitchdata
Jump to navigation Jump to search

Including variables in Ansible can be achieved in several ways.

  • Referenced via relative path to the called playbook
  • Referenced in via absolute directories
  • Included variables persist over the entire playbook execution and is accessible in included tasks.

Methods

  • var_files
---
- hosts: myhosts

  vars_files:
    - default_step.yml
  tasks:
    - name: include default step variables
      include_vars: default_step.yml

Links

Related