Slackbot
07/13/2023, 4:45 PMYury Bushmelev
07/13/2023, 6:17 PMYury Bushmelev
07/13/2023, 6:18 PMMoe
07/13/2023, 7:41 PMplan myplan (
TargetSpec $targets = 'localhost',
) {
$mytargets = get_targets($targets)
$mytargets.each | $target | {
out::message($target.vars)
}
}
A bit bloated but I didn't find another way to access vars set for each target.
My inventory.yaml looks like this
groups:
- name: production
vars:
environment: 'production'
targets:
- someotherhost.home.arpa
- name: test
vars:
environment: 'test'
targets:
- myothehost.home.arpa
- localhost
The result is
bolt plan run myplan targets=test
Starting: plan myplan
These are myothehost.home.arpa
{
"environment": "test"
}
These are localhost
{
"environment": "test"
}
Finished: plan myplan in 0.02 sec
Plan completed successfully with no result