feat: Make the sysadmin-opensift-readonly group deploy in production #3188

Merged
kevin merged 2 commits from smoliicek/ansible:readonly-openshift-prod into main 2026-03-11 21:32:52 +00:00
Member

this isn't something that is urgently needed, so we can merge this after the freeze ends

Signed-off-by: Vít Smolík me@smoliicek.cz

this isn't something that is urgently needed, so we can merge this after the freeze ends Signed-off-by: Vít Smolík <me@smoliicek.cz>
feat: Make the sysadmin-opensift-readonly group deploy in production
All checks were successful
Linter / yamllint (pull_request) Successful in 24s
Linter / ansible-lint (pull_request) Successful in 40s
AI Code Review / ai-review (pull_request_target) Successful in 31s
1b50e4ceb4
Signed-off-by: Vít Smolík <me@smoliicek.cz>
smoliicek 2026-03-11 18:59:18 +00:00

AI Code Review

📋 MR Summary

This MR promotes the sysadmin-openshift-readonly role, group, and rolebinding templates from staging to production by moving them to the main templates list.

  • Key Changes:
    • Moved sysadmin-openshift-readonly-* files out of the stg_templates section to the main template list.
  • Impact: roles/openshift/cluster/tasks/main.yaml
  • Risk Level: 🟢 Low - This is a straightforward promotion of existing staging configuration to production. The primary risk is Ansible parsing an empty YAML key as null.

Detailed Code Review

The change correctly moves the templates to the main deployment list as intended. However, leaving the stg_templates key empty in YAML evaluates to null rather than an empty list. If any downstream tasks iterate over this variable without a default filter (e.g., loop: "{{ stg_templates | default([]) }}"), it will cause an Ansible runtime error. It is recommended to either remove the key entirely or explicitly set it to an empty list.

📂 File Reviews

📄 `roles/openshift/cluster/tasks/main.yaml` - Moves read-only templates to the main template list.
  • Major [Bug]: Leaving stg_templates: empty evaluates to null in YAML. If later tasks attempt to iterate over stg_templates, Ansible will throw a runtime error.
    • Suggestion: Explicitly set stg_templates to an empty list or remove the key entirely if it is no longer needed.
    stg_templates: []

Summary

  • Overall Assessment: The intent is clear and correct, but there is a potential Ansible runtime issue due to an empty YAML key. Addressing the empty variable will ensure a smooth deployment after the freeze.
  • Priority Issues:
    • Ensure stg_templates does not evaluate to null by either assigning an empty list [] or removing the key entirely, to prevent Ansible iteration errors.

🤖 AI Code Review | Generated with ai-code-review | Model: gemini-3.1-pro-preview

⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.

## AI Code Review ### 📋 MR Summary This MR promotes the `sysadmin-openshift-readonly` role, group, and rolebinding templates from staging to production by moving them to the main templates list. - **Key Changes:** - Moved `sysadmin-openshift-readonly-*` files out of the `stg_templates` section to the main template list. - **Impact:** roles/openshift/cluster/tasks/main.yaml - **Risk Level:** 🟢 Low - This is a straightforward promotion of existing staging configuration to production. The primary risk is Ansible parsing an empty YAML key as null. ### Detailed Code Review The change correctly moves the templates to the main deployment list as intended. However, leaving the `stg_templates` key empty in YAML evaluates to `null` rather than an empty list. If any downstream tasks iterate over this variable without a default filter (e.g., `loop: "{{ stg_templates | default([]) }}"`), it will cause an Ansible runtime error. It is recommended to either remove the key entirely or explicitly set it to an empty list. #### 📂 File Reviews <details> <summary><strong>📄 `roles/openshift/cluster/tasks/main.yaml`</strong> - Moves read-only templates to the main template list.</summary> - **Major** [Bug]: Leaving `stg_templates:` empty evaluates to `null` in YAML. If later tasks attempt to iterate over `stg_templates`, Ansible will throw a runtime error. - *Suggestion:* Explicitly set `stg_templates` to an empty list or remove the key entirely if it is no longer needed. ```` stg_templates: [] ```` </details> ### ✅ Summary - **Overall Assessment:** The intent is clear and correct, but there is a potential Ansible runtime issue due to an empty YAML key. Addressing the empty variable will ensure a smooth deployment after the freeze. - **Priority Issues:** - Ensure `stg_templates` does not evaluate to `null` by either assigning an empty list `[]` or removing the key entirely, to prevent Ansible iteration errors. --- 🤖 **AI Code Review** | Generated with [ai-code-review](https://gitlab.com/redhat/edge/ci-cd/ai-code-review) | **Model:** `gemini-3.1-pro-preview` ⚠️ *AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.*
fix bug: set stg_template as empty list, so ansible doesn't fail
All checks were successful
Linter / yamllint (pull_request) Successful in 25s
Linter / ansible-lint (pull_request) Successful in 39s
AI Code Review / ai-review (pull_request_target) Successful in 26s
7a8164e124
Signed-off-by: Vít Smolík <me@smoliicek.cz>

AI Code Review

📋 MR Summary

This MR deploys the sysadmin-openshift-readonly group to the production environment by moving its associated templates to the main templates list in the Ansible task.

  • Key Changes:
    • Moved sysadmin-openshift-readonly-* templates from stg_templates to the default template list.
    • Initialized stg_templates as an empty list to prevent Ansible execution failures.
  • Impact: roles/openshift/cluster/tasks/main.yaml
  • Risk Level: 🟢 Low - The changes only alter the scope of deployment for read-only roles and bindings in OpenShift. The initialization of the stg_templates array resolves an existing Ansible bug without introducing complex logic.

Detailed Code Review

The changes are straightforward and accurately reflect the PR description. Moving the sysadmin-openshift-readonly resources out of the staging-only list ensures they are deployed in production as intended. Initializing stg_templates: [] is a correct and safe approach to fix the undefined variable issue in Ansible.

No security, performance, or logic issues were found. As noted by the author, merging should be deferred until after the current freeze period.

📂 File Reviews

📄 `roles/openshift/cluster/tasks/main.yaml` - Updated template lists to include read-only resources in production and initialized staging templates as an empty list.
  • Suggestion [Style]: The logic is correct, but depending on how stg_templates is used downstream in the playbook, you could consider omitting it entirely if empty lists are handled correctly by the with_items or loop module. However, explicitly defining it as an empty list as done here is perfectly safe and prevents the 'undefined variable' error.
    • Suggestion: No changes needed; current implementation is safe.

Summary

  • Overall Assessment: The review identified no critical issues. The logic is sound, correctly addressing both the feature request and the Ansible bug. Review is complete.
  • Minor Suggestions:
    • Ensure deployment occurs only after the freeze period has ended, as noted in the PR description.

🤖 AI Code Review | Generated with ai-code-review | Model: gemini-3.1-pro-preview

⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.

## AI Code Review ### 📋 MR Summary This MR deploys the `sysadmin-openshift-readonly` group to the production environment by moving its associated templates to the main templates list in the Ansible task. - **Key Changes:** - Moved `sysadmin-openshift-readonly-*` templates from `stg_templates` to the default template list. - Initialized `stg_templates` as an empty list to prevent Ansible execution failures. - **Impact:** roles/openshift/cluster/tasks/main.yaml - **Risk Level:** 🟢 Low - The changes only alter the scope of deployment for read-only roles and bindings in OpenShift. The initialization of the `stg_templates` array resolves an existing Ansible bug without introducing complex logic. ### Detailed Code Review The changes are straightforward and accurately reflect the PR description. Moving the `sysadmin-openshift-readonly` resources out of the staging-only list ensures they are deployed in production as intended. Initializing `stg_templates: []` is a correct and safe approach to fix the undefined variable issue in Ansible. No security, performance, or logic issues were found. As noted by the author, merging should be deferred until after the current freeze period. #### 📂 File Reviews <details> <summary><strong>📄 `roles/openshift/cluster/tasks/main.yaml`</strong> - Updated template lists to include read-only resources in production and initialized staging templates as an empty list.</summary> - **Suggestion** [Style]: The logic is correct, but depending on how `stg_templates` is used downstream in the playbook, you could consider omitting it entirely if empty lists are handled correctly by the `with_items` or loop module. However, explicitly defining it as an empty list as done here is perfectly safe and prevents the 'undefined variable' error. - *Suggestion:* No changes needed; current implementation is safe. </details> ### ✅ Summary - **Overall Assessment:** The review identified no critical issues. The logic is sound, correctly addressing both the feature request and the Ansible bug. Review is complete. - **Minor Suggestions:** - Ensure deployment occurs only after the freeze period has ended, as noted in the PR description. --- 🤖 **AI Code Review** | Generated with [ai-code-review](https://gitlab.com/redhat/edge/ci-cd/ai-code-review) | **Model:** `gemini-3.1-pro-preview` ⚠️ *AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.*
kevin merged commit ba480436d7 into main 2026-03-11 21:32:52 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
infra/ansible!3188
No description provided.