小编nik*_*men的帖子

将 `git remote add usptream` 添加到存储库,但使用 Ansible

我有一个 Ansible 2.9.27,我正在尝试为我之前用 Ansible 克隆的 git 存储库添加上游远程。让我们假设已经克隆的存储库位于/home/user/Documents/github/目录中,并且我想为它们添加上游远程(git remote add upstream对于每个存储库)。

任务如下所示:

- 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 }}"
Run Code Online (Sandbox Code Playgroud)

问题是 ansible-lint 不喜欢使用command模块git

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 …
Run Code Online (Sandbox Code Playgroud)

git ansible ansible-2.x

6
推荐指数
1
解决办法
1000
查看次数

标签 统计

ansible ×1

ansible-2.x ×1

git ×1