I have an Ansible 2.9.27 and I am trying to add upstream remote for git repositories which I previously cloned with Ansible. Let's assume that already cloned repositories are located in /home/user/Documents/github/ directory and I want to add upstream remote for them (git remote add upstream for each repo).
The task looks like this:
- name: Add remote upstream to github projects
# TODO: how to add remote with git module?
command: git remote add upstream git@github.com:{{ git_user }}/{{ item }}.git
changed_when: false
args:
chdir: /home/user/Documents/github/{{ item }}
loop: "{{ github_repos }}"
The issue is that ansible-lint doesn't like using command instead of git module:
WARNING Listing 1 violation(s) that are fatal
command-instead-of-module: git used in place of git module
tasks/github.yaml:15 Task/Handler: Add remote upstream to github projects
What I need to do to add remote upstream for these repositories with git module?