test push

This commit is contained in:
ByeonJungHun
2023-12-22 11:09:53 +09:00
commit 9943b627cb
10 changed files with 7559 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

8
ansible.cfg Normal file
View File

@@ -0,0 +1,8 @@
[defaults]
inventory = checklist
roles_path = roles
deprecation_warnings = False
display_skipped_hosts = no
ansible_home = .
stdout_callback = debug
host_key_checking = False

10
checklist Normal file
View File

@@ -0,0 +1,10 @@
[all:children]
server
nas
[server]
10.10.43.111 ansible_port=2222 ansible_user=dev2
10.10.43.112 ansible_port=2222 ansible_user=dev2
[nas]
10.10.43.42 ansible_port=2222 ansible_user=exemdev2

View File

@@ -0,0 +1,2 @@
---
# defaults file for security_check

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
---
- include: start.yml

View File

@@ -0,0 +1,60 @@
---
- name: Create Result Directory
file:
path: /resultdir
state: directory
delegate_to: 127.0.0.1
when: "'nas' in group_names"
- name: Old Result File Delete
shell: |
rm -rf /volume1/platform/05_Security_check/*
when: "'nas' in group_names"
- name: Copy Security Check Script
copy:
src: "{{ role_path }}/files/ubuntu.sh"
dest: /tmp/ubuntu.sh
when: ansible_distribution == 'Ubuntu'
- name: Start Security Check Script
shell: |
chdir
bash /tmp/ubuntu.sh
rm -rf /tmp/ubuntu.sh
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
fetch:
src: "/tmp/{{ result.stdout }}"
dest: "/resultdir/"
flat: yes
when: ansible_distribution == 'Ubuntu'
- name: Delete Result File
file:
path: "/tmp/{{ result.stdout }}"
state: absent
when: ansible_distribution == 'Ubuntu'
- name: Find Copy File Name
shell: ls -l /resultdir/ | awk 'NR>1 {print $9}'
register: copy_file
delegate_to: 127.0.0.1
when: "'nas' in group_names"
- name: Copy Result File to NAS
copy:
src: "/resultdir/{{ item }}"
dest: /volume1/platform/05_Security_check
with_items: "{{ copy_file.stdout_lines }}"
when: "'nas' in group_names"

View File

@@ -0,0 +1,2 @@
---
# vars file for security_check

6
server_check.yml Normal file
View File

@@ -0,0 +1,6 @@
---
- hosts: all
become: true
gather_facts: true
roles:
- role: security_check