是否可以使用 Ansible 在没有“command:”或“shell:”的情况下执行“git submodule update”?

THe*_*ess 6 git git-submodules ansible

所以我被赋予了通过 Ansible 更新某个目录的任务,但我似乎找不到一种方法来git submodule update执行git:.

git submodule update不使用command:or真的没有其他方法吗shell:

我当前的代码:

# Command to execute: git remote update
- name: Git Update
  git:
    repo: "{{ git_ssh_key }}"
    dest:  ~/some/directory
    update: yes
    version: master

# Command to execute: git reset --hard origin/master
- name: Git reset
  command: git reset --hard origin/master
  args: 
    chdir: ~/some/directory

# Command to execute: git submodule update
- name: Git Submodule Update
  [Here is where I need your help to execute "git submodule update"]
Run Code Online (Sandbox Code Playgroud)

任何帮助是极大的赞赏。

phd*_*phd 7

添加参数recursive: yes

# Command to execute: git submodule update
- name: Git Submodule Update
  git:
      repo: "{{ git_ssh_key }}"
      dest:  ~/some/directory
      recursive: yes
      update: yes
      version: master
Run Code Online (Sandbox Code Playgroud)

请参阅https://docs.ansible.com/ansible/latest/modules/git_module.html上的文档