From 5ec8cf441856165e09e876cd121ec302cb3f21a8 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Sat, 8 Apr 2023 00:33:24 +0200 Subject: [PATCH] removed meta dependencies, added task to install required roles --- README.md | 2 +- meta/main.yml | 3 +-- tasks/prerequisites.yml | 8 ++++++++ vars/main.yml | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f25a77e..e65303a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This variable is a list of packages, with their name, desired version and state. Dependencies ------------ -This role requires `ednxzu.manage_apt_packages` to install python3 and pip. If you already installed python and pip, you can skip dependencies by setting `manage_pip_packages_install_prereqs` to `false`. +This role has a task that installs its own dependencies located in `task/prerequisites.yml`, so that you don't need to manage them. This role requires `ednxzu.manage_apt_packages` to install python3 and pip. If you already installed python and pip, you can skip dependencies by setting `manage_pip_packages_install_prereqs` to `false`. Example Playbook ---------------- diff --git a/meta/main.yml b/meta/main.yml index 8eea758..3b87c5a 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -22,5 +22,4 @@ galaxy_info: - 'pip' - 'packages' -dependencies: - - name: ednxzu.manage_apt_packages +dependencies: [] diff --git a/tasks/prerequisites.yml b/tasks/prerequisites.yml index e9b74b2..fd75e09 100644 --- a/tasks/prerequisites.yml +++ b/tasks/prerequisites.yml @@ -1,5 +1,13 @@ --- # task/prerequisites file for manage_pip_packages +- name: "Install required roles" + ansible.builtin.command: + cmd: "ansible-galaxy install {{ item }}" + loop: "{{ manage_pip_packages_prerequisites_roles }}" + changed_when: false + delegate_to: localhost + run_once: true + - name: "Install python3 and pip" ansible.builtin.include_role: name: ednxzu.manage_apt_packages diff --git a/vars/main.yml b/vars/main.yml index 5c50282..f84c530 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,5 +1,7 @@ --- # vars file for manage_pip_packages +manage_pip_packages_prerequisites_roles: + - ednxzu.manage_apt_packages manage_pip_packages_required_packages: - name: python3 version: latest