task 추가
This commit is contained in:
@@ -4,7 +4,7 @@ nas
|
|||||||
|
|
||||||
[server]
|
[server]
|
||||||
10.10.43.200 ansible_port=2222 ansible_user=dev2
|
10.10.43.200 ansible_port=2222 ansible_user=dev2
|
||||||
10.10.43.201 ansible_port=2222 ansible_user=dev2
|
#10.10.43.97 ansible_port=2222 ansible_user=dev2
|
||||||
|
|
||||||
[nas]
|
[nas]
|
||||||
10.10.43.42 ansible_port=2222 ansible_user=exemdev2
|
10.10.43.42 ansible_port=2222 ansible_user=exemdev2
|
||||||
|
|||||||
BIN
roles/security_check/.DS_Store
vendored
BIN
roles/security_check/.DS_Store
vendored
Binary file not shown.
@@ -8,5 +8,12 @@
|
|||||||
when: "'nas' in group_names"
|
when: "'nas' in group_names"
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: "{{ check_status.stdout_lines }}"
|
msg: "취약점 {{ check_status.stdout_lines }} 발견"
|
||||||
|
when: "'nas' in group_names"
|
||||||
|
|
||||||
|
- name: Create README.md
|
||||||
|
template:
|
||||||
|
src: README.md.j2
|
||||||
|
dest: "{{ playbook_dir }}/README.md"
|
||||||
|
delegate_to: 127.0.0.1
|
||||||
when: "'nas' in group_names"
|
when: "'nas' in group_names"
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
---
|
---
|
||||||
- name: Create Result Directory
|
- name: Create Result Directory
|
||||||
file:
|
file:
|
||||||
path: /resultdir
|
path: ~/checklist/
|
||||||
state: directory
|
state: directory
|
||||||
|
become: false
|
||||||
delegate_to: 127.0.0.1
|
delegate_to: 127.0.0.1
|
||||||
when: "'nas' in group_names"
|
when: "'nas' in group_names"
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
- name: Copy Result File to Local
|
- name: Copy Result File to Local
|
||||||
fetch:
|
fetch:
|
||||||
src: "/tmp/{{ ansible_hostname }}.txt"
|
src: "/tmp/{{ ansible_hostname }}.txt"
|
||||||
dest: "/resultdir/"
|
dest: "~/checklist/"
|
||||||
flat: yes
|
flat: yes
|
||||||
when: ansible_distribution == 'Ubuntu'
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
@@ -38,21 +39,27 @@
|
|||||||
when: ansible_distribution == 'Ubuntu'
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
- name: Find Copy File Name
|
- name: Find Copy File Name
|
||||||
shell: ls -l /resultdir/ | awk 'NR>1 {print $9}'
|
shell: ls -l ~/checklist/ | awk 'NR>1 {print $9}'
|
||||||
register: copy_file
|
register: copy_file
|
||||||
|
become: false
|
||||||
delegate_to: 127.0.0.1
|
delegate_to: 127.0.0.1
|
||||||
when: "'nas' in group_names"
|
when: "'nas' in group_names"
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "파일 {{ copy_file.stdout_lines }} 발견"
|
||||||
|
when: "'nas' in group_names"
|
||||||
|
|
||||||
- name: Copy Result File to NAS
|
- name: Copy Result File to NAS
|
||||||
copy:
|
copy:
|
||||||
src: "/resultdir/{{ item }}"
|
src: "~/checklist/{{ item }}"
|
||||||
dest: /volume1/platform/05_Security_check
|
dest: /volume1/platform/05_Security_check
|
||||||
with_items: "{{ copy_file.stdout_lines }}"
|
with_items: "{{ copy_file.stdout_lines }}"
|
||||||
when: "'nas' in group_names"
|
when: "'nas' in group_names"
|
||||||
|
|
||||||
- name: Delete Result File
|
- name: Delete Result File
|
||||||
file:
|
file:
|
||||||
path: "/resultdir"
|
path: "~/checklist/"
|
||||||
state: absent
|
state: absent
|
||||||
|
become: false
|
||||||
delegate_to: 127.0.0.1
|
delegate_to: 127.0.0.1
|
||||||
when: ansible_distribution == 'Ubuntu'
|
when: ansible_distribution == 'Ubuntu'
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
|이름|상태 요약|상세 보기|
|
||||||
|
|---|---|---|
|
||||||
|
{% for filename in check_status.stdout_lines %}
|
||||||
|
|{{ filename|splitext|first }}|취약|http://10.10.43.42:8080/{{ filename }}|
|
||||||
|
{% endfor %}
|
||||||
@@ -2,5 +2,8 @@
|
|||||||
- hosts: all
|
- hosts: all
|
||||||
become: true
|
become: true
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
|
vars:
|
||||||
|
user: byeonjeonghun
|
||||||
|
group: staff
|
||||||
roles:
|
roles:
|
||||||
- role: security_check
|
- role: security_check
|
||||||
|
|||||||
Reference in New Issue
Block a user