test
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
[defaults]
|
[defaults]
|
||||||
inventory = checklist
|
become = true
|
||||||
roles_path = roles
|
inventory = checklist
|
||||||
|
roles_path = roles
|
||||||
deprecation_warnings = false
|
deprecation_warnings = false
|
||||||
display_skipped_hosts = no
|
display_skipped_hosts = no
|
||||||
ansible_home = .
|
ansible_home = .
|
||||||
stdout_callback = debug
|
stdout_callback = debug
|
||||||
host_key_checking = false
|
host_key_checking = false
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ server
|
|||||||
nas
|
nas
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
10.10.43.111 ansible_port=2222 ansible_user=dev2
|
10.10.43.200 ansible_port=2222 ansible_user=dev2
|
||||||
10.10.43.112 ansible_port=2222 ansible_user=dev2
|
10.10.43.201 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
Normal file
BIN
roles/security_check/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
resultfile="/tmp/$(hostname)_$(date '+%F-%H:%M').txt"
|
resultfile="/tmp/$(hostname).txt"
|
||||||
|
|
||||||
U_01() {
|
U_01() {
|
||||||
echo "" >> $resultfile 2>&1
|
echo "" >> $resultfile 2>&1
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
resultfile="/tmp/$(hostname)_$(date '+%F-%H:%M').txt"
|
resultfile="/tmp/$(hostname).txt"
|
||||||
|
|
||||||
U_01() {
|
U_01() {
|
||||||
echo "" >> $resultfile 2>&1
|
echo "" >> $resultfile 2>&1
|
||||||
|
|||||||
12
roles/security_check/tasks/create_readme.yml
Normal file
12
roles/security_check/tasks/create_readme.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
- name: check status
|
||||||
|
shell: |
|
||||||
|
grep -H '☆ 취약 개수 = [1-9]' *.txt | cut -d: -f1
|
||||||
|
args:
|
||||||
|
chdir: /volume1/platform/05_Security_check/
|
||||||
|
register: check_status
|
||||||
|
when: "'nas' in group_names"
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ check_status.stdout_lines }}"
|
||||||
|
when: "'nas' in group_names"
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
---
|
---
|
||||||
- include: start.yml
|
- include: start.yml
|
||||||
|
|
||||||
|
- include: create_readme.yml
|
||||||
|
|||||||
@@ -24,24 +24,16 @@
|
|||||||
rm -rf /tmp/ubuntu.sh
|
rm -rf /tmp/ubuntu.sh
|
||||||
when: ansible_distribution == 'Ubuntu'
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
- name: File Name Search
|
|
||||||
shell: |
|
|
||||||
ls |grep {{ ansible_hostname }}
|
|
||||||
register: result
|
|
||||||
when: ansible_distribution == 'Ubuntu'
|
|
||||||
args:
|
|
||||||
chdir: /tmp/
|
|
||||||
|
|
||||||
- name: Copy Result File to Local
|
- name: Copy Result File to Local
|
||||||
fetch:
|
fetch:
|
||||||
src: "/tmp/{{ result.stdout }}"
|
src: "/tmp/{{ ansible_hostname }}.txt"
|
||||||
dest: "/resultdir/"
|
dest: "/resultdir/"
|
||||||
flat: yes
|
flat: yes
|
||||||
when: ansible_distribution == 'Ubuntu'
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
- name: Delete Result File
|
- name: Delete Result File
|
||||||
file:
|
file:
|
||||||
path: "/tmp/{{ result.stdout }}"
|
path: "/tmp/{{ ansible_hostname }}.txt"
|
||||||
state: absent
|
state: absent
|
||||||
when: ansible_distribution == 'Ubuntu'
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
@@ -58,3 +50,9 @@
|
|||||||
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
|
||||||
|
file:
|
||||||
|
path: "/resultdir"
|
||||||
|
state: absent
|
||||||
|
delegate_to: 127.0.0.1
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
0
roles/security_check/templates/README.md.j2
Normal file
0
roles/security_check/templates/README.md.j2
Normal file
Reference in New Issue
Block a user