Skip to content

Instantly share code, notes, and snippets.

@asifiqbal
Created Jan 4, 2017
Embed
What would you like to do?
---
- hosts: all
gather_facts: no
tasks:
- shell: ls ratelimit.log*
args:
chdir: /var/named/var/log/named
register: ratelimitlogs
- debug: var=ratelimitlogs.stdout_lines
- fetch:
src: /var/named/var/log/named/{{ item }}
dest: /tmp/{{ inventory_hostname }}
flat: yes
environment: HOME=/tmp
with_items: "{{ ratelimitlogs.stdout_lines }}"
TASK [debug] *******************************************************************
task path: /export/home/axisys/ansible/bind/fetch_ratelimit.yml:11
ok: [host.example.net] => {
"ratelimitlogs.stdout_lines": [
"ratelimit.log"
]
}
TASK [fetch] *******************************************************************
task path: /export/home/axisys/ansible/bind/fetch_ratelimit.yml:13
Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/core/files/stat.py
<host.example.net> ESTABLISH SSH CONNECTION FOR USER: axisys
<host.example.net> SSH: EXEC sshpass -d12 ssh -vvv -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o User=axisys -o ConnectTimeout=10 host.example.net '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /tmp/ansible-tmp-1483543691.84-245504170990291 `" && echo ansible-tmp-1483543691.84-245504170990291="` echo /tmp/ansible-tmp-1483543691.84-245504170990291 `" ) && sleep 0'"'"''
<host.example.net> PUT /tmp/tmpLoeFMX TO /tmp/ansible-tmp-1483543691.84-245504170990291/stat.py
<host.example.net> SSH: EXEC sshpass -d12 scp -vvv -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o User=axisys -o ConnectTimeout=10 /tmp/tmpLoeFMX '[host.example.net]:/tmp/ansible-tmp-1483543691.84-245504170990291/stat.py'
<host.example.net> ESTABLISH SSH CONNECTION FOR USER: axisys
<host.example.net> SSH: EXEC sshpass -d12 ssh -vvv -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o User=axisys -o ConnectTimeout=10 host.example.net '/bin/sh -c '"'"'chmod u+x /tmp/ansible-tmp-1483543691.84-245504170990291/ /tmp/ansible-tmp-1483543691.84-245504170990291/stat.py && sleep 0'"'"''
<host.example.net> ESTABLISH SSH CONNECTION FOR USER: axisys
<host.example.net> SSH: EXEC sshpass -d12 ssh -vvv -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o User=axisys -o ConnectTimeout=10 -tt host.example.net '/bin/sh -c '"'"'/usr/local/bin/python2.7 /tmp/ansible-tmp-1483543691.84-245504170990291/stat.py; rm -rf "/tmp/ansible-tmp-1483543691.84-245504170990291/" > /dev/null 2>&1 && sleep 0'"'"''
<host.example.net> FETCH /var/named/var/log/named/ratelimit.log TO /tmp/host.example.net
<host.example.net> SSH: EXEC sshpass -d12 scp -vvv -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o User=axisys -o ConnectTimeout=10 '[host.example.net]:/var/named/var/log/named/ratelimit.log' /tmp/host.example.net
changed: [host.example.net] => (item=ratelimit.log) => {
"changed": true,
"checksum": "50e4b73ff1a3102fa1e56a11a54064b7a525f0f0",
"dest": "/tmp/host.example.net",
"invocation": {
"module_args": {
"dest": "/tmp/host.example.net",
"environment": "HOME=/tmp",
"flat": true,
"src": "/var/named/var/log/named/ratelimit.log"
},
"module_name": "fetch"
},
"item": "ratelimit.log",
"md5sum": "ae989532203761b78511d64e8923a7ab",
"remote_checksum": "915eedccf836a00ce2087e15b6f3a13be8506d59",
"remote_md5sum": null
}
PLAY RECAP *********************************************************************
host.example.net : ok=3 changed=2 unreachable=0 failed=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment