March 2019
Intermediate to advanced
412 pages
9h 49m
English
The final method to load variable data from a file is to reference a file path with the --extra-vars (or -e) argument to ansible-playbook. Normally, this argument expects a set of key=value data; however, if a file path is provided and prefixed with the @ symbol, Ansible will read the entire file to load variable data. Let's alter one of our earlier examples, where we used -e, and instead of defining a variable directly on the command line, we'll include the variable file we've already written out:
---
- name: vars
hosts: localhost
gather_facts: false
tasks: - name: a task debug: msg: "I am a {{ varname }}"
When we provide a path after the @ symbol, the path is relative to the current working directory, regardless of where the ...
Read now
Unlock full access