FAQ
Hi

I'm using Salt Python Client API to copy file from master to minion with
this snippet

import json
import salt.client

minion = '*'
source = "salt://greetings.txt"
target = "/home/salt_testing_cp/greetings.txt"

local = salt.client.LocalClient()
ret = local.cmd_full_return(minion, 'cp.get_file', [source,
target],verbose=True)
print json.dumps(ret, indent=2)

*1) Can we transfer files without using salt file server ? *If yes, how to
achieve it with Python Client API available.

2) Also the document says *"You can't run interactive scripts" *. Does it
mean there are some limitations to execute arbitrary linux commands with
cmd.run eg. we can run salt "*" cmd.run ['ls -l /home'] . Similarly can we
run commands like scp,ssh with cmd.run.

eg. salt '*' cmd.run ['ssh user@example.test.com']

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Florian Ermisch at Jan 2, 2015 at 9:48 am
    Hi,

    Well, you can base64-encode your files' content, put them into pillar and decode them to create the files… or wrap scp or rsync… actually, I think there's a rsybc-module.

    As for the interactive scripts: how do you plan to respond to all your minions asking for input? You have to make sure none of the commands you run need additional input because if you're going to reply to all of your minions individually anyway you've defeated the whole purpose of using configuration management in the first place.
    BTW: most commands normally run interactively won't ask for anything if you use the right options.

    Regards,Florian

    Am 2. Januar 2015 10:16:13 MEZ, schrieb BIJAL MANIAR <bijalcm@gmail.com>:

    Hi

    I'm using Salt Python Client API to copy file from master to minion
    with
    this snippet

    import json
    import salt.client

    minion = '*'
    source = "salt://greetings.txt"
    target = "/home/salt_testing_cp/greetings.txt"

    local = salt.client.LocalClient()
    ret = local.cmd_full_return(minion, 'cp.get_file', [source,
    target],verbose=True)
    print json.dumps(ret, indent=2)

    *1) Can we transfer files without using salt file server ? *If yes, how
    to
    achieve it with Python Client API available.

    2) Also the document says *"You can't run interactive scripts" *. Does
    it
    mean there are some limitations to execute arbitrary linux commands
    with
    cmd.run eg. we can run salt "*" cmd.run ['ls -l /home'] . Similarly can
    we
    run commands like scp,ssh with cmd.run.

    eg. salt '*' cmd.run ['ssh user@example.test.com']

    --
    You received this message because you are subscribed to the Google
    Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedJan 2, '15 at 9:16a
activeJan 2, '15 at 9:48a
posts2
users2

2 users in discussion

BIJAL MANIAR: 1 post Florian Ermisch: 1 post

People

Translate

site design / logo © 2022 Grokbase