Skip to content

Variable File Helper #37

@wied03

Description

@wied03

In conjunction with the variable AST work in #5, might be nice to provide a variable file helper that uses Ruby variable/constant scoping and thus will pick up typos, etc. Ansible would ultimately handle the values and "inheritance" but this would catch mistakes.

File would look like this:

SOME_CONST = 'toodles'
OTHER_CONST = {foo: 123, bar: 456]
  • Look for main.rb files in the variable directories in the order Ansible resolves things and class_eval them as part of DSL builders in a variables module
  • Can use Module#constants to get a list of values for serialization and add the value of the variable to that list
  • Serialize the list of constants/values into YAML so that Ansible has access to the variables

In the regular DSL builder infrastructure:

  • implement const_missing
  • Check the variables modules to see if the constant is defined there
  • If it is, return an AST-ish type as its value that reflects the name of the constant as serialized in the variable YAML

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions