ait-testbed/attackmate

Create support for per-include-vars

whotwagner opened this issue · 2 comments

Some include-commands need variables. currently it is necessary to use setvar to set global vars that can be used in include-playbooks.

Is this already implemented? the code below both works, no matter if the variable is defined in the main.yml playbook or in the included playbook?

# main.yml:
vars:
  FOO: "hello world"
commands:
  - type: debug
    cmd: Loading commands from another file

  - type: include
    local_path: do_work.yml

  - type: debug
    cmd: Finished run from another file


# do_work.yml:
commands:
  - type: debug
    cmd: $FOO
# main.yml:
commands:
  - type: debug
    cmd: Loading commands from another file

  - type: include
    local_path: do_work.yml

  - type: debug
    cmd: Finished run from another file


# do_work.yml:
vars:
  FOO: "hello world"
commands:
  - type: debug
    cmd: $FOO

We need to brainstorm about that a little about the scope of variables.