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"
网友评论