Skip to content
Snippets Groups Projects
2-scan.yml 1.38 KiB
Newer Older
  • Learn to ignore specific revisions
  • qweqweasdasd's avatar
    qweqweasdasd committed
    - name: "Ping scans"
      shell:
        cmd: "ping -c1 -w 2 {{ pinging_host }}"
      register: pingged_host
      ignore_errors: yes
      with_items:
        - scans.cloud.infn.it
      loop_control:
        loop_var: pinging_host
    
    - name: "Result ping"
      debug:
        var: pingged_host
    
    - name: " ***Ip  ping"
      debug:
         msg: "{{  pingged_host.results|map(attribute='rc')|list }}"
    
    
    - name: Set SSH tunnel
    
    qweqweasdasd's avatar
    qweqweasdasd committed
      command: ssh -f -N -L localhost:9390:192.168.187.162:9390 jenkins@scans.cloud.infn.it 
    
    
    - debug: 
        var: endpoints_to_scan
        
    - name:  Run scan
      command: "{{ python3_script_path }} {{ endpoints_to_scan }} {{ paas_ci_workdir + '/dep.json'}} {{ paas_ci_workdir }}" 
      register: scan_output
    
    - name: Find report files
      find:
        paths: "{{paas_ci_workdir}}"
        patterns: '*report.txt'
      register: report_files
    
    - name: Show reports
      debug:
        msg: "{{lookup('file', item.path)}}"
      with_items: "{{report_files.files}}"
    
    - name: get Severity file content
      shell: cat "{{ paas_ci_workdir + '/severity.json'}}"
      register: severity 
    
    - name: import severity
      set_fact:
        severity_json: "{{ severity.stdout | from_json }}"
    
    - debug:
        var: severity_json
    
    - name: Get scan outputs (if successful)
      assert:
        that:
          - severity_json.global == 'OK'
        fail_msg: "SCAN FAILED - global_severity: {{ severity_json.global_severity }}"
        success_msg: "SCAN PASSED - global_severity: {{ severity_json.global_severity }}"