-
Gioacchino Vino authoredGioacchino Vino authored
2-scan.yml 2.82 KiB
---
- name: Set SSH tunel
command: ssh -o StrictHostKeyChecking=no -f -N -L localhost:9390:scans.cloud.infn.it:9390 jenkins@scans.cloud.infn.it
- debug:
var: paas_ci_test.endpoints_to_scan
- name: Copy scan script
copy:
src: files/scan.py
dest: "{{ paas_ci_workdir + '/scan.py' }}"
- name: Copy utilities module
copy:
src: files/scan_utilities.py
dest: "{{ paas_ci_workdir + '/scan_utilities.py' }}"
- name: Copy gvm_library module
copy:
src: files/scan_gvm_library.py
dest: "{{ paas_ci_workdir + '/scan_gvm_library.py' }}"
- name: Adding execution permission to scan script
file:
dest: "{{ paas_ci_workdir + '/scan.py' }}"
mode: a+x
- name: Load depdep log
command: cat "{{ paas_ci_workdir + '/dep.json' }}"
register: dep_json
- name: import depdep_log
set_fact:
imported_depdep_log: "{{ dep_json.stdout }}"
- name: Show depdep log
debug:
var: imported_depdep_log
- name: Show BEFORE paas_ci_test.endpoints_to_scan log
debug:
var: paas_ci_test.endpoints_to_scan
- name: Fail if "bar" is undefined
set_fact:
paas_ci_test.endpoints_to_scan: "None"
when: paas_ci_test.endpoints_to_scan is undefined
- name: Show AFTER paas_ci_test.endpoints_to_scan log
debug:
var: paas_ci_test.endpoints_to_scan
- name: Run scan
command: "{{ paas_ci_workdir + '/scan.py' }} --endpoint-keys {{ paas_ci_test.endpoints_to_scan }} --dep-json {{ paas_ci_workdir + '/dep.json'}} --output-dir {{ paas_ci_workdir }}"
register: scan_output
- name: Scan logs
debug:
msg: "{{ lookup('file', item.path) }}"
with_items: "{{ paas_ci_workdir + 'scan.log' }}"
- name: Show scan output
debug:
msg: "{{ scan_output }}"
- name: Find report files
find:
paths: "{{ paas_ci_workdir }}"
patterns: '*infn.it-report.txt'