From cc1fa209e2e610c31f42429bf2d66a6619a43872 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Mon, 11 Aug 2025 15:02:13 -0600 Subject: [PATCH] Fix ci (#269) --- .github/workflows/pre-commit.yml | 9 ------ .github/workflows/run-pc.sh | 3 +- .pre-commit-gh.yml | 2 +- .../demo/cloud/roles/aws/tasks/create_vm.yml | 4 +-- .../demo/cloud/roles/aws/tasks/restore_vm.yml | 8 +++--- .../cloud/roles/aws/tasks/snapshot_vm.yml | 12 ++++---- .../roles/eda_controller/tasks/main.yml | 10 +++---- .../openshift/roles/snapshot/tasks/create.yml | 12 ++++---- .../roles/snapshot/tasks/restore.yml | 14 +++++----- .../patching/roles/patch_linux/tasks/main.yml | 14 +++++----- .../roles/patch_windows/tasks/main.yml | 2 +- .../report_linux_patching/templates/report.j2 | 12 ++++---- .../roles/report_ocp_patching/tasks/main.yml | 4 +-- .../report_ocp_patching/templates/patch.j2 | 12 ++++---- .../roles/report_server/tasks/apache.yml | 2 +- .../tasks/linux_landing_page.yml | 2 +- .../tasks/windows_landing_page.yml | 2 +- .../report_server/templates/linux_report.j2 | 2 +- .../report_server/templates/windows_report.j2 | 2 +- .../roles/register_host/tasks/main.yml | 10 +++---- .../roles/scap_client/tasks/main.yaml | 28 +++++++++---------- linux/ec2_register.yml | 6 ++-- linux/patching.yml | 2 +- linux/temp_sudo.yml | 2 +- openshift/cnv/patch.yml | 2 +- 25 files changed, 85 insertions(+), 93 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 7dcc362..411964e 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,13 +14,4 @@ jobs: - uses: actions/checkout@v4 - run: ./.github/workflows/run-pc.sh shell: bash - pre-commit-24: - container: - image: quay.io/ansible-product-demos/apd-ee-24 - options: --user root - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: USE_PYTHON=python3.9 ./.github/workflows/run-pc.sh - shell: bash diff --git a/.github/workflows/run-pc.sh b/.github/workflows/run-pc.sh index b188b7f..6e9d64c 100755 --- a/.github/workflows/run-pc.sh +++ b/.github/workflows/run-pc.sh @@ -1,6 +1,7 @@ #!/bin/bash -x -dnf install git-lfs -y +# should no longer need this +#dnf install git-lfs -y PYTHON_VARIANT="${USE_PYTHON:-python3.11}" PATH="$PATH:$HOME/.local/bin" diff --git a/.pre-commit-gh.yml b/.pre-commit-gh.yml index b528eac..b4bf6be 100644 --- a/.pre-commit-gh.yml +++ b/.pre-commit-gh.yml @@ -16,7 +16,7 @@ repos: - repo: https://github.com/ansible/ansible-lint.git # get latest release tag from https://github.com/ansible/ansible-lint/releases/ - rev: v6.20.3 + rev: v25.7.0 hooks: - id: ansible-lint additional_dependencies: diff --git a/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_vm.yml b/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_vm.yml index 61e4779..a9922fa 100644 --- a/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_vm.yml +++ b/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_vm.yml @@ -17,12 +17,12 @@ filters: name: "{{ aws_image_filter }}" architecture: "{{ aws_image_architecture | default(omit) }}" - register: amis + register: aws_amis - name: AWS| CREATE VM | save ami ansible.builtin.set_fact: aws_instance_ami: > - {{ (amis.images | selectattr('name', 'defined') | sort(attribute='creation_date'))[-2] }} + {{ (aws_amis.images | selectattr('name', 'defined') | sort(attribute='creation_date'))[-2] }} - name: AWS| CREATE VM | create instance amazon.aws.ec2_instance: diff --git a/collections/ansible_collections/demo/cloud/roles/aws/tasks/restore_vm.yml b/collections/ansible_collections/demo/cloud/roles/aws/tasks/restore_vm.yml index 730ecad..8be5338 100644 --- a/collections/ansible_collections/demo/cloud/roles/aws/tasks/restore_vm.yml +++ b/collections/ansible_collections/demo/cloud/roles/aws/tasks/restore_vm.yml @@ -10,14 +10,14 @@ wait: true - name: AWS | RESTORE VM | get volumes - register: r_vol_info + register: aws_r_vol_info amazon.aws.ec2_vol_info: region: "{{ aws_region }}" filters: attachment.instance-id: "{{ instance_id }}" - name: AWS | RESTORE VM | detach volumes - loop: "{{ r_vol_info.volumes }}" + loop: "{{ aws_r_vol_info.volumes }}" loop_control: loop_var: volume label: "{{ volume.id }}" @@ -40,7 +40,7 @@ - name: AWS | RESTORE VM | get all snapshots when: inventory_hostname not in aws_snapshots - register: r_snapshots + register: aws_r_snapshots amazon.aws.ec2_snapshot_info: region: "{{ aws_region }}" filters: @@ -51,7 +51,7 @@ amazon.aws.ec2_vol: region: "{{ aws_region }}" instance: "{{ instance_id }}" - snapshot: "{{ r_snapshots.snapshots[0].snapshot_id }}" + snapshot: "{{ aws_r_snapshots.snapshots[0].snapshot_id }}" device_name: "/dev/sda1" - name: AWS | RESTORE VM | start vm diff --git a/collections/ansible_collections/demo/cloud/roles/aws/tasks/snapshot_vm.yml b/collections/ansible_collections/demo/cloud/roles/aws/tasks/snapshot_vm.yml index 0826f8c..8a1f609 100644 --- a/collections/ansible_collections/demo/cloud/roles/aws/tasks/snapshot_vm.yml +++ b/collections/ansible_collections/demo/cloud/roles/aws/tasks/snapshot_vm.yml @@ -12,18 +12,18 @@ file: snapshot_vm.yml - name: AWS | SNAPSHOT VM | get volumes - register: r_vol_info + register: aws_r_vol_info amazon.aws.ec2_vol_info: region: "{{ aws_region }}" filters: attachment.instance-id: "{{ instance_id }}" - name: AWS | SNAPSHOT VM | take snapshots - loop: "{{ r_vol_info.volumes }}" + loop: "{{ aws_r_vol_info.volumes }}" loop_control: loop_var: volume label: "{{ volume.id }}" - register: r_snapshots + register: aws_r_snapshots amazon.aws.ec2_snapshot: region: "{{ aws_region }}" volume_id: "{{ volume.id }}" @@ -32,11 +32,11 @@ - name: AWS | SNAPSHOT VM | format snapshot stat ansible.builtin.set_fact: - snapshot_stat: + aws_snapshot_stat: - key: "{{ inventory_hostname }}" - value: "{{ r_snapshots.results | json_query(aws_ec2_snapshot_query) }}" + value: "{{ aws_r_snapshots.results | json_query(aws_ec2_snapshot_query) }}" - name: AWS | SNAPSHOT VM | record snapshot with host key ansible.builtin.set_stats: data: - aws_snapshots: "{{ snapshot_stat | items2dict }}" + aws_snapshots: "{{ aws_snapshot_stat | items2dict }}" diff --git a/collections/ansible_collections/demo/openshift/roles/eda_controller/tasks/main.yml b/collections/ansible_collections/demo/openshift/roles/eda_controller/tasks/main.yml index 9c95b05..963470d 100644 --- a/collections/ansible_collections/demo/openshift/roles/eda_controller/tasks/main.yml +++ b/collections/ansible_collections/demo/openshift/roles/eda_controller/tasks/main.yml @@ -17,14 +17,14 @@ kind: Route name: "{{ eda_controller_project_app_name }}" namespace: "{{ eda_controller_project }}" - register: r_eda_route - until: r_eda_route.resources[0].spec.host is defined + register: eda_controller_r_eda_route + until: eda_controller_r_eda_route.resources[0].spec.host is defined retries: 30 delay: 45 - name: Get eda-controller route hostname ansible.builtin.set_fact: - eda_controller_hostname: "{{ r_eda_route.resources[0].spec.host }}" + eda_controller_hostname: "{{ eda_controller_r_eda_route.resources[0].spec.host }}" - name: Wait for eda_controller to be running ansible.builtin.uri: @@ -36,8 +36,8 @@ validate_certs: false body_format: json status_code: 200 - register: r_result - until: not r_result.failed + register: eda_controller_r_result + until: not eda_controller_r_result.failed retries: 60 delay: 45 diff --git a/collections/ansible_collections/demo/openshift/roles/snapshot/tasks/create.yml b/collections/ansible_collections/demo/openshift/roles/snapshot/tasks/create.yml index 89cb419..1b531af 100644 --- a/collections/ansible_collections/demo/openshift/roles/snapshot/tasks/create.yml +++ b/collections/ansible_collections/demo/openshift/roles/snapshot/tasks/create.yml @@ -3,7 +3,7 @@ redhat.openshift_virtualization.kubevirt_vm_info: name: "{{ item }}" namespace: "{{ vm_namespace }}" - register: state + register: snapshot_state - name: Stop VirtualMachine redhat.openshift_virtualization.kubevirt_vm: @@ -11,7 +11,7 @@ namespace: "{{ vm_namespace }}" running: false wait: true - when: state.resources.0.spec.running + when: snapshot_state.resources.0.spec.running - name: Create a VirtualMachineSnapshot kubernetes.core.k8s: @@ -29,7 +29,7 @@ wait: true wait_condition: type: Ready - register: snapshot + register: snapshot_snapshot - name: Start VirtualMachine redhat.openshift_virtualization.kubevirt_vm: @@ -37,13 +37,13 @@ namespace: "{{ vm_namespace }}" running: true wait: true - when: state.resources.0.spec.running + when: snapshot_state.resources.0.spec.running - name: Export snapshot name ansible.builtin.set_stats: data: - restore_snapshot_name: "{{ snapshot.result.metadata.name }}" + restore_snapshot_name: "{{ snapshot_snapshot.result.metadata.name }}" - name: Output snapshot name ansible.builtin.debug: - msg: "Successfully created snapshot {{ snapshot.result.metadata.name }}" + msg: "Successfully created snapshot {{ snapshot_snapshot.result.metadata.name }}" diff --git a/collections/ansible_collections/demo/openshift/roles/snapshot/tasks/restore.yml b/collections/ansible_collections/demo/openshift/roles/snapshot/tasks/restore.yml index a30b964..8bb7329 100644 --- a/collections/ansible_collections/demo/openshift/roles/snapshot/tasks/restore.yml +++ b/collections/ansible_collections/demo/openshift/roles/snapshot/tasks/restore.yml @@ -3,18 +3,18 @@ redhat.openshift_virtualization.kubevirt_vm_info: name: "{{ item }}" namespace: "{{ vm_namespace }}" - register: state + register: snapshot_state - name: List snapshots kubernetes.core.k8s_info: api_version: snapshot.kubevirt.io/v1alpha1 kind: VirtualMachineSnapshot namespace: "{{ vm_namespace }}" - register: snapshot + register: snapshot_snapshot - name: Set snapshot name for {{ item }} ansible.builtin.set_fact: - latest_snapshot: "{{ snapshot.resources | selectattr('spec.source.name', 'equalto', item) | sort(attribute='metadata.creationTimestamp') | first }}" + snapshot_latest_snapshot: "{{ snapshot_snapshot.resources | selectattr('spec.source.name', 'equalto', item) | sort(attribute='metadata.creationTimestamp') | first }}" - name: Stop VirtualMachine redhat.openshift_virtualization.kubevirt_vm: @@ -22,7 +22,7 @@ namespace: "{{ vm_namespace }}" running: false wait: true - when: state.resources.0.spec.running + when: snapshot_state.resources.0.spec.running - name: Restore a VirtualMachineSnapshot kubernetes.core.k8s: @@ -30,14 +30,14 @@ apiVersion: snapshot.kubevirt.io/v1alpha1 kind: VirtualMachineRestore metadata: - generateName: "{{ latest_snapshot.metadata.generateName }}" + generateName: "{{ snapshot_latest_snapshot.metadata.generateName }}" namespace: "{{ vm_namespace }}" spec: target: apiGroup: kubevirt.io kind: VirtualMachine name: "{{ item }}" - virtualMachineSnapshotName: "{{ latest_snapshot.metadata.name }}" + virtualMachineSnapshotName: "{{ snapshot_latest_snapshot.metadata.name }}" wait: true wait_condition: type: Ready @@ -48,4 +48,4 @@ namespace: "{{ vm_namespace }}" running: true wait: true - when: state.resources.0.spec.running + when: snapshot_state.resources.0.spec.running diff --git a/collections/ansible_collections/demo/patching/roles/patch_linux/tasks/main.yml b/collections/ansible_collections/demo/patching/roles/patch_linux/tasks/main.yml index d1722f0..6c46c60 100644 --- a/collections/ansible_collections/demo/patching/roles/patch_linux/tasks/main.yml +++ b/collections/ansible_collections/demo/patching/roles/patch_linux/tasks/main.yml @@ -8,12 +8,12 @@ check_mode: false - name: Upgrade packages (yum) - ansible.builtin.yum: + ansible.legacy.dnf: name: '*' state: latest # noqa: package-latest - Intended to update packages to latest exclude: "{{ exclude_packages }}" when: ansible_pkg_mgr == "yum" - register: patchingresult_yum + register: patch_linux_patchingresult_yum - name: Upgrade packages (dnf) ansible.builtin.dnf: @@ -21,17 +21,17 @@ state: latest # noqa: package-latest - Intended to update packages to latest exclude: "{{ exclude_packages }}" when: ansible_pkg_mgr == "dnf" - register: patchingresult_dnf + register: patch_linux_patchingresult_dnf - name: Check to see if we need a reboot ansible.builtin.command: needs-restarting -r - register: result - changed_when: result.rc == 1 - failed_when: result.rc > 1 + register: patch_linux_result + changed_when: patch_linux_result.rc == 1 + failed_when: patch_linux_result.rc > 1 check_mode: false - name: Reboot Server if Necessary ansible.builtin.reboot: when: - - result.rc == 1 + - patch_linux_result.rc == 1 - allow_reboot diff --git a/collections/ansible_collections/demo/patching/roles/patch_windows/tasks/main.yml b/collections/ansible_collections/demo/patching/roles/patch_windows/tasks/main.yml index 429340e..3dc4e91 100644 --- a/collections/ansible_collections/demo/patching/roles/patch_windows/tasks/main.yml +++ b/collections/ansible_collections/demo/patching/roles/patch_windows/tasks/main.yml @@ -12,4 +12,4 @@ category_names: "{{ win_update_categories | default(omit) }}" reboot: "{{ allow_reboot }}" state: installed - register: patchingresult + register: patch_windows_patchingresult diff --git a/collections/ansible_collections/demo/patching/roles/report_linux_patching/templates/report.j2 b/collections/ansible_collections/demo/patching/roles/report_linux_patching/templates/report.j2 index 1d7a840..172f44e 100644 --- a/collections/ansible_collections/demo/patching/roles/report_linux_patching/templates/report.j2 +++ b/collections/ansible_collections/demo/patching/roles/report_linux_patching/templates/report.j2 @@ -35,17 +35,17 @@ {{hostvars[linux_host]['ansible_distribution_version']|default("none")}}