Skip to content

Conversation

@vitabaks
Copy link
Owner

@vitabaks vitabaks commented Oct 25, 2025

This PR continues the integration of Ansible 12 support (#1279) and addresses the issues discovered during the testing.

Fixes #1318, #1319

Additionally

  • Changed the default Azure VM image to 'ubuntu-24_04-lts'.
    • Note: for some reason, the default version 22.04 was previously specified, now the version corresponds to all supported cloud providers.

Refactored tasks to handle missing or undefined SSH key data more robustly. Improved default handling for loop variables and conditions, ensuring correct fingerprint assignment and comparison regardless of input case or missing values.
@vitabaks vitabaks self-assigned this Oct 25, 2025
@vitabaks vitabaks added the automation Automation functionality using Ansible label Oct 25, 2025
Ensures the loop over droplet_result.results explicitly converts the selection to a list and updates the conditional to check for non-empty lists, improving reliability when processing DigitalOcean droplet data.
Updated the loop and conditional logic to properly filter and handle server results in the Hetzner cloud resources role. This ensures that only defined server data is processed and improves task reliability.
Ensures selectattr results are converted to lists for proper looping and condition evaluation in aws.yml. This improves reliability when processing server_result data.
Wrap selectattr results with list() in loops and conditions to ensure proper iteration and length checks. This improves reliability when processing server_result.results in Ansible tasks for Azure resources.
Ensure selectattr results are converted to lists before looping and update conditional to check for non-empty lists. This improves reliability when processing server results with network interfaces.
Added default value handling for pgbackrest_repo_host and ensured stanza creation only runs when pgbackrest group is present. This improves robustness and prevents errors when variables or groups are missing.
Updated pg_new_packages to use map with regex_replace for correct package name substitution and ensured the loop uses a list in the upgrade tasks.
Replaces direct usage of groups['pgbackrest'][0] with a new variable pgbackrest_delegate for task delegation. This improves readability and maintainability by centralizing the delegate host selection.
Temporarily disabled several Linux distros in molecule_pg_upgrade.yml due to 'rsync: connection unexpectedly closed' errors in the GitHub CI environment. Added a TODO note for future investigation.
Refines conditional logic in stanza_create.yml to ensure tasks only run when pgbackrest_delegate is defined. Updates delegate variable assignment to handle missing group gracefully, improving robustness in environments where the pgbackrest group may be absent.
Adds a conditional to the failed_when clause to ignore 'not found' errors when deleting DigitalOcean load balancers, preventing unnecessary task failures if the resource does not exist.
Replaces the use of 'replace' with 'map' and 'regex_replace' for looping over postgresql_packages, ensuring correct substitution of version strings during package removal in the upgrade role.
Replaces hardcoded delegate_to usage with a variable pgbackrest_delegate, improving flexibility and handling cases where the pgbackrest group may be empty. Also updates conditional checks to use default values for robustness.
Updated the usage of groups.get('pgbackrest') and related defaults in stanza_create.yml, pgbackrest_host.yml, and post_upgrade.yml to use the 'default' filter with 'true' and ensure proper type handling. This change improves robustness when the 'pgbackrest' group is missing or empty.
Refactored the Jinja template for instances_selflink to use a more compact inline object format, improving readability in the GCP resource automation task.
Updated the GCP cloud resource automation to parse the instances_selflink variable using from_json. This ensures the instances parameter is correctly interpreted as a JSON object when provisioning resources.
Changed the default Azure VM image offer to 'ubuntu-24_04-lts' and sku to 'server' for provisioning. This ensures new VMs use the latest Ubuntu LTS version by default.
@vitabaks vitabaks requested a review from Copilot October 26, 2025 15:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR continues integration of Ansible 12 support by fixing compatibility issues discovered during testing. The changes primarily address how Ansible 12 handles filter results, requiring explicit list conversions and updated conditional checks for group existence.

Key changes:

  • Replaced replace filter with map('regex_replace') for proper list handling in Ansible 12
  • Added explicit | list conversions for filters that return generators instead of lists
  • Updated conditional checks to safely handle potentially undefined groups using groups.get()

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
automation/roles/upgrade/tasks/post_upgrade.yml Updates package list filtering and pgbackrest delegation to work with Ansible 12
automation/roles/upgrade/tasks/packages.yml Adds explicit list conversion for package installation loop
automation/roles/upgrade/defaults/main.yml Changes package name replacement to use map filter instead of replace
automation/roles/update/tasks/pgbackrest_host.yml Updates pgbackrest host delegation and group checks for Ansible 12 compatibility
automation/roles/pgbackrest/tasks/stanza_create.yml Fixes pgbackrest delegation and adds safe group existence checks
automation/roles/cloud_resources/tasks/hetzner.yml Adds list conversions for selectattr filter results
automation/roles/cloud_resources/tasks/gcp.yml Fixes JSON parsing and adds list conversions for instance iteration
automation/roles/cloud_resources/tasks/digitalocean.yml Improves conditional logic and adds error handling for load balancer deletion
automation/roles/cloud_resources/tasks/azure.yml Changes default VM image from Ubuntu 22.04 to 24.04 and adds list conversions
automation/roles/cloud_resources/tasks/aws.yml Adds list conversions for EC2 instance filtering
.github/workflows/molecule_pg_upgrade.yml Temporarily disables RedHat-based distros due to rsync issues

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

Introduced 'until', 'retries', and 'delay' parameters to ssh-keyscan tasks in pgbackrest, ssh_keys, and upgrade roles to improve robustness against transient SSH key scanning failures.
@vitabaks vitabaks merged commit bd402e3 into master Oct 26, 2025
12 checks passed
@vitabaks vitabaks deleted the ansible-12 branch October 26, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation Automation functionality using Ansible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Unable to create cluster on Digitalocean using UI due to error in digitalocean.yml

2 participants