Skip to content

unixPb: Install packages without using with_items#4368

Open
Haroon-Khel wants to merge 4 commits into
adoptium:masterfrom
Haroon-Khel:install.packages.better
Open

unixPb: Install packages without using with_items#4368
Haroon-Khel wants to merge 4 commits into
adoptium:masterfrom
Haroon-Khel:install.packages.better

Conversation

@Haroon-Khel

@Haroon-Khel Haroon-Khel commented May 29, 2026

Copy link
Copy Markdown
Contributor
  • commit message has one of the standard prefixes
  • faq.md updated if appropriate
  • other documentation is changed or added (if applicable)
  • playbook changes run through VPC or QPC (if you have access)
  • VPC/QPC not applicable for this PR
  • for inventory.yml changes, bastillion/nagios/jenkins updated accordingly

Re #4367

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces per-package with_items loops in the Common role of the Unix playbook with single calls that pass entire list variables to the package manager, intended to reduce playbook runtime by avoiding one yum/apt/zypper invocation per package (see issue #4367).

Changes:

  • Converts most package: "name={{ item }} state=latest" + with_items patterns to inline free-form package: "name={{ SomeList }} state=latest" across Linux/BSD task files.
  • Converts a few package/homebrew tasks to dict form with name: "{{ SomeList }}" (Wayland tasks, SLES s390x test tools, all macOS Homebrew/Cask installs).
  • Converts two RHEL8+ and two shared RHEL8+ helper tasks from command: dnf -y install {{ item }} + with_items to command: dnf -y install {{ SomeList }}.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/Ubuntu.yml Inlines list-based package: calls for OpenJFX, arch-specific, and Ubuntu-version-specific build/test tools.
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/Debian.yml Same inline conversion for OpenJFX, gcc, arch-specific, Debian 8 packages.
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/SLES.yml Inline conversion for SLES 11/12/15 build tools and zypper SystemTap; uses dict form for s390x test tools.
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/openSUSE.yml Inline conversion for SUSE12 and SUSE x86 build tools.
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/RedHat.yml Inline package: and command: dnf -y install conversions; dict form for Wayland packages.
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/Fedora.yml Inline conversion for various RHEL/Fedora build tools and Java installs.
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/CentOS.yml Inline conversions for CentOS build/test tools; dict form for Wayland packages.
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/FreeBSD.yml Inline conversion for gcc compiler list.
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/MacOSX.yml Converts homebrew/homebrew_cask installs to dict form with list name:.
ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/build_packages_and_tools.yml Inline conversion for Build/Test tool installs and RHEL8+ dnf commands.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- name: Install additional build tools for RHEL8+ on x86
command: dnf -y install {{ item }}
with_items: "{{ Additional_Build_Tools_RHEL_x86 }}"
command: dnf -y install {{ Additional_Build_Tools_RHEL_x86 }}
- name: Install additional build tools for RHEL8 and above
command: dnf -y install {{ item }}
with_items: "{{ Additional_Build_Tools_RHEL8Plus }}"
command: dnf -y install {{ Additional_Build_Tools_RHEL8Plus }}
- name: Install Build Tool Packages (RHEL8+)
command: dnf -y install {{ item }}
with_items: "{{ Build_Tool_Packages }}"
command: dnf -y install {{ Build_Tool_Packages }}
- name: Install Test Tool Packages ( RHEL8+ )
command: dnf -y install {{ item }}
with_items: "{{ Test_Tool_Packages }}"
command: dnf -y install {{ Test_Tool_Packages }}
Comment on lines +16 to +22
package: "name={{ Build_Tool_Packages }} state={{ package_var }}"
when:
- ansible_distribution != "RedHat"
tags: build_tools

- name: Install Build Tool Packages (Prior To RHEL8)
package: "name={{ item }} state={{ package_var }}"
with_items: "{{ Build_Tool_Packages }}"
package: "name={{ Build_Tool_Packages }} state={{ package_var }}"

@sxa sxa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I was hoping there was a more efficient way of doing this.
Not approving as we should ensure we have completed a VPC run first.

@Haroon-Khel

Copy link
Copy Markdown
Contributor Author

Theres not as much time saved in the workflow jobs as I thought, but we do skip certain tasks in the workflow jobs. This method saved me around 15mins when I was setting up the 2 new ppc64le linux machines. I ran the playbook with the changes on the second machine and noticed a significant difference in the runtime of the Common role.

Ill test this via awx and document the differences

@steelhead31 steelhead31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I'll approve once the vpc run/testing is completed

@karianna karianna left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Haroon-Khel Not sure if the copilot recommendations make sense but perhaps resolve or close those as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants