- name: Push git commits with local variables.
hosts: localhost
vars:
username: git_username
password: git_password
tasks:
- name: Set origin to include username and password.
shell: "git remote set-url origin https://{{ git_username }}:{{ git_password }}@yourhost.com/storage/repo.git"
- name: Push to origin.
shell: "git push origin branch"