feature: added more root paths and a dictionary of root paths for specific purposes

This commit is contained in:
2026-01-21 09:20:25 -05:00
parent 73472cb073
commit 2df09c8087

View File

@@ -2,8 +2,25 @@
Library of path constants to be used or referenced elsewhere. Library of path constants to be used or referenced elsewhere.
""" """
from custtypes import ExecutedPath from custtypes import ExecutedPath, Roles, Scopes, AnsibleScopes
from pathlib import Path from pathlib import Path
USER_PATH: ExecutedPath = Path.home() USER_PATH: ExecutedPath = Path.home()
PROJ_ROOT: ExecutedPath = Path(__file__).parent.resolve() PROJ_ROOT: ExecutedPath = Path(__file__).parent.resolve()
PROJ_ROLES: ExecutedPath = PROJ_ROOT / "roles"
APP_ROOTS = {
Roles.CONF.name.lower(): {
Scopes.SYS.name.lower(): Path("/etc"),
Scopes.USER.name.lower(): USER_PATH / ".config",
Scopes.SHARED.name.lower(): Path("/usr/share"),
Scopes.PROJ.name.lower(): tuple(list(PROJ_ROLES.glob("**/files")) + list(PROJ_ROLES.glob("**/templates")))
}
}
ANSIBLE_ROOTS = {
AnsibleScopes.GROUPVARS.name.lower(): PROJ_ROOT / "group_vars",
AnsibleScopes.HOSTVARS.name.lower(): PROJ_ROOT / "host_vars",
AnsibleScopes.INVENTORY.name.lower(): None,
AnsibleScopes.ROLE.name.lower(): None
}