Comments (11)
This should work with bolt command run "df -h" --nodes=ceph-cluster-{001..111}
.
from bolt.
That seems like a promising possibility.
from bolt.
You may already have this workaround in place, but in the meantime you can use
bolt command run "df -h" -n `echo ceph-cluster-{001..111} | tr ' ' ,`
from bolt.
We use something similar as an example in https://puppet.com/docs/bolt/0.x/bolt_options.html#concept-743.
from bolt.
This is not the same, because it adds multiple --nodes arguments using shell expansion.
Using a single --nodes argument with number of hosts separated by spaces provides a additional (and for many users useful) possibility.
$ echo bolt command run "la" --nodes={web{5,6,7},elasticsearch{1,2,3}.subdomain}.mydomain.edu
bolt command run la --nodes=web5.mydomain.edu --nodes=web6.mydomain.edu --nodes=web7.mydomain.edu --nodes=elasticsearch1.subdomain.mydomain.edu --nodes=elasticsearch2.subdomain.mydomain.edu --nodes=elasticsearch3.subdomain.mydomain.edu
from bolt.
I missed the awk example, which wouldn't work with what I suggested. But it would work with
awk '/Host ceph-mon/{print $2}' ~/.ssh/config | bolt command run "df -h" -n -
-n -
reads from stdin, and will accept whitespace-separated hostnames.
from bolt.
I'm resistant to supporting multiple arguments to --nodes
because it makes CLI parsing more complicated and can make it harder to provide clear errors. I believe the use cases you're interested are all possible, just in slightly different forms than you expected.
from bolt.
I think i understand your argument. But you should also consider that using node names separated by spaces gains a lot of convenience for at least unix/linux users.
Typical shell expansion / usage works without hacky conversion tricks (pipes, subshells, ...)
from bolt.
Would it be an option to treat the "remaining arguments" as nodes? Like this, but without giving "Unknown argument(s)":
bolt command run "docker exec whatever status" -- $(custom_get_hosts --filter node-)
Unknown argument(s) node-01, node-02, node-03, node-04, node-05, node-06, node-07, node-08, node-09, node-10, node-11, node-12, node-13, node-14, node-15, node-16
from bolt.
Since this issue was first opened, Bolt now supports:
a) multiple --target
options
b) space-separated target lists (only as a single CLI argument)
c) reading targets from STDIN
d) inventory globbing
That means there are quite a few ways to accomplish this now, depending on the use case:
$ bolt inventory show -t\ foo-{1..10}
$ bolt inventory show -t `echo foo-{1..10}`
$ echo foo-{1..10} | bolt inventory show -t -
$ bolt inventory show -t foo-*
The version specifically requested of the ability to use multiple bare (without a flag prepended) CLI args as targets isn't supported, but I think there are plenty of similar options.
from bolt.
FYI i did some work on this just now, not from the CLI but from an inventory file perspective. In my work you can use ERB to generate some YAML, then the YAML will be parsed and the structured data returned from the plugin. This results in us being able to use ERB to generate a ranges of hosts:
Example inventory:
version: 2
groups:
- name: hosts_range
targets:
_plugin: task
task: inventory_utils::erb_template
parameters:
parse: yaml
template: |
<% (0..10).each do |num| %>
- web<%= '%02d' % num %>.domain.tld
<% end %>
Example nodes generated and available in Bolt:
$ bolt inventory show --targets hosts_range
web00.domain.tld
web01.domain.tld
web02.domain.tld
web03.domain.tld
web04.domain.tld
web05.domain.tld
web06.domain.tld
web07.domain.tld
web08.domain.tld
web09.domain.tld
web10.domain.tld
11 targets
from bolt.
Related Issues (20)
- Dynamic Inventory with PuppetDB Fails with Self-Signed Certificate
- Apply does not work on local transport with bundled-ruby=false for latest puppet 7 agents HOT 1
- install module with ssh transport HOT 2
- Sometimes modules take a very long time to install HOT 2
- Add stub/mock for prompt::menu
- Plan not running in order HOT 2
- Packaged Moduls doesn`t get loaded
- Update "Run Bolt from a Docker image" doc page
- Individual language errors should be logged on "Language validation logged N errors. Giving up"
- Windows: Unable to run .ps1 task with pwsh.exe (powershell-core/powershell 7) HOT 2
- Error running multiple tasks on a single target node at one time HOT 3
- Docs not deployed? HOT 1
- Show warning when no host has been matched while install
- Applying Puppet plans fails on Debian 12 Bookworm targets HOT 5
- Allow user to use ssh key agent for ssh transport auth
- Provide MacOS puppet-bolt Homebrew cask installers with the arm64 architecture HOT 2
- Error behavior when bolt can't sudo without askpass in `--run-as root` mode is confusing
- release bolt version with latest facter HOT 1
- [FR] Ability to set `mode`/`group`[/`owner`] in `write_file()` and `upload_file()` functions
- "custom_facts.rb" fails to launch on some targets if Puppet has been installed on the target using the system package manager
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bolt.