无法在Virtualbox中使用Ansible签出svn repo

时间:2017-06-28 12:22:17

标签: svn ansible

我想使用Ansible将svn-repository存入我的Virtualbox。 不知怎的任务“checkout config”永远不会结束。

- name: checkout config
  subversion:
    repo: svn+ssh://svn.someserver.loc/srv/svn/repository/software/
    dest: /home/user/.somedir

我已经想到了缺少known_hosts的方向 - 密钥,但我不确定我是否正确实现了svn-server的密钥。

当在VM中重复按“df”时,我在任务运行时看不到磁盘使用的任何变化。

所以我假设在svn checkout时一定有错误。

感谢您的帮助

我的Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "Centos_V1.0.box"
  config.vm.hostname = "box.vm"
  config.ssh.username = "user"
  config.ssh.password = "user01"
  config.ssh.port = "2222"
  config.vm.provision "ansible" do |ansible|
    ansible.limit = 'all'
    #ansible.verbose = "-v"
    ansible.playbook = "playbook.yml"
    ansible.inventory_path = "hosts"
  end
  config.vm.provider :virtualbox do |vb|
    vb.name = "BOX"
  end

我的playbook.yml:

---
- hosts: VirtualBoxes
  strategy: debug

  vars_prompt:
    - name: "version"
      prompt: "Which version would you like to install: 1,2,3,4"

  tasks:
  - name: install prog1
    become: true
    yum: name=prog1 state=latest
  - name: install prog2
    become: true
    yum: name=prog2 state=latest

  - name: install prog3
    become: true
    yum: name=prog3 state=latest

  - name: install prog4
    become: true
    yum: name=prog4 state=latest

  - name: install tmux
    become: true
    yum: name=tmux state=latest

  - name: delete somedir
    file:
      path: /home/user/.confdir/
      state: absent

  #- name: tell the host about our servers it might want to ssh to
  #  known_hosts:
  #  path: /home/user/.ssh/known_hosts
  #  name: svn.someserver.loc
  #  key: "SWEAGFSDFSJJERKESJHFNKMDFMMRLMLFDLGRSWEAGFSDFSJJERKESJHFNKMDFMMRLMLFDLGRSWEAGFSDFSJJERKESJHFNKMDFMMRLMLFDLGR="

- name: checkout config
  subversion:
    repo: svn+ssh://svn.someserver.loc/srv/svn/repository/software/
    dest: /home/user/

我的ansible库存文件:

[VirtualBoxes]
localhost:2222 ansible_connection=ssh ansible_ssh_user=user ansible_ssh_pass=user01

1 个答案:

答案 0 :(得分:2)

我无法通过svn checkout的原因是,在svn密码的顶部,svn + ssh过程的ssh密钥需要。我们现在将相关密钥复制到机器中。