inventory.yaml
fields
Use an inventory file to store information about your targets and arrange them into groups. Both targets and groups can include data such as facts or vars and can configure the transports Bolt uses to establish connections with targets.
Top-level fields
The top level of your inventory file contains fields that configure the
implicit all
group. These fields apply to all of the groups and targets in
the inventory file. For more information on inventory files, such as
precedence, see Inventory files
config
A map of configuration options for the implicit all
group. Configuration
set at this level applies to all groups and targets in the inventory file.
For a detailed description of each option, their default values, and any
available sub-options, see Transport configuration
reference.
Type: Hash
config:
transport: ssh
ssh:
host-key-check: false
winrm:
user: bolt
password: hunter2!
facts
A map of system information, also known as
facts,
for the implicit all
group. Facts set at this level apply to all groups and
targets in the inventory file.
Type: Hash
facts:
os:
family: Darwin
features
A list of available features for the implicit all
group. Features set at this
level apply to all groups and targets in the inventory file.
Type: Array
🔩 Tip: You can set the
puppet-agent
feature to indicate that Bolt should skip installing the Puppet agent on all targets when usingbolt apply
or theapply_prep
plan function.
features:
- puppet-agent
groups
A list of groups and their associated configuration.
Type: Array
groups:
- name: linux
targets:
- linux-1.example.com
- linux-2.example.com
- name: windows
targets:
- windows-1.example.com
- windows-2.example.com
targets
A list of targets and their associated configuration.
Type: Array
targets:
- target1.example.com
- target2.example.com
vars
A map of variables for the implicit all
group. Variables set at this level
apply to all groups and targets in the inventory file.
Type: Hash
vars:
ssh_config: /etc/ssh_config
Group objects
Use a groups
field to specify a list of groups, which contain a list of
targets. Each item in the groups
list is a map of data and configuration for
the group. Group objects accept many of the same fields as the implicit all
group.
config
A map of configuration options for the group. Configuration set at this level applies to all groups and targets under the group. For a detailed description of each option, their default values, and any available sub-options, see Transport configuration reference.
Type: Hash
groups:
- name: linux
config:
transport: ssh
ssh:
host-key-check: false
facts
A map of system information, also known as facts, for the group. Facts set at this level apply to all groups and targets under the group.
Type: Hash
groups:
- name: windows
facts:
os:
family: Windows
features
A list of available features for the group. Features set at this level apply to all groups and targets under the group.
Type: Array
🔩 Tip: You can set the
puppet-agent
feature on the group to indicate that Bolt should skip installing the Puppet agent on all targets under the group when usingbolt apply
or theapply_prep
plan function.
groups:
- name: agents
features:
- puppet-agent
groups
A list of groups and their associated configuration.
Type: Array
groups:
- name: servers
groups:
- name: linux
- name: windows
name
The name of the group. Group names must be unique and cannot conflict with the
name of another group or a target, including the implicit all
group. This
option is required.
Type: String
groups:
- name: linux
plugin_hooks
A map of plugin hooks and which plugins a
hook should use for targets in the group. The only configurable plugin hook is
puppet_library
, which configures the plugin used to install the Puppet agent
on targets when plans call apply_prep or the
bolt apply
command or Invoke-BoltApply
PowerShell cmdlet are used.
The puppet_library
plugin hook can use one of two plugins: puppet_agent
or
task
.
Type: Hash
groups:
- name: agents
plugin_hooks:
puppet_library:
plugin: task
task: puppet_agent::install
parameters:
collection: puppet6
targets:
- linux.example.com
- windows.example.com
targets
A list of targets and their associated configuration.
Type: Array
groups:
- name: linux
targets:
- linux-1.example.com
- linux-2.example.com
vars
A map of variables for the group. Vars set at this level apply to all groups and targets under the group.
Type: Hash
groups:
- name: linux
vars:
ssh_config: /etc/ssh_config
Target objects
The targets
field is used to specify a list of targets. Each item in the
targets
list must be one of the following:
A string representation of the target's URI
A map of data and configuration options for the target
When specifying a target using a map of data and configuration, the following fields are available:
alias
A unique alias to refer to the target. Aliases cannot conflict with the name of a group, the name of a target, or another alias.
Type Array
targets:
- uri: linux-1.example.com
alias:
- database
- uri: linux-2.example.com
alias:
- webserver
config
A map of configuration options for the target. A detailed description of each option, their default values, and any available sub-options can be viewed in Transport configuration reference.
Type: Hash
targets:
- uri: windows.example.com
config:
transport: winrm
winrm:
user: bolt
password: hunter2!
facts
A map of system information, also known as facts, for the target.
Type: Hash
targets:
- uri: linux.example.com
facts:
os:
architecture: x86_64
features
A list of available features for the target.
Type: Array
🔩 Tip: You can set the
puppet-agent
feature on the target to indicate that Bolt should skip installing the Puppet agent on the target when usingbolt apply
or theapply_prep
plan function.
targets:
- uri: linux.example.com
features:
- puppet-agent
name
A human-readable name for the target. This option is required unless the uri
option is set.
Type: String
targets:
- name: database
plugin_hooks
A map of plugin hooks and which plugins a
hook should use for the target. The only configurable plugin hook is
puppet_library
, which configures the plugin used to install the Puppet agent
on a target when plans call apply_prep or the
bolt apply
command or Invoke-BoltApply
PowerShell cmdlet are used.
The puppet_library
plugin hook can use one of two plugins: puppet_agent
or
task
.
Type: Hash
targets:
- uri: linux.example.com
plugin_hooks:
puppet_library:
plugin: task
task: puppet_agent::install
parameters:
collection: puppet6
uri
The URI of the target. This option is required unless the name
option is set.
Type: String
targets:
- uri: linux.example.com
vars
A map of variables for the target.
Type: Hash
targets:
- uri: linux.example.com
vars:
ssh_config: /etc/ssh_config
Example file
# inventory.yaml
groups:
- name: ssh_nodes
groups:
- name: webservers
targets:
- 192.168.100.179
- 192.168.100.180
- 192.168.100.181
- name: memcached
targets:
- 192.168.101.50
- 192.168.101.60
config:
ssh:
user: root
config:
transport: ssh
ssh:
user: centos
private-key: ~/.ssh/id_rsa
host-key-check: false
- name: win_nodes
groups:
- name: domaincontrollers
targets:
- 192.168.110.10
- 192.168.110.20
- name: testservers
targets:
- 172.16.219.20
- 172.16.219.30
config:
winrm:
realm: MYDOMAIN
ssl: false
config:
transport: winrm
winrm:
user: DOMAIN\opsaccount
password: S3cretP@ssword
ssl: true