Skip to content

Ansible action plugin to load and recursively merge var files

License

Notifications You must be signed in to change notification settings

jvale/ansible_merge_var_files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

merge_var_files

Build Status

Ansible action plugin that, given a list of files and/or paths, recursively merges the contents of those files.

Heavily derived from Ansible's include_vars action plugin (that disguises itself as a module), so all its rules and functionality should apply seamlessly, with the exception that the parameter file (string) is replaced by files (list).

Merge strategy

When merging, the following strategy is applied:

  • non-existing items are added
  • if data types differ, the new item overrides the previous one
  • dictionaries are merged recursively
  • all other values are overridden by the newer item

Testing

Tests are executed using tox, and the following combinations are tested:

Python Ansible
2.7 2.8 (latest)
2.7 2.9 (latest)
3.7 2.8 (latest)
3.7 2.9 (latest)

Example usage

- name: load and merge vars from all files
  merge_var_files:
    name: my_merged_data
    files:
      - default.yml
      - '{{ ansible_os_family }}.yml'
      - '{{ ansible_os_distribution }}.yml'

About

Ansible action plugin to load and recursively merge var files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages