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

Dynamic targets #92

Merged
merged 3 commits into from
May 14, 2023
Merged

Dynamic targets #92

merged 3 commits into from
May 14, 2023

Conversation

umputun
Copy link
Owner

@umputun umputun commented May 14, 2023

This PR adds support for dynamic targets in some limited use cases.

tasks:
  - name: get host
    targets: ["default"]
    script: |
      export thehost=$(curl -s http://example.com/next-host)
    options: {local: true}
    
  - name: run on host
    targets: ["$thehost"]
    script: |
      echo "doing something on $thehost"

This example indicates the essence of the change. Here the exported variables that are usually available for all the commands in the task will be available for all task targets and targets: ["$thehost"] will be evaluated

A practical use case for dynamic targets arises during the provisioning of a new host, followed by the execution of commands on it. Since the IP address of the new host isn't known beforehand, dynamic retrieval becomes essential.

@umputun umputun merged commit 58c9196 into master May 14, 2023
3 checks passed
@umputun umputun deleted the dynamic_targets branch May 14, 2023 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant