Skip to content

Commit

Permalink
Merge pull request #287 from zakx/issue-286
Browse files Browse the repository at this point in the history
[WIP] documentation enhancements regarding #286
  • Loading branch information
trehn committed Jul 9, 2017
2 parents 97f81ba + 61d6f08 commit 760500c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/content/repo/nodes.py.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ You are not confined to the static way of defining a node list as shown above. Y
return ldap_nodes

nodes = get_my_nodes_from_ldap()
<br>

# One file per node

Especially in larger installations, a single nodes.py can become inconvenient to work with. This example reads nodes from a `nodes/` directory.

from glob import glob

nodes = {}
for node in glob("nodes/*.py"):
with open(node, 'r') as f:
exec(f.read())

Node files would then append `nodes`, like this:

# nodes/node-1.py
nodes['node-1'] = {
'hostname': "node-1.example.com",
}

<br>

Expand Down

0 comments on commit 760500c

Please sign in to comment.