Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /tmp/app/targets/file1.txt
- Some text.
- /tmp/app/targets/file2.cfg
- cluster=0
- cluster_id=app_pool_00
- /tmp/app/targets/file3.sh
- #!/bin/sh
- printf "Hello worldn"
- exit 0
- ---
- - name: check file integrity
- hosts: localhost
- become: no
- vars:
- TARGET: /tmp/app/targets
- LOG: /tmp/app/archive/scan_results.log
- tasks:
- - name: discover target files
- find:
- paths: "{{ TARGET }}"
- recurse: yes
- file_type: file
- register: TARGET_FILES
- - name: scan target
- stat:
- path: "{{ item.path }}"
- get_checksum: yes
- loop: "{{ TARGET_FILES.files }}"
- register: TARGET_RESULTS
- - name: DEBUG
- debug:
- var: "{{ TARGET_RESULTS }}"
- - name: write findings to log
- copy:
- content: "{{ TARGET_RESULTS.stat.path }},{{ TARGET_RESULTS.stat.checksum }}"
- dest: "{{ LOG }}"
- ...
- ---
- - name: check file integrity
- hosts: localhost
- become: no
- vars:
- TARGET: /tmp/app/targets/file1.txt
- LOG: /tmp/app/archive/scan_results.log
- tasks:
- - name: scan target
- stat:
- path: '{{ TARGET }}'
- checksum_algorithm: sha1
- follow: no
- get_attributes: yes
- get_checksum: yes
- get_md5: no
- get_mime: yes
- register: result
- - name: write findings to log
- copy:
- content: "{{ result.stat.path }},{{ result.stat.checksum }}"
- dest: "{{ LOG }}"
- ...
- /tmp/app/archive/scan_results.log
- /tmp/app/targets/file1.txt,8d06cea05d408d70c59b1dbc5df3bda374d869a4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement