Skip to main content

Ansible simplified yaml inventory

Project description

documentation python

Kheops Ansible Roster Plugin

This repository contains an Ansible inventory plugin to generate inventory from a subjectively simpler inventory description file while having more possibilities.

Supports ranges (eg: "[0:9]") and regex hostnames (eg: "(dev|prd)-srv")


Install latest version:

python3 -mpip install --pre -U kheops-roster


  • Subjectively simpler syntax

  • 'Labels' that behave like groups but that do not create groups.

  • Ranges and Regex support: sql-[0:9], (front|back)end-[0:9]

  • List appending / merging with '+=' operator

  • Glob file inclusion support: '- include: [ "include-*.yml" ]


'Roster' inventory file

The roster inventory file is a typical yaml file.

A sample, commented, file named 'roster.yml.tpl' is located at the root of the git repository.

In order for ansible to use the plugin and parse your roster file, several conditions must be met.

  • Your yaml file must contain a line indicating that the file is in the roster format.

  • You must activate plugins and enable the roster inventory plugin in your ansible.cfg

Sample roster.yml

plugin: roster

  - "includes/file-one.yml"

  global_var: "global_value"


Sample edited ansible.cfg

# The following line prevents having to pass -i to ansible-inventory.
# Filename can be anything as long as it has a 'yml' or 'yaml' extension although
# the plugin will directly accept any file named 'roster.yml'.
inventory = roster.yml

# You must enable the roster plugin if 'auto' does not work for you
enable_plugins = roster

Verify that the plugin is correctly found:

ansible-inventory --graph


To run unit tests, you can simply run the make target:

# run all tests:
make check

It's also possible to quickly check the output inventory:

ANSIBLE_INVENTORY_ENABLED=roster ansible-inventory --list -i roster.yml


This project is licensed under the MIT License - see the LICENSE file for details


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ansible-roster, version 0.3.2
Filename, size File type Python version Upload date Hashes
Filename, size ansible_roster-0.3.2-py2.py3-none-any.whl (10.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size ansible-roster-0.3.2.tar.gz (9.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page