Skip to content

Commit

Permalink
Merge pull request #590 from redhatci/tdif_feb27
Browse files Browse the repository at this point in the history
Fix ansible lint command-instead-of-shell
  • Loading branch information
tonyskapunk authored Feb 28, 2025
2 parents eecaafa + f39ad27 commit 3d8b7d9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 15 deletions.
9 changes: 6 additions & 3 deletions roles/apply_nmstate/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
file: check_if_vm_host_is_bastion.yml

- name: Apply nmstate
ansible.builtin.shell:
ansible.builtin.command:
cmd: "nmstatectl apply --no-commit --timeout 120 {{ vm_nmstate_config_path }}"
async: 60
poll: 5
changed_when: false

- name: Check network connection when vm_host and bastion are the same
when: vm_host_is_bastion | bool
Expand All @@ -36,14 +37,16 @@
This should be and IP external to the bastion and vm_host.
- name: "Check for connection wider network"
ansible.builtin.shell:
ansible.builtin.command:
cmd: "ping -c 4 -W 1 {{ vm_network_test_ip }}"
when: vm_host_is_bastion | bool
register: connection_test_result
until: connection_test_result is succeeded
retries: 60
delay: 5
changed_when: false

- name: Commit changes
ansible.builtin.shell:
ansible.builtin.command:
cmd: "nmstatectl commit"
changed_when: false
3 changes: 2 additions & 1 deletion roles/create_vms/tasks/provision_vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
loop: "{{ kvm_nodes }}"

- name: Run vm creation_scripts
shell:
ansible.builtin.command:
cmd: "/bin/bash {{ vm_create_scripts_dir }}/{{ item.name }}_setup_vm.sh"
changed_when: false

loop: "{{ kvm_nodes }}"
3 changes: 2 additions & 1 deletion roles/extract_openshift_installer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
--to={{ extract_dest_path }}
- name: Check extracted installer has agent subcommand
ansible.builtin.shell:
ansible.builtin.command:
cmd: "{{ openshift_installer_path }} agent --help"
register: res
failed_when: false
changed_when: false

- name: Check agent sub-commmand output
ansible.builtin.fail:
Expand Down
9 changes: 5 additions & 4 deletions roles/monitor_agent_based_installer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
- name: Wait for bootstrap complete
ansible.builtin.shell:
ansible.builtin.command:
cmd: "{{ agent_based_installer_path }} --log-level=debug agent wait-for bootstrap-complete"
chdir: "{{ manifests_dir }}"
failed_when: false # Timeout is fixed and some bare metal clusters complete bootstrap just after the timeout
failed_when: false
changed_when: false

- name: Check installation and gather jobs if it fails
block:
Expand Down Expand Up @@ -30,18 +31,18 @@
rescue:
# Using master-0 IP address to reach the bootstrap VM
# Placing the logs in repo_root_path
# Trying several times in case there are SSH connectivity issues
- name: Gather logs from installation
vars:
rendezvous_ip_address: "{{ hostvars[agent_based_installer_bootstrap_node][host_ip_keyword] }}"
ansible.builtin.shell:
ansible.builtin.command:
cmd: "{{ agent_based_installer_path }} --log-level=debug gather bootstrap --bootstrap {{ rendezvous_ip_address }}"
chdir: "{{ repo_root_path }}"
register: command_result
until: command_result.rc == 0
retries: 6
delay: 20
failed_when: false
changed_when: false

- name: Fail properly because installation was not completed
fail:
Expand Down
9 changes: 5 additions & 4 deletions roles/mount_discovery_iso_for_pxe/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
state: directory
mode: '0755'

- name: mount the efiboot image
shell:
cmd: "mount -o loop,ro {{ mount_images_directory }}/efiboot.img {{ mount_efiboot_directory }}" # noqa command-instead-of-module

- name: Mount the efiboot image
ansible.builtin.command:
cmd: "mount -o loop,ro {{ mount_images_directory }}/efiboot.img {{ mount_efiboot_directory }}" # noqa command-instead-of-module
changed_when: false

- name: Create grub Configuration File
template:
src: "./grub.cfg.j2"
Expand Down
2 changes: 1 addition & 1 deletion roles/validate_dns_records/tasks/check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- name: Check required domain {item} exists
ansible.builtin.shell:
ansible.builtin.command:
cmd: "{{ required_binary }} {{ item.value }} A {{ item.value }} AAAA +short"
register: res
changed_when: false
Expand Down
2 changes: 1 addition & 1 deletion roles/validate_dns_records/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- name: Check if the required binary for testing exists
ansible.builtin.shell:
ansible.builtin.command:
cmd: "which {{ required_binary }}"
register: required_binary_check
failed_when: false
Expand Down

0 comments on commit 3d8b7d9

Please sign in to comment.