将私有存储库克隆到Windows服务器

时间:2019-08-13 09:48:33

标签: windows gitlab

如果我们想将私有存储库克隆到Windows服务器中

- name: hosts
  hosts: all
  become: yes
  tasks:
  - name: create a directory
    win_file:
      path: C:\testing
      state: directory
  - name: clone a private repository into windows server
    win_git:
      repo: http://username:password@gitlabserver/automation/common/ansible/ansible.git
      dest: C:\testing\
      branch: master
      update: yes
      recursive: yes
      replace_dest: yes
      accept_hostkey: yes
      force: yes
      ignore_errors: yes
      register: find_output
  - debug:
      var: find_output.stdout_lines

在库存中,我们必须提供以下信息:

[hosts]
windowsserver.aws.com
[hosts:vars]
ansible_connection=winrm
ansible_user=windowsserverusername
ansible_password=windowsserverpassword
ansible_port=5985
ansible_winrm_server_cert_validation=ignore
ansible_winrm_transport=ntlm
validate_certs=false
ansible_winrm_scheme=http
ansible_become=false

以上将按预期工作。

1 个答案:

答案 0 :(得分:0)

我给的那一个可以按预期工作。