-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Change behavior of register
directive to apply it to all following tasks
#196
Comments
The runner now differentiates between all variables and registered variables from command execution. Registered variables are a subset of all variables that will be used for subsequent tasks. This additional feature aids in more specific tracking and utilization of key variables in more complex scripting scenarios. This is a preparation step to implement cross-task registered vars #196
@koolay - the change in place on the :master image. Pls, give it a try and see if it fixes the reported issue |
Hi, it is not work when target host is not on the same host. |
The change shouldn't be tied to any target host but rather propagate it to all the tasks. If it doesn't work for you, please provide the playbook and output of the spot with --dbg and -v. This is the one I have tested and it worked as expected: user: umputun
ssh_key: ~/.ssh/id_rsa
targets:
dev1:
hosts: [{host: "dev1.umputun.dev", name: "dev1"}]
dev2:
hosts: [{host: "dev2.umputun.dev", name: "dev2"}]
tasks:
- name: first
targets: ["dev1"]
commands:
- name: get host name
script: |
myhost=$(hostname)
register: [myhost]
- name: second
targets: ["dev2"]
commands:
- name: show host name
script: |
echo "show myhost var: $myhost"
As you can see, |
@umputun |
currently, exporting a var or setting them to
register
acts the same way - making the var available for other commands in the given task. I think this is the correct logic for set var, but incorrect forregister
. The proposed change will update all the following tasks by injecting register vars into them.see #195 (reply in thread) for more details
The text was updated successfully, but these errors were encountered: