Provide method for non-SSHFS machines to report.

This commit is contained in:
Hyperling 2021-02-06 09:18:23 -06:00
parent cbb567cbf2
commit 1a43936c6b
3 changed files with 53 additions and 7 deletions

View File

@ -25,7 +25,31 @@
- name: Facts | General | System | 1337 - name: Facts | General | System | 1337
set_fact: set_fact:
leet_drive: /mnt/leet leet_drive: /mnt/leet
heartbeat_report: "/mnt/leet/Temp/ansible/{{ ansible_hostname }}.txt"
lynis_report: "/mnt/leet/Temp/ansible/{{ ansible_hostname }}_lynis.txt" - name: Facts | General | System | 1337 Mounted?
nmap_report: "/mnt/leet/Temp/ansible/{{ ansible_hostname }}_nmap.txt" stat:
ansible_pull_report: "/mnt/leet/Temp/ansible/{{ ansible_hostname }}_last_pull_times.txt" path: "{{ leet_drive }}"/ansible
register: leet_drive_details
- name: Facts | General | System | 1337 Mounted? DEBUG
debug:
variable: leet_drive_details
- name: Facts | General | System | Report Location = 1337
set_fact:
report_location: "{{ leet_drive }}/Temp/ansible"
when: leet_drive_details.stat.exists
- name: Facts | General | System | Report Location = /root
set_fact:
report_location: "/root"
report_scp_location: "Temp/ansible/"
when: not leet_drive_details.stat.exists
- name: Facts | General | System | Reports
set_fact:
heartbeat_report: "{{ report_location }}/{{ ansible_hostname }}.txt"
lynis_report: "{{ report_location }}/{{ ansible_hostname }}_lynis.txt"
nmap_report: "{{ report_location }}/{{ ansible_hostname }}_nmap.txt"
ansible_pull_report: "{{ report_location }}/{{ ansible_hostname }}_last_pull_times.txt"

View File

@ -10,3 +10,22 @@
state: present state: present
disabled: no disabled: no
when: ansible_system == "FreeBSD" when: ansible_system == "FreeBSD"
- name: General | Cron | Root | Enable Secure Copy Reports
cron:
user: root
name: "Copy Reports"
minute: "05,20,35,50"
job: "scp {{ ansible_pull_report }} {{ heartbeat_report }} {{ lynis_report }} {{ nmap_report }} ling@leet:{{ report_scp_location }}"
state: present
disabled: no
when: not leet_drive_details.stat.exists
- name: General | Cron | Root | Disable Secure Copy Reports
cron:
user: root
name: "Copy Reports"
job: "As a wise man once said, I'm disabled."
state: present
disabled: yes
when: leet_drive_details.stat.exists

View File

@ -4,11 +4,14 @@
- name: General | Start | Ansible Pull Report | Start File - name: General | Start | Ansible Pull Report | Start File
shell: "echo 'START' > {{ ansible_pull_report }}" shell: "echo 'START' > {{ ansible_pull_report }}"
when: leet_drive_details.stat.exists
- name: General | Start | Ansible Pull Report | Make Viewable - name: General | Start | Ansible Pull Report | Make Viewable (SSHFS)
file: file:
path: "{{ ansible_pull_report }}" path: "{{ ansible_pull_report }}"
mode: '0777' mode: '0777'
when: leet_drive_details.stat.exists
- name: General | Start | Ansible Pull Report | Add Date Entry - name: General | Start | Ansible Pull Report | Add Date Entry
shell: "date >> {{ ansible_pull_report }}" shell: "date >> {{ ansible_pull_report }}"
when: leet_drive_details.stat.exists