Files
skato-ansible/whereami.py

26 lines
879 B
Python

"""
Library of path constants to be used or referenced elsewhere.
"""
from custtypes import ExecutedPath, Roles, Scopes, AnsibleScopes
from pathlib import Path
USER_PATH: ExecutedPath = Path.home()
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
}