pyinfra-dev / pyinfra-dev/pyinfra

Possible new pattern: Combine inventory / group_data ?

Open
#975 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API discussion
Dominant language
Python
Stars
6k
Forks
548
Avg merge
7d 17h
Merged PRs (30d)
13

Description

I've been playing with combining inventory + group_data files lately, since group_data tends to be directly associated with a group of hosts inside an inventory file. Seems to work out of the box, the only thing one has to remember is:

  • group_data must be name=value.
  • Dicts and lists are interpreted as inventory.

Seems to be a pretty decent architectural simplification for pyinfra, eliminates the need for a separate directory full of group_data.

Thoughts?

Sample (ex: pyinfra/inventory/production.py)
from inventory.__common__ import *

role = 'production'
url = ''

user_name = 'guy'
user_password = ''

workspace = f'/home/{user_name}/workspace'

ssh_user = user_name
ssh_port = 22
ssh_key = f'../keys/{role}/{role}'

hosts = [
	('10.0.0.80', {**locals()}),
	('10.0.0.81', {**locals()}),
	('10.0.0.82', {**locals()}),
]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides the example file pyinfra/inventory/production.py but names no implementation entry point or test. Start by locating how inventory and group_data are currently loaded, then establish whether the proposed combined pattern is supported and what tests and documentation would define completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.