From 527259a43ab03d5d7f2567ba4efba08d0f6b36ca Mon Sep 17 00:00:00 2001 From: Matthias Hemmerich Date: Tue, 19 Nov 2024 14:44:50 +0100 Subject: [PATCH 1/2] add check for bootstrap file, make task idempotent --- roles/client/tasks/bootstrap.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/client/tasks/bootstrap.yml b/roles/client/tasks/bootstrap.yml index 2ff6bb8..787ba77 100644 --- a/roles/client/tasks/bootstrap.yml +++ b/roles/client/tasks/bootstrap.yml @@ -4,7 +4,13 @@ msg: Set uyuni_server to a valid server hostname/FQDN when: uyuni_server is undefined +- name: Check if the uyuni_repo_file exists + ansible.builtin.stat: + path: "{{ uyuni_repo_file }}" + register: stat_uyuni_repo_file + - name: Download Uyuni bootstrap script + when: stat_uyuni_repo_file.stat.exists == false ansible.builtin.get_url: url: "http://{{ uyuni_server }}/pub/bootstrap/{{ uyuni_bootstrap_filename }}" dest: "{{ uyuni_bootstrap_folder }}/bootstrap.sh" From 84e0003fe5ca9f68f919220624b2ac79b84f7365 Mon Sep 17 00:00:00 2001 From: Matthias Hemmerich Date: Tue, 19 Nov 2024 14:48:32 +0100 Subject: [PATCH 2/2] fix typo in task name --- roles/client/tasks/bootstrap.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/client/tasks/bootstrap.yml b/roles/client/tasks/bootstrap.yml index 787ba77..62ceeac 100644 --- a/roles/client/tasks/bootstrap.yml +++ b/roles/client/tasks/bootstrap.yml @@ -26,7 +26,7 @@ creates: "{{ uyuni_repo_file }}" become: true -- name: Remove downloded bootsrap script +- name: Remove downloaded bootstrap script ansible.builtin.file: path: "{{ uyuni_bootstrap_folder }}/bootstrap.sh" state: absent