From b998417c97ef4ee7dd3a58351db57eb6b1fba8a8 Mon Sep 17 00:00:00 2001 From: ByeonJungHun Date: Thu, 4 Jan 2024 14:35:01 +0900 Subject: [PATCH] README.md Update --- README.md | 6 ++++-- roles/security_check/files/ubuntu.sh | 2 +- roles/security_check/tasks/create_readme.yml | 9 ++++----- roles/security_check/templates/README.md.j2 | 8 ++++---- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7d1f65a..7b08f95 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ -| 이름 | IP | 상태 요약 | 상세 보기 | -| --- | --- | --- | --- | +| 이름 | 상태 요약 | 상세 보기 | +| --- | --- | --- | +| cmoa-master-1 | 취약 | http://10.10.43.42:8080/cmoa-master-1.txt | +| cmoa-worker1-1 | 취약 | http://10.10.43.42:8080/cmoa-worker1-1.txt | diff --git a/roles/security_check/files/ubuntu.sh b/roles/security_check/files/ubuntu.sh index 4cdef4e..149aa65 100644 --- a/roles/security_check/files/ubuntu.sh +++ b/roles/security_check/files/ubuntu.sh @@ -1,6 +1,6 @@ #!/bin/bash -resultfile="Results_$(date '+%F_%H:%M:%S').txt" +resultfile="/tmp/$(hostname).txt" U_01() { echo "" >> $resultfile 2>&1 diff --git a/roles/security_check/tasks/create_readme.yml b/roles/security_check/tasks/create_readme.yml index 23bc6d4..17cd952 100644 --- a/roles/security_check/tasks/create_readme.yml +++ b/roles/security_check/tasks/create_readme.yml @@ -16,13 +16,11 @@ when: "'nas' in group_names" - debug: - msg: "취약점 {{ item }} 발견" - loop: "{{ check_status.stdout_lines }}" + msg: "취약점 {{ check_status.stdout_lines }} 발견" when: "'nas' in group_names" - debug: - msg: "취약점 {{ item }} 양호" - loop: "{{ check_ok.stdout_lines }}" + msg: "취약점 {{ check_ok.stdout_lines }} 양호" when: "'nas' in group_names" - name: Create README.md @@ -41,4 +39,5 @@ when: "'nas' in group_names" - debug: - msg: "결과 확인 : https://github.com/CloudMOA/security_check.git" \ No newline at end of file + msg: "결과 확인 : https://github.com/CloudMOA/security_check.git" + when: "'nas' in group_names" \ No newline at end of file diff --git a/roles/security_check/templates/README.md.j2 b/roles/security_check/templates/README.md.j2 index 02f7b7e..cc6adbc 100644 --- a/roles/security_check/templates/README.md.j2 +++ b/roles/security_check/templates/README.md.j2 @@ -1,8 +1,8 @@ -| 이름 | IP | 상태 요약 | 상세 보기 | -| --- | --- | --- | --- | +| 이름 | 상태 요약 | 상세 보기 | +| --- | --- | --- | {% for vulnerable in check_status.stdout_lines %} -| {{ vulnerable|splitext|first }} | {{ hostvars[vulnerable|splitext|first]['ansible_host'] }} | 취약 | http://10.10.43.42:8080/{{ vulnerable }} | +| {{ vulnerable|splitext|first }} | 취약 | http://10.10.43.42:8080/{{ vulnerable }} | {% endfor %} {% for good in check_ok.stdout_lines %} -| {{ good|splitext|first }} | {{ hostvars[vulnerable|splitext|first]['ansible_host'] }} | 양호 | http://10.10.43.42:8080/{{ good }} | +| {{ good|splitext|first }} | 양호 | http://10.10.43.42:8080/{{ good }} | {% endfor %} \ No newline at end of file