feature: added more root paths and a dictionary of root paths for specific purposes
This commit is contained in:
19
whereami.py
19
whereami.py
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user