Comments (9)
There isn't currently, but I think we can have a way to expose that.
The Solution
This should be a new subcommand bolt groups show
, which will need a new elsif
in this block: https://github.com/puppetlabs/bolt/blob/master/lib/bolt/cli.rb#L291-L311. That should call a new function in cli.rb
called list_groups
, which should be defined right after the def list_targets
definition and look like this:
def list_groups
groups = inventory.group_names
outputter.print_groups(groups)
end
Then we'll need to define simple formatted output in both the JSON and human outputters (https://github.com/puppetlabs/bolt/tree/master/lib/bolt/outputter).
Testing should include printing nothing when the inventory is empty, and test for inventory versions 1 and 2.
from bolt.
To keep this aligned with the behavior of the task and plan show commands it should be:
$bolt group show
mygroup_01
mygroup_02
mygroup_03
$bolt group show mygroup_01
foo-001
foo-002
foo-003
If the goal is autocompletion should the object be groups or targets?
bolt target show
mygroup_01
mygroup_02
mygroup_03
foo-001
foo-002
foo-003
Latter bolt target show mygroup_01
could be added to show more info about the group itself.
from bolt.
Sounds good :-)
from bolt.
We now have a command bolt inventory show
(https://puppet.com/docs/bolt/latest/bolt_command_reference.html#inventory-show) which accepts a TargetSpec and lists nodes that match that spec. This includes listing groups in the inventory, so bolt inventory show -n mygroupname
will list nodes in that group. Let me know if this issue needs to be reopened.
from bolt.
Clone the recent repository: https://github.com/puppetlabs/bolt and executed bolt directly in the repository.
Played around with the first example of https://puppet.com/docs/bolt/latest/inventory_file.html#inventory-facts-vars-and-features
How can i gather the list of group-names? (this is essential for the bash completion)
Also other things are working not in a expected way:
# ok
$ bolt inventory show -n all
10.23.27.148
10.23.27.149
10.23.27.150
10.23.27.151
10.23.27.152
10.23.27.153
10.23.27.154
10.23.27.155
# wrong: result should be 192.168.100.179, 192.168.100.180, 192.168.100.181
$ bolt inventory show -n webservers
webservers
1 target
# wrong: result should be 192.168.100.179, 192.168.100.180, 192.168.100.181,192.168.101.50, 192.168.101.60
$ bolt inventory show -n ssh_nodes
ssh_nodes
1 target
# wrong: execution should be on 192.168.100.179, 192.168.100.180, 192.168.100.181,192.168.101.50
$ bolt command run "uptime" -n ssh_nodes
Started on ssh_nodes...
Failed on ssh_nodes:
Failed to connect to ssh_nodes: getaddrinfo: Name or service not known
Failed on 1 node: ssh_nodes
an on 1 node in 0.1 sec
from bolt.
Can you post a (scrubbed) version of your inventory? Are you using inventory version 1 or 2?
from bolt.
It's working as expected for me locally with both inventory v1 and v2...
from bolt.
I am sorry, i accidentally placed the example to ~/.bolt/inventory.yaml.
The correct location "~/.puppetlabs/bolt/inventory.yaml
" contained a outdated file.
Probably it is a good idea to enhance the last line "x targets" with the origin of the targets.
(i.e. '12 targets, loaded from "~/.puppetlabs/bolt/inventory.yaml" ')
How can i query the list of group-names? (this is essential for shell completion)
from bolt.
Probably it is a good idea to enhance the last line "x targets" with the origin of the targets.
(i.e. '12 targets, loaded from "~/.puppetlabs/bolt/inventory.yaml" ')
^^ would be a great addition too.
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.