From 63c052642198a9b47237887043b3748d691c566f Mon Sep 17 00:00:00 2001 From: ByeonJungHun Date: Wed, 3 Jan 2024 16:36:26 +0900 Subject: [PATCH] test --- README.md | 1 + roles/security_check/tasks/create_readme.yml | 10 +++++++++- roles/security_check/tasks/start.yml | 13 ++++++------- server_check.yml | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6b94bdd..39f8150 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ |이름|상태 요약|상세 보기| |---|---|---| +|cmoa-master-1|취약|http://10.10.43.42:8080/cmoa-master-1.txt| diff --git a/roles/security_check/tasks/create_readme.yml b/roles/security_check/tasks/create_readme.yml index 6710a6c..c809587 100644 --- a/roles/security_check/tasks/create_readme.yml +++ b/roles/security_check/tasks/create_readme.yml @@ -16,4 +16,12 @@ src: README.md.j2 dest: "{{ playbook_dir }}/README.md" delegate_to: 127.0.0.1 - when: "'nas' in group_names" \ No newline at end of file + when: "'nas' in group_names" + +- name: git push + shell: | + git add . + git commit -m "test" + git push + delegate_to: 127.0.0.1 + when: "'nas' in group_names" \ No newline at end of file diff --git a/roles/security_check/tasks/start.yml b/roles/security_check/tasks/start.yml index 79ccc94..8f99077 100644 --- a/roles/security_check/tasks/start.yml +++ b/roles/security_check/tasks/start.yml @@ -3,7 +3,6 @@ file: path: ~/checklist/ state: directory - become: false delegate_to: 127.0.0.1 when: "'nas' in group_names" @@ -18,11 +17,12 @@ dest: /tmp/ubuntu.sh when: ansible_distribution == 'Ubuntu' -- name: Start Security Check Script +- name: Start Security Check Script (become -> true) shell: | chdir bash /tmp/ubuntu.sh rm -rf /tmp/ubuntu.sh + become: true when: ansible_distribution == 'Ubuntu' - name: Copy Result File to Local @@ -32,16 +32,16 @@ flat: yes when: ansible_distribution == 'Ubuntu' -- name: Delete Result File +- name: Delete Result File (become -> true) file: path: "/tmp/{{ ansible_hostname }}.txt" state: absent + become: true when: ansible_distribution == 'Ubuntu' - name: Find Copy File Name shell: ls -l ~/checklist/ | awk 'NR>1 {print $9}' register: copy_file - become: false delegate_to: 127.0.0.1 when: "'nas' in group_names" @@ -56,10 +56,9 @@ with_items: "{{ copy_file.stdout_lines }}" when: "'nas' in group_names" -- name: Delete Result File +- name: Delete Result File (become -> true) file: path: "~/checklist/" state: absent - become: false delegate_to: 127.0.0.1 - when: ansible_distribution == 'Ubuntu' \ No newline at end of file + when: "'nas' in group_names" \ No newline at end of file diff --git a/server_check.yml b/server_check.yml index e3a3f6d..13bd9ac 100644 --- a/server_check.yml +++ b/server_check.yml @@ -1,6 +1,6 @@ --- - hosts: all - become: true + become: false gather_facts: true vars: user: byeonjeonghun