commit f4abb0d0b9f41a87df81b8d97f119e3969b23252
parent 73d2c50ff81383592114f11575e0bbada9c63f03
Author: Asher Morgan <asher@ashermorgan.net>
Date: Tue, 8 Sep 2026 08:51:02 -0700
Remove AOH_PLAYBOOKS_DIR option
Not worth the (very minor) additional complexity. File paths will be
interpreted relative to $AOH_PLAYBOOKS_FILE instead.
Diffstat:
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
@@ -62,9 +62,6 @@ environment variables or a `.env` file.
playbooks (see below). Defaults to `/aoh/passwords.yml` when running the
Docker image and `./passwords.yml` otherwise.
-- `AOH_PLAYBOOKS_DIR`: The default directory to search for playbooks in.
- Defaults to the directory containing `AOH_PLAYBOOKS_FILE`.
-
- `AOH_PLAYBOOKS_FILE`: The file containing playbook configuration (see below).
Defaults to `/aoh/playbooks.yml` when running the Docker image and
`./playbooks.yml` otherwise.
@@ -80,11 +77,12 @@ which must have the following structure:
```yml
main.yml: # The playbook name
- # The path to the playbook, relative to $AOH_PLAYBOOKS_DIR. Defaults to the
+ # The path to the playbook, relative to $AOH_PLAYBOOKS_FILE. Defaults to the
# playbook name.
path: playbooks/playbook.yml
- # The path to an associated Ansible config file, if one exists.
+ # The path to an associated Ansible config file, if one exists, relative to
+ # $AOH_PLAYBOOKS_FILE.
config: playbooks/ansible.cfg
# The hostname to assign to clients. If omitted or null, each client is
diff --git a/aoh/playbook.py b/aoh/playbook.py
@@ -2,8 +2,8 @@ import os
import yaml
-PLAYBOOKS_FILE = os.getenv('AOH_PLAYBOOKS_FILE', 'playbooks.yml')
-PLAYBOOKS_DIR = os.getenv('AOH_PLAYBOOKS_DIR', os.path.dirname(PLAYBOOKS_FILE))
+_PLAYBOOKS_FILE = os.getenv('AOH_PLAYBOOKS_FILE', 'playbooks.yml')
+_PLAYBOOKS_DIR = os.path.dirname(_PLAYBOOKS_FILE)
@@ -51,14 +51,14 @@ class Playbook:
self.extra_args = dict.get('extra_args', [])
self.web_description = dict.get('web_description')
- self.path = os.path.abspath(os.path.join(PLAYBOOKS_DIR, self.path))
- self.config = os.path.abspath(os.path.join(PLAYBOOKS_DIR, self.config))
+ self.path = os.path.abspath(os.path.join(_PLAYBOOKS_DIR, self.path))
+ self.config = os.path.abspath(os.path.join(_PLAYBOOKS_DIR, self.config))
def get_playbook(name):
"""Lookup a playbook configuration."""
- with open(PLAYBOOKS_FILE, 'r') as f:
+ with open(_PLAYBOOKS_FILE, 'r') as f:
CONFIG = yaml.safe_load(f)
if name in CONFIG:
return Playbook(name, CONFIG[name])
diff --git a/demo/playbooks.yml b/demo/playbooks.yml
@@ -1,10 +1,11 @@
main.yml: # The playbook name
- # The path to the playbook, relative to $AOH_PLAYBOOKS_DIR. Defaults to the
+ # The path to the playbook, relative to $AOH_PLAYBOOKS_FILE. Defaults to the
# playbook name.
path: playbooks/playbook.yml
- # The path to an associated Ansible config file, if one exists.
+ # The path to an associated Ansible config file, if one exists, relative to
+ # $AOH_PLAYBOOKS_FILE.
config: playbooks/ansible.cfg
# The hostname to assign to clients. If omitted or null, each client is