�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d d
l Z d d
l
Z
d d l m Z d � Z
e d
k r� e
� n d
S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont stableinterfacet statust coret supported_bys"
---
module: slurp
version_added: historical
short_description: Slurps a file from remote nodes
description:
- This module works like M(fetch). It is used for fetching a base64-
encoded blob containing the data in a remote file.
- This module is also supported for Windows targets.
options:
src:
description:
- The file on the remote system to fetch. This I(must) be a file, not a directory.
type: path
required: true
aliases: [ path ]
notes:
- This module returns an 'in memory' base64 encoded version of the file, take into account that this will require at least twice the RAM as the
original file size.
- This module is also supported for Windows targets.
seealso:
- module: fetch
author:
- Ansible Core Team
- Michael DeHaan (@mpdehaan)
s�
- name: Find out what the remote machine's mounts are
slurp:
src: /proc/mounts
register: mounts
- debug:
msg: "{{ mounts['content'] | b64decode }}"
# From the commandline, find the pid of the remote machine's sshd
# $ ansible host -m slurp -a 'src=/var/run/sshd.pid'
# host | SUCCESS => {
# "changed": false,
# "content": "MjE3OQo=",
# "encoding": "base64",
# "source": "/var/run/sshd.pid"
# }
# $ echo MjE3OQo= | base64 -d
# 2179
N( t
AnsibleModulec C` s� t d t d t d d d t d d g � � d t � } | j d } t j j | � sl | j d d | � n t j | t j � s� | j d d
| � n t
| d � � } | j � } Wd QXt j
| � } | j d | d
| d d � d S( Nt
argument_spect srct typet patht requiredt aliasest supports_check_modet msgs file not found: %ss file is not readable: %st rbt contentt sourcet encodingt base64( R t dictt Truet paramst osR t existst fail_jsont accesst R_OKt opent readR t b64encodet exit_json( t moduleR t source_fht source_contentt data( ( sJ /usr/lib/python2.7/site-packages/ansible/modules/net_tools/basics/slurp.pyt mainE s !
t __main__( t
__future__R R R R t
__metaclass__t ANSIBLE_METADATAt
DOCUMENTATIONt EXAMPLESR R t ansible.module_utils.basicR R&