Skip to content

Instantly share code, notes, and snippets.

@kaz-tk
Created March 16, 2014 13:39
Show Gist options
  • Save kaz-tk/9583384 to your computer and use it in GitHub Desktop.
Save kaz-tk/9583384 to your computer and use it in GitHub Desktop.
ansibleで、/var/log/を全部取ってくるやつ。
---
- hosts: webservers
user: miyabi
sudo: True
tasks:
- name: backupdate
command: date +"%Y%m%d%H%M%S"
register: execdate
- name: list /var/log/
command: find /var/log/ -type f
register: logfiles
- name: Fetch All Log
fetch: src={{item}} dest={{ execdate }}
with_items: ${logfiles.stdout_lines}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment