test push
This commit is contained in:
2
roles/security_check/defaults/main.yml
Normal file
2
roles/security_check/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# defaults file for security_check
|
||||
3768
roles/security_check/files/rocky.sh
Normal file
3768
roles/security_check/files/rocky.sh
Normal file
File diff suppressed because it is too large
Load Diff
3701
roles/security_check/files/ubuntu.sh
Normal file
3701
roles/security_check/files/ubuntu.sh
Normal file
File diff suppressed because it is too large
Load Diff
2
roles/security_check/tasks/main.yml
Normal file
2
roles/security_check/tasks/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
- include: start.yml
|
||||
60
roles/security_check/tasks/start.yml
Normal file
60
roles/security_check/tasks/start.yml
Normal 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"
|
||||
|
||||
2
roles/security_check/vars/main.yml
Normal file
2
roles/security_check/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for security_check
|
||||
Reference in New Issue
Block a user