Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create support for per-include-vars #63

Open
whotwagner opened this issue Dec 7, 2023 · 2 comments
Open

Create support for per-include-vars #63

whotwagner opened this issue Dec 7, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@whotwagner
Copy link
Contributor

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

@whotwagner whotwagner added the enhancement New feature or request label Dec 7, 2023
@whotwagner whotwagner self-assigned this Dec 7, 2023
@thorinaboenke
Copy link
Contributor

thorinaboenke commented Jul 29, 2024

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

@whotwagner
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants