Skip to content

Commit 028aeb6

Browse files
committed
added become: true for fetching orachk report. create /tmp/orachk/ for the local reports. added specific name to local tmp file and code to remove when no longer needed
1 parent 6d9ed2b commit 028aeb6

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

check-oracle.yml

+21-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
become: false
9292
local_action:
9393
module: command
94-
cmd: gcloud storage cp "{{ AHF_LOCATION }}" "{{ local_ahf_path }}"
94+
cmd: gcloud storage cp --verbosity=debug "{{ AHF_LOCATION }}" "{{ local_ahf_path }}"
9595
register: gsutil_result
9696
changed_when: gsutil_result.rc == 0
9797

@@ -240,8 +240,10 @@
240240

241241
- name: Get a tmpfile name
242242
set_fact:
243-
TMPFILE: "{{ lookup('pipe','mktemp') }}"
243+
TMPFILE: "{{ lookup('pipe','mktemp -t orachk.XXXXXX') }}"
244244

245+
# create a temporary log file from the orachk run
246+
# this can be used the location of the zip file created by ORAchk
245247
- name: Run ORAchk
246248
become: true
247249
shell: "ORACLE_PATH={{ orachk_script_dir }} SQLPATH={{ orachk_script_dir }} {{ ORACHK_BASE }}/orachk/orachk -s -dbconfig {{ ORACLE_HOME }}%{{ ORACLE_SID }} -showpass -profile dba | tee {{ TMPFILE }}"
@@ -270,6 +272,7 @@
270272
ORACHK_RPT_FILE: "{{ orachk_file_info.stdout }}"
271273

272274
- name: Verify ORAchk Report File Existence
275+
become: true
273276
stat:
274277
path: "{{ ORACHK_RPT_FILE }}"
275278
register: orachk_rpt_location
@@ -279,13 +282,28 @@
279282
msg: "Could not locate ORAchk report file {{ ORACHK_RPT_FILE }}"
280283
when: not orachk_rpt_location.stat.exists
281284

285+
- name: Create /tmp/orachk directory for the zip files
286+
become: false
287+
file:
288+
path: /tmp/orachk/
289+
state: directory
290+
mode: "0700"
291+
282292
- name: Fetch the ORAchk zipfile
293+
become: true
283294
fetch:
284295
src: "{{ ORACHK_RPT_FILE }}"
285-
dest: /tmp/
296+
dest: /tmp/orachk/
286297
flat: true
287298
register: fetch_result
288299

300+
- name: Remove temporary file on controller
301+
file:
302+
path: "{{ TMPFILE }}"
303+
state: absent
304+
delegate_to: localhost
305+
when: TMPFILE is defined
306+
289307
- name: Deconfigure Expedited Testing
290308
become: true
291309
shell: cd "{{ ORACHK_BASE }}/orachk/" && [[ -r orachk.orig ]] && rm -f orachk && mv orachk.orig orachk && rm -f orachk-quicktest.sh

0 commit comments

Comments
 (0)