Skip to content

Instantly share code, notes, and snippets.

@miticojo
Last active March 13, 2018 21:03
Show Gist options
  • Save miticojo/2fc624b57bbe599fb9743b1b3d4000a5 to your computer and use it in GitHub Desktop.
Save miticojo/2fc624b57bbe599fb9743b1b3d4000a5 to your computer and use it in GitHub Desktop.
Save variable though runnings
- hosts: localhost
vars:
my_variable_collection:
colore: rosso
occhi: azzurri
segno: ariete
tasks:
- name: save all variables into a yaml file
copy:
content: "{{my_variable_collection|to_nice_yaml}}"
dest: ./vars/final-vars.yml
- hosts: localhost
tasks:
- name: load variable file
include_vars:
dir: vars
files_matching: final-vars.yml
name: my_variable_collection
- name: print out variable collection loaded
debug: msg="{{my_variable_collection}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment