From 74d5adc21eda3a5136c58051fde02c7a909b16ff Mon Sep 17 00:00:00 2001 From: liquidat Date: Tue, 22 Jun 2021 22:47:40 +0200 Subject: [PATCH] Move ansible.posix and community.general installation to control-node main --- roles/control_node/tasks/f5.yml | 2 -- roles/control_node/tasks/main.yml | 28 +++++++++------------------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/roles/control_node/tasks/f5.yml b/roles/control_node/tasks/f5.yml index 3292f79cd..433f86c1b 100644 --- a/roles/control_node/tasks/f5.yml +++ b/roles/control_node/tasks/f5.yml @@ -26,8 +26,6 @@ register: f5networks loop: - f5networks.f5_modules - - community.general - community.docker - - ansible.posix until: f5networks is not failed retries: 5 diff --git a/roles/control_node/tasks/main.yml b/roles/control_node/tasks/main.yml index 1ee4276a1..bb3767c4e 100644 --- a/roles/control_node/tasks/main.yml +++ b/roles/control_node/tasks/main.yml @@ -23,27 +23,17 @@ group: "{{ username }}" state: directory -- name: make sure .ansiblt is created - file: - path: "/home/{{username}}/.ansible/" - owner: "{{ username }}" - group: "{{ username }}" - state: directory - # we need a collection to be present on the control node -- name: install community.general collection - command: - cmd: "ansible-galaxy collection install -f -p /home/{{ username }}/.ansible/collections/ community.general" - -- name: fix collection ownership permissions - file: - path: "/home/{{ username }}/.ansible/collections" - state: directory - owner: "{{ username }}" - group: "{{ username }}" - mode: 755 - recurse: yes +- name: install necessary collections + become_user: "{{ username }}" + shell: "ansible-galaxy collection install {{ item }} --force-with-deps " + register: controlcollections + loop: + - community.general + - ansible.posix + until: controlcollections is not failed + retries: 5 # This may look redundant, but you can't put these in a loop because the # ansible_user will not be templated the way you expect when running under