Skip to content

Commit

Permalink
playbooks: Use Ansible's 'command' module, instead of 'shell'
Browse files Browse the repository at this point in the history
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.

#1318
  • Loading branch information
debarshiray committed Jun 22, 2023
1 parent 2c09606 commit b57dfd8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
14 changes: 8 additions & 6 deletions playbooks/dependencies-centos-9-stream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'

Expand Down
14 changes: 8 additions & 6 deletions playbooks/dependencies-fedora-restricted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'

Expand Down
14 changes: 8 additions & 6 deletions playbooks/dependencies-fedora.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'

Expand Down

0 comments on commit b57dfd8

Please sign in to comment.