Adding Additional Inventory

Many configuration layers may be present in a single configuration for larger systems that configure multiple Cray products. When common values for each of these layers need to be customized, it can be tedious to override values in each of the respective repositories. The CFS additional_inventory_url option allows for static inventory files to be automatically added to the hosts directory of the Ansible Execution Environment (AEE). This allows the additional Ansible inventory information to be available to all configuration layers in a session.

Additional inventory is stored in a Git repository in VCS with the inventory files in the base directory of the repository. The following is an example of an inventory repository:

02-static-inventory.ini
03-my-dynamic-inventory.py
group_vars/...
host_vars/...

For ordering purposes, inventory generated by CFS will also be placed in the hosts directory with the name 01-cfs-generated.yaml. For more information, see Dynamic inventory. The result is that CFS will provide the following inventory to Ansible when running a configuration session:

hosts/01-cfs-generated.yaml
hosts/02-static-inventory.ini
hosts/03-my-dynamic-inventory.py
hosts/group_vars/...
hosts/host_vars/...

Setting additional inventory globally

The additional_inventory_url option is optional and can be set on a global CFS level.

CFS will clone the additional inventory Git repository and use the default branch to populate the hosts directory. Only one inventory repository can be specified globally, and it will apply to all CFS sessions.

(ncn-mw#) Use the following command to set the additional_inventory_url value:

cray cfs v3 options update --additional-inventory-url https://api-gw-service-nmn.local/vcs/cray/inventory.git

(ncn-mw#) Use the following command to unset the additional_inventory_url value:

cray cfs options update --additional-inventory-url ""

Setting additional inventory for a configuration

A static inventory often changes along with the Ansible content, and CFS users may need to test different configuration values simultaneously and not be forced to use the global additional_inventory_url. Therefore, an additional_inventory mapping can be added to the CFS configuration. Similar to a standard configuration layer, the additional inventory only requires a commit and repository clone URL, and it overrides the global additional_inventory_url if it is specified in the global CFS options.

Example configuration:

{
  "layers": [
    {
      "name": "configurations-layer-example-1",
      "clone_url": "https://api-gw-service-nmn.local/vcs/cray/example-repo.git",
      "playbook": "site.yml",
      "commit": "<git commit id>"
    }
  ],
  "additional_inventory": {
    "clone_url": "https://api-gw-service-nmn.local/vcs/cray/inventory.git",
    "commit": "a7d08b6e1be590ac01711e39c684b6893c1da0a9"
  }
}