Skip to main content

documentation license pipelines coverage

Ansible Roster Inventory Plugin

Roster is an Ansible inventory plugin with focus on groups applied to hosts instead of hosts included in groups. It supports ranges (eg: "[0:9]"), regex hostnames (eg: "(dev|prd)-srv"), file inclusions, and variable merging.

This inventory plugin has been written with debops in mind.

Installation from Ansible Galaxy

You can install the latest version from Ansible Galaxy repository.

ansible-galaxy collection install -U julien_lecomte.roster
python3 -mpip install boltons cerberus exrex

If you are using requirement.yml files for downloading collections and roles, add these lines:

collections:
  - julien_lecomte.roster

Installation from PyPI

You can install the latest version from PyPI package repository.

python3 -mpip install -U ansible-roster

Quickstart

Please refer to the full documentation for all the details.

The roster is a file in yaml format and 'yml' or 'yaml' file extension.

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, or in your .debops.cfg if using debops. If using debops, refresh the configuration with debops project refresh.

Sample ansible.cfg

[defaults]
# 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
inventory = roster.yml

[inventory]
# You must enable the roster plugin if 'auto' does not work for you.
# Use 'roster' if installed via the Python package,
# Use 'julien_lecomte.roster.roster' if installed via Ansible Galaxy
enable_plugins = julien_lecomte.roster.roster

Sample .debops.cfg

[ansible inventory]
enabled = roster
# Use 'roster' if installed via the Python package,
# Use 'julien_lecomte.roster.roster' if installed via Ansible Galaxy
enable_plugins = julien_lecomte.roster.roster

Sample roster.yml

---
# This line is mandatory, and enables the plugin differenciating between
# any yaml file and a roster yaml file.
plugin: roster

vars:
  foobar01: "a global var"

groups:
  debian:
    vars:
      distrib: "debian"
  buster:
    parents:
      - debian
    vars:
      release: "buster"
  desktops:
    vars:
      components: "main contrib non-free"

hosts:
  desktop01.internal.example.com:
    groups:
      - desktops
      - buster

A larger example Roster inventory for DebOps can be found here: https://gitlab.com/jlecomte/ansible/ansible-roster-example.

License

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

Support

Show your support by joining the Discord server (link below), or by adding a star to the project.

Locations

Metadata

Release files for ansible-roster 1.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ansible-roster 1.1.6
File Size Uploaded
ansible-roster-1.1.6.tar.gz 15.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ansible-roster 1.1.6
File Interpreter ABI Platform
ansible_roster-1.1.6-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 26.0 kB

Release files / ansible-roster-1.1.6.tar.gz

Download URL ansible-roster-1.1.6.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ffb207818d0f92c938b29b421aa53fce6064532142e8099f15d0ceb8298e2fb0
BLAKE2b-256 checksum
How to use checksums
075c2ca1ffc56219be7745e8ab8744f856b35c629369adcc79352ee5c14faaea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / ansible_roster-1.1.6-py2.py3-none-any.whl

Download URL ansible_roster-1.1.6-py2.py3-none-any.whl
Size 11.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
fa2de15c693dffa1fde3a37804a35865ae2312405927bac9319b0f33e3fbc606
BLAKE2b-256 checksum
How to use checksums
57cab18f56b2cff385fb7dbe0d80407436d48013332094fd8f869b4afc5105d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.1.6 This release

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page