Ansible Git 模块设置用户名密码

How do I pass username and password while using Ansible Git module? - Stack Overflow

---
- hosts: all 
  gather_facts: no
  become: yes
  tasks:
    - name: install git package
      apt:
        name: git

    - name: Get updated files from git repository 
      git: 
        repo: "https://{{ githubuser | urlencode }}:{{ githubpassword | urlencode }}@github.com/privrepo.git"
        dest: /tmp

其中githubuser 和githubpassword 可以在配置里写好,也可以命令输入:ansible-playbook -i hosts github.yml -e "githubuser=arbabname" -e "githubpassword=xxxxxxx"

你可能感兴趣的:(Ansible Git 模块设置用户名密码)