Hosts inventory

While running playlabs with @hostname arguments is nice to experiment with, it won’t scale with many machines nor will be convenient to automate playlabs calls. Most roles require an inventory to be really fun.

Pre-requisite

Clone the inventory repository that you have been given if any. If it doesn’t work, make sure that the git server knows your ssh public key if authenticating with SSH.

If you haven’t been given an inventory repository to clone, create one with the scaffolt command (note that you can have as many inventories as you want):

playlabs scaffold your-inventory

Adding a new host

Hosts are defined in the inventory.yml file of the inventory repository, use the all variable to add them in no specific group:

all:
  hosts:
    yourhost.com:  # adds a host with no extra option
    otherhost:
      fqdn: yourdomain.tld
      ansible_port: 22
      ansible_host: 123.12.12.23

Setting host groups

You can link hosts to groups in the children variable of the inventory.yml YAML document. For example, if you want playlabs install ssh,netdata without argument (for CI likely) to apply on otherhost, then this will work:

children:
  netdata-ssh:
    hosts:
      otherhost