Discover Command Type

The Discover command interact with the Choria Discovery system used to find fleet nodes based on a vast array of possible queries and data sources.

Since this is built into Choria it will simply use your Choria Client configuration for the user executing the command to find the Choria Brokers and more. It supports the usual override methods such as creating a choria.conf file in your project working directory. No connection properties are required or supported.

Before using this command type I suggest reading about the Choria Discovery System.

Version Hint

This feature is only available when hosting App Builder applications within the Choria Server version 0.26.0 or newer

Overview

This command supports all the standard properties like Arguments, Flags, Banners and more, below is a simply command that finds apache servers.

name: find
description: Finds all machines tagged as Apache Servers
type: discover

std_filters: true
filter:
  classes:
    - roles::apache

When run it will show a list of matching nodes, one per line. It also accepts the --json flag to enable returning a JSON array of matching nodes.

Since the std_filters option is set the command will also accept additional filters in standard Choria format. Flags like -C, -F, discovery mode selectors and more. User supplied options will be merged/appended with the ones supplied in the YAML file. By default, none of the standard Choria flags will be added to the CLI.

All the filter values, even arrays and objects, support templating.

Filter Reference

The main tunable here is the filter, below a reference of available options. The examples here are a bit short, I suggest you read the Choria Discovery Documentation for a thorough understanding.

KeyDescriptionExample
collectiveThe collective to target, defaults to main collectivecollective: development
factsList of fact filters as passed to -Ffacts: ["country=uk"]
agentsList of agent filters as passed to -Aagents: ["puppet"]
classesList of Config Management classes to match as passed to -Cclasses: ["apache"]
identitiesList of node identities to match as passed to -Iidentities:["/^web/"]
combinedList of Combined filters as passed to -Wcombined:["/^web/","location=uk"]
compoundA single Compound filter as passed to -Scompound: "with('apache') or with('nginx')
discovery_methodA discovery method to use like inventory as passed to --dmdiscovery_method:"flatfile"
discovery_optionsA set of discovery options, specific to the discovery_method chosendiscovery_options: {"file":"/etc/inventory.yaml"}
discovery_timeoutHow long discovery can run, in seconds, as passed to --discovery-timeoutdiscovery_timeout: 2
dynamic_discovery_timeoutEnables windowed dynamic timeout rather than a set discovery timeoutdynamic_discovery_timeout: true
nodes_fileShort cut to use flatfile discovery with a specific file, as passed to --nodesnodes_file: /etc/fleet.txt