From d8691bfd428c74158b4273d2208c6f1d0c394673 Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Tue, 14 May 2024 10:34:29 +0200 Subject: [PATCH] ACA-1487: Fix creation of temp files Signed-off-by: Ondra Machacek --- changelogs/fragments/28-fix-temp-file-creation.yml | 3 +++ roles/info/tasks/appliance_info.yml | 9 +++++++-- roles/info/tasks/cluster_info.yml | 5 +++++ roles/info/tasks/guest_info.yml | 5 +++++ roles/info/tasks/license_info.yml | 5 +++++ roles/info/tasks/storage_info.yml | 5 +++++ 6 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/28-fix-temp-file-creation.yml diff --git a/changelogs/fragments/28-fix-temp-file-creation.yml b/changelogs/fragments/28-fix-temp-file-creation.yml new file mode 100644 index 00000000..27576265 --- /dev/null +++ b/changelogs/fragments/28-fix-temp-file-creation.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - info - Fix creation of temporary files diff --git a/roles/info/tasks/appliance_info.yml b/roles/info/tasks/appliance_info.yml index 4a4ac65b..62431a1e 100644 --- a/roles/info/tasks/appliance_info.yml +++ b/roles/info/tasks/appliance_info.yml @@ -5,11 +5,16 @@ password: "{{ info_password }}" port: "{{ info_port | d(omit) }}" validate_certs: "{{ info_validate_certs }}" - gather: "{{ info_appliance_gather }}" + properties: "{{ info_appliance_gather }}" register: __apliance +- name: Make sure directory exists + ansible.builtin.file: + path: "{{ info_appliance_file | dirname }}" + state: "directory" + - name: Create JSON file from fetched data ansible.builtin.copy: - content: "{{ __apliance | map(attribute='appliance') | to_json }}" + content: "{{ __apliance.appliance | to_json }}" dest: "{{ info_appliance_file }}" mode: "0644" diff --git a/roles/info/tasks/cluster_info.yml b/roles/info/tasks/cluster_info.yml index 89e85840..6dbcf552 100644 --- a/roles/info/tasks/cluster_info.yml +++ b/roles/info/tasks/cluster_info.yml @@ -26,6 +26,11 @@ tags: - cluster +- name: Make sure directory exists + ansible.builtin.file: + path: "{{ info_cluster_file | dirname }}" + state: "directory" + - name: Create JSON file from fetched data ansible.builtin.copy: content: "{{ __clusters_info.results | map(attribute='clusters') | to_json }}" diff --git a/roles/info/tasks/guest_info.yml b/roles/info/tasks/guest_info.yml index d96587bf..8c7bc156 100644 --- a/roles/info/tasks/guest_info.yml +++ b/roles/info/tasks/guest_info.yml @@ -7,6 +7,11 @@ validate_certs: "{{ info_validate_certs }}" register: __guests +- name: Make sure directory exists + ansible.builtin.file: + path: "{{ info_guest_file | dirname }}" + state: "directory" + - name: Create JSON file from fetched data ansible.builtin.copy: content: "{{ __guests | to_json }}" diff --git a/roles/info/tasks/license_info.yml b/roles/info/tasks/license_info.yml index b880f19a..911fdfaf 100644 --- a/roles/info/tasks/license_info.yml +++ b/roles/info/tasks/license_info.yml @@ -7,6 +7,11 @@ validate_certs: "{{ info_validate_certs }}" register: __license +- name: Make sure directory exists + ansible.builtin.file: + path: "{{ info_license_file | dirname }}" + state: "directory" + - name: Create JSON file from fetched data ansible.builtin.copy: content: "{{ __license.licenses | to_json }}" diff --git a/roles/info/tasks/storage_info.yml b/roles/info/tasks/storage_info.yml index 666b165b..87c16788 100644 --- a/roles/info/tasks/storage_info.yml +++ b/roles/info/tasks/storage_info.yml @@ -7,6 +7,11 @@ validate_certs: "{{ info_validate_certs }}" register: __storage_policy +- name: Make sure directory exists + ansible.builtin.file: + path: "{{ info_storage_file | dirname }}" + state: "directory" + - name: Create JSON file from fetched data ansible.builtin.copy: content: "{{ __storage_policy.spbm_profiles | to_json }}"