Skip to content

Commit

Permalink
use argv with command instead of quoting inside the command
Browse files Browse the repository at this point in the history
fixed in all places that replaced shell with command
  • Loading branch information
dangel101 authored and mwperina committed Oct 7, 2022
1 parent d3d895f commit 48fe11a
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
register: uuid

- name: Get the state from peer file
ansible.builtin.command: grep state "/var/lib/glusterd/peers/{{ uuid.stdout | trim }}"
ansible.builtin.command:
argv:
- grep
- state
- "/var/lib/glusterd/peers/{{ uuid.stdout | trim }}"
register: grepres1

- name: Get the state from the peer command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
- name: Fetch the directory and volume details
block:
- name: Get the list of volumes on the machine
ansible.builtin.command: ls "{{ glusterd_libdir }}/vols"
ansible.builtin.command:
argv:
- ls
- "{{ glusterd_libdir }}/vols"
register: dir_list

- name: Setting Facts for Volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
- ansible_distribution_version is version('8.3', '<=')

- name: Enable advanced virtualization module
ansible.builtin.command: "dnf -y module enable virt:{{ virt_mod_ver }}"
ansible.builtin.command:
argv:
- dnf
- -y
- module
- enable
- "virt:{{ virt_mod_ver }}"

when:
- host_deploy_origin_type != ovirt_origin_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@
when: uuid.changed | bool

- name: Removing old kernel arguments
ansible.builtin.command: "grubby --update-kernel=ALL --remove-args '{{ host_deploy_kernel_cmdline_old }}'"
ansible.builtin.command:
argv:
- grubby
- --update-kernel=ALL
- --remove-args
- "'{{ host_deploy_kernel_cmdline_old }}'"
when: host_deploy_kernel_cmdline_old is defined and host_deploy_kernel_cmdline_old

- name: Adding new kernel arguments
ansible.builtin.command: "grubby --update-kernel=ALL --args '{{ host_deploy_kernel_cmdline_new }}'"
ansible.builtin.command:
argv:
- grubby
- --update-kernel=ALL
- --args
- "'{{ host_deploy_kernel_cmdline_new }}'"
when: host_deploy_kernel_cmdline_new is defined and host_deploy_kernel_cmdline_new
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
state: started

- name: Set tune profile
ansible.builtin.command: "tuned-adm profile {{ host_deploy_tuned_profile }}"
ansible.builtin.command:
argv:
- tuned-adm
- profile
- "{{ host_deploy_tuned_profile }}"
register: tune_profile_set

- name: Enable tune service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

- block:
- name: Get vdsm id
ansible.builtin.command: cat "{{ vdsm_id_file }}"
ansible.builtin.command:
argv:
- cat
- "{{ vdsm_id_file }}"
register: vdsm_id_file_content

- name: Set vdsm id
Expand Down Expand Up @@ -47,7 +50,10 @@
register: stat_results

- name: Detect vdsm id for ppc or ppc64
ansible.builtin.command: cat "{{ ppc_system_id }}"
ansible.builtin.command:
argv:
- cat
- "{{ ppc_system_id }}"
register: vdsm_id_res
when: stat_results.stat.exists

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@
- latest_rh_rel is version('8.3', '<=')

- name: Enable advanced virtualization module for relevant OS version
ansible.builtin.command: "dnf -y module enable virt:{{ virt_mod_ver }}"
ansible.builtin.command:
argv:
- dnf
- -y
- module
- enable
- "virt:{{ virt_mod_ver }}"

when:
- ansible_facts.packages['redhat-release'] is defined
Expand Down

0 comments on commit 48fe11a

Please sign in to comment.