playbooks: Use Ansible's 'command' module, instead of 'shell'

Ansible's 'shell' module is almost exactly like the 'command' module,
except that it runs the command through a command line shell so that
environment variables like HOSTNAME and operations like '*', '<' and '>'
work.  None of those things are necessary are here.  Hence, it's better
to use the 'command' module as elsewhere.

Note that, unlike Ansible's 'shell' module, the 'command' module doesn't
support inline scripts.  So, each command needs to be in its own
separate task.

https://github.com/containers/toolbox/pull/1318
This commit is contained in:
Debarshi Ray 2023-06-22 17:49:50 +02:00
parent 2c09606603
commit b57dfd8b58
3 changed files with 24 additions and 18 deletions

View file

@ -39,15 +39,17 @@
- fish
- name: Download Go modules
shell: |
go mod download -x
command: go mod download -x
args:
chdir: '{{ zuul.project.src_dir }}/src'
- name: Set up Git submodules
shell: |
git submodule init
git submodule update
- name: Initialize Git submodules
command: git submodule init
args:
chdir: '{{ zuul.project.src_dir }}'
- name: Update Git submodules
command: git submodule update
args:
chdir: '{{ zuul.project.src_dir }}'

View file

@ -63,15 +63,17 @@
update_cache: "{{ true if zuul.attempts > 1 else false }}"
- name: Download Go modules
shell: |
go mod download -x
command: go mod download -x
args:
chdir: '{{ zuul.project.src_dir }}/src'
- name: Set up Git submodules
shell: |
git submodule init
git submodule update
- name: Initialize Git submodules
command: git submodule init
args:
chdir: '{{ zuul.project.src_dir }}'
- name: Update Git submodules
command: git submodule update
args:
chdir: '{{ zuul.project.src_dir }}'

View file

@ -39,15 +39,17 @@
- udisks2
- name: Download Go modules
shell: |
go mod download -x
command: go mod download -x
args:
chdir: '{{ zuul.project.src_dir }}/src'
- name: Set up Git submodules
shell: |
git submodule init
git submodule update
- name: Initialize Git submodules
command: git submodule init
args:
chdir: '{{ zuul.project.src_dir }}'
- name: Update Git submodules
command: git submodule update
args:
chdir: '{{ zuul.project.src_dir }}'