From b57dfd8b585782a29e156ee2b4d4ff7a7b9b5b4c Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Thu, 22 Jun 2023 17:49:50 +0200 Subject: [PATCH] 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 --- playbooks/dependencies-centos-9-stream.yaml | 14 ++++++++------ playbooks/dependencies-fedora-restricted.yaml | 14 ++++++++------ playbooks/dependencies-fedora.yaml | 14 ++++++++------ 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/playbooks/dependencies-centos-9-stream.yaml b/playbooks/dependencies-centos-9-stream.yaml index 4c19db3..157ae4f 100644 --- a/playbooks/dependencies-centos-9-stream.yaml +++ b/playbooks/dependencies-centos-9-stream.yaml @@ -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 }}' diff --git a/playbooks/dependencies-fedora-restricted.yaml b/playbooks/dependencies-fedora-restricted.yaml index b347d7a..f0e3649 100644 --- a/playbooks/dependencies-fedora-restricted.yaml +++ b/playbooks/dependencies-fedora-restricted.yaml @@ -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 }}' diff --git a/playbooks/dependencies-fedora.yaml b/playbooks/dependencies-fedora.yaml index abd4ccc..eec0ef5 100644 --- a/playbooks/dependencies-fedora.yaml +++ b/playbooks/dependencies-fedora.yaml @@ -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 }}'