feffi / ansible-include-vars

Ansible role to include custom YAML files from configured path(s).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ansible-include-vars

Ansible role to include custom YAML files from configured path(s).

Build Status Github All Releases GitHub forks GitHub stars GitHub watchers Twitter Follow License

Requirements

  • Ansible 2.3

ansible.cfg

hash_behaviour = merge

Install

Just add the role to your requirements.yml file:

- src: https://github.com/feffi/ansible-include-vars.git
  name: ansible-include-vars

Role Variables

All role based variables are listed below, along with default values:

macos_include_vars:
  # List of local paths to search for YAML files that will be included as Ansible vars.
  paths:
    - "{{ inventory_dir }}/.secrets"

  # Extension of files to include.
  extensions:
    - "yml"

  # Exclude files matching this names
  excludes:
    - "requirements.yml"

  # Directory depth to used search for files
  # 1 = only files directly in include_vars_dir_paths
  depth: 1

Dependencies

None.

Example Playbook

    - hosts: all
      vars:
        # Include custom vars from defined locations
        macos_include_vars: {
          paths: [
            "/Users/<USERNAME>/.secrets"
          ]
        }
      roles:
        - { role: ansible-include-vars }

About

Ansible role to include custom YAML files from configured path(s).

License:MIT License