如何使用ansible playbooks导出scm-manager-svn repo

时间:2017-05-23 12:34:47

标签: svn ansible

我需要使用ansible将SCM管理器下的远程svn存储库导出到本地服务器。 怎么做?

我尝试过使用命令模块:

 - command: svn export http://ip/scm/svn/dev/  /root/svn/ --username admin --password 1234 --force

它获得了成功。

但在执行颠覆模块时:

 - subversion:
      repo=svn+ssh://ip/scm/svn/dev # tried with repo=http://ip/scm/svn/dev
      export=True
      username=admin
      password=1234
      dest=/root/svn

报告错误。

fatal: [127.0.0.1]: FAILED! => {
    "changed": false,
    "cmd": "/usr/bin/svn --non-interactive --trust-server-cert --no-auth-cache --username admin --password '********' export -r HEAD svn+ssh://ip/scm/svn/dev /root/svn",
    "failed": true,
    "invocation": {
        "module_args": {
            "checkout": true,
            "dest": "/root/svn",
            "executable": null,
            "export": true,
            "force": false,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "repo": "svn+ssh://ip/scm/svn/dev",
            "revision": "HEAD",
            "switch": true,
            "update": true,
            "username": "admin"
        }
    },
    "msg": "svn: E210002: Unable to connect to a repository at URL 'svn+ssh://ip/scm/svn/dev'\nsvn: E210002: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file.\nsvn: E210002: Network connection closed unexpectedly",
    "rc": 1,
    "stderr": "svn: E210002: Unable to connect to a repository at URL 'svn+ssh://ip/scm/svn/dev'\nsvn: E210002: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file.\nsvn: E210002: Network connection closed unexpectedly\n",
    "stderr_lines": [
        "svn: E210002: Unable to connect to a repository at URL 'svn+ssh://ip/scm/svn/dev'",
        "svn: E210002: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file.",
        "svn: E210002: Network connection closed unexpectedly"
    ],
    "stdout": "",
    "stdout_lines": []
}

1 个答案:

答案 0 :(得分:1)

您似乎正在使用http协议与command模块(应该转到SVN服务器上的端口80),而subversion模块似乎正在使用svn+ssh 。可能是SVN服务器要么不在端口22(SSH)上服务,要么防火墙阻塞到端口22的流量。

一个简单的测试是将commmand模块与svn+ssh网址一起使用。如果它不起作用,那么问题几乎肯定是建立到端口22的连接。