From 3a79d9d63050e4afc6a4b72af64125dd34e5b726 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 29 Aug 2025 10:53:36 +0200 Subject: [PATCH] Optimized pkgmgr variables and removed 'Ensure main.py is executable' because it should be preset by repositories itself --- roles/pkgmgr/tasks/01_core.yml | 16 +++++----------- roles/pkgmgr/templates/config.yaml.j2 | 4 ++-- roles/pkgmgr/vars/main.yml | 22 +++++++++++----------- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/roles/pkgmgr/tasks/01_core.yml b/roles/pkgmgr/tasks/01_core.yml index b2d14cd2..ed0b194e 100644 --- a/roles/pkgmgr/tasks/01_core.yml +++ b/roles/pkgmgr/tasks/01_core.yml @@ -16,29 +16,23 @@ - name: Create installation directory for Kevin's Package Manager file: - path: "{{ pkgmgr_install_path }}" + path: "{{ PKGMGR_INSTALL_PATH }}" state: directory mode: '0755' become: true - name: Clone Kevin's Package Manager repository git: - repo: "{{ pkgmgr_repo_url }}" - dest: "{{ pkgmgr_install_path }}" + repo: "{{ PKGMGR_REPO_URL }}" + dest: "{{ PKGMGR_INSTALL_PATH }}" version: "HEAD" force: yes become: true -- name: Ensure main.py is executable - file: - path: "{{ pkgmgr_install_path }}/main.py" - mode: '0755' - become: true - - name: create config.yaml template: src: config.yaml.j2 - dest: "{{ pkgmgr_config_path }}" + dest: "{{ PKGMGR_CONFIG_PATH }}" become: true - name: Run the Package Manager install command to create an alias for Kevins package manager @@ -46,6 +40,6 @@ source ~/.venvs/pkgmgr/bin/activate make setup args: - chdir: "{{ pkgmgr_install_path }}" + chdir: "{{ PKGMGR_INSTALL_PATH }}" executable: /bin/bash become: true diff --git a/roles/pkgmgr/templates/config.yaml.j2 b/roles/pkgmgr/templates/config.yaml.j2 index 40b35306..c5b19936 100644 --- a/roles/pkgmgr/templates/config.yaml.j2 +++ b/roles/pkgmgr/templates/config.yaml.j2 @@ -1,3 +1,3 @@ directories: - repositories: "{{repositories_directory}}" - binaries: "{{binaries_directory}}" \ No newline at end of file + repositories: "{{ PKGMGR_REPOSITORIES_DIR }}" + binaries: "{{ PKGMGR_BINARIES_DIR }}" \ No newline at end of file diff --git a/roles/pkgmgr/vars/main.yml b/roles/pkgmgr/vars/main.yml index 63890c4d..fb264105 100644 --- a/roles/pkgmgr/vars/main.yml +++ b/roles/pkgmgr/vars/main.yml @@ -2,16 +2,16 @@ # Variables for Kevin's Package Manager installation # The Git repository URL for Kevin's Package Manager -pkgmgr_repo_url: "https://github.com/kevinveenbirkenbach/package-manager.git" - -# Directory which contains all Repositories managed by Kevin's Package Manager -repositories_directory: "/opt/Repositories/" - -# The directory where the repository will be cloned -pkgmgr_install_path: "{{repositories_directory}}github.com/kevinveenbirkenbach/package-manager" - -# File containing the configuration -pkgmgr_config_path: "{{pkgmgr_install_path}}/config/config.yaml" +PKGMGR_REPO_URL: "https://github.com/kevinveenbirkenbach/package-manager.git" # The directory where executable aliases will be installed (ensure it's in your PATH) -binaries_directory: "/usr/local/bin" +PKGMGR_BINARIES_DIR: "/usr/local/bin" + +# Directory which contains all Repositories managed by Kevin's Package Manager +PKGMGR_REPOSITORIES_DIR: "/opt/Repositories/" + +# The directory where the repository will be cloned +PKGMGR_INSTALL_PATH: "{{ [ PKGMGR_REPOSITORIES_DIR, 'github.com/kevinveenbirkenbach/package-manager' ] | path_join }}" + +# File containing the configuration +PKGMGR_CONFIG_PATH: "{{ [ PKGMGR_INSTALL_PATH, 'config/config.yaml' ] | path_join }}"