CanuxCheng 发表于 2015-08-07 15:45

linux远程到windows

Hello,

         有没有人知道怎样从一台linux机器远程读取一个windows机器上的文件的内容???

          希望能用python实现.

reb00t 发表于 2015-08-08 11:28

本帖最后由 reb00t 于 2015-08-08 11:29 编辑

ansible工具
模块远程到windows机器 执行操作.

CanuxCheng 发表于 2015-08-10 12:42

能具体说说吗?
我看了一下好像不可以哦,
ansible是类似于puppet的配置管理工具.回复 2# reb00t


   

reb00t 发表于 2015-08-18 22:10

回复 3# CanuxCheng root@debian7-64bit:~/windows# ansible-playbook-i hostsrun-powershell.yml

PLAY **************************************************

TASK: *************************************************
changed:

TASK: ******************************************************
ok: => {
    "var": {
      "result": {
            "changed": true,
            "invocation": {
                "module_args": "file/test.ps1",
                "module_name": "script"
            },
            "rc": 0,
            "stderr": "",
            "stdout": "1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n awk sed pythonphp perl\r\n",
            "stdout_lines": [
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7",
                "8",
                "9",
                " awk sed pythonphp perl"
            ]
      }
    }
}

PLAY RECAP ********************************************************************
172.16.168.103             : ok=2    changed=1    unreachable=0    failed=0   


name: Run powershell script
hosts: test
gather_facts: false
tasks:
    - name: Run powershell script
      script: file/test.ps1
      register: result

    - debug: var=result

CanuxCheng 发表于 2015-08-19 12:44

本帖最后由 CanuxCheng 于 2015-08-19 13:58 编辑

我看了一下,好像不行, 我是要从linux机器读到windows机器上的文件的内容, 好像也只能获取属性,类似stat .回复 4# reb00t


   

reb00t 发表于 2015-08-19 15:34

回复 5# CanuxCheng


    用powershell脚本打开文件啊,或者你可以直接调用py脚本 读取文件内容~

本人已经测试通过了。

reb00t 发表于 2015-08-19 15:35

回复 5# CanuxCheng


    {:qq16:}   要测试才能下结论!。
页: [1]
查看完整版本: linux远程到windows