Skip to content

Fix theyvoteforyou_foreman sudoers task using template module - #600

Open
benrfairless wants to merge 4 commits into
mainfrom
bugfix/598-theyvoteforyou-foreman-sudoers-template
Open

Fix theyvoteforyou_foreman sudoers task using template module#600
benrfairless wants to merge 4 commits into
mainfrom
bugfix/598-theyvoteforyou-foreman-sudoers-template

Conversation

@benrfairless

@benrfairless benrfairless commented Jul 23, 2026

Copy link
Copy Markdown
Member

Description

The Ansible task "Allow deploy user to control application services" in the theyvoteforyou role used the copy module, which only searches the role's files/ directory. Commit 25d76f8b moved theyvoteforyou_foreman into the role's templates/ directory, so copy could no longer find it. The task failed on every run, halting the play and skipping all subsequent theyvoteforyou tasks.

This switches the task from copy to the template module (which searches templates/), matching the equivalent task in the planningalerts role. The file now also contains a {{ bundle_path }} variable that needs rendering, so template is required rather than optional. The dest is set to an explicit filename because template, unlike copy, does not append the source basename when dest is a directory.

Motivation and Context

Fixes #598. Without this, the theyvoteforyou role cannot complete a run against the server.

How Has This Been Tested?

  • Checked affected area manually on my own / staging system
    • Ran ansible-lint roles/internal/theyvoteforyou/tasks/main.yml — passes (only the expected informational notice about the custom yamllint config).
    • Confirmed bundle_path is defined in group_vars/all.yml, so the template renders.
    • Verified the fix mirrors the working planningalerts deploy_service_control task (template + explicit dest filename).
  • Ran automated tests on my own system
  • Confirmed it passed the GitHub actions tests

Screenshots (if appropriate):

N/A

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Assisted-by: Claude Code/claude-opus-4-8. AI-generated changes reviewed by the PR author

The task used the copy module, which only searches the role's files/
directory. Commit 25d76f8 moved theyvoteforyou_foreman to templates/,
so copy could no longer find it and the task failed, halting the play
and skipping all subsequent theyvoteforyou tasks.

Switch to the template module, matching the equivalent planningalerts
task. The file now also contains a {{ bundle_path }} variable that must
be rendered, so template is required rather than optional. Set an
explicit dest filename since template does not append the basename to a
directory dest the way copy does.

Resolves #598

Assisted-by: Claude Code:claude-opus-4-8
Signed-off-by: Ben Fairless <ben@oaf.org.au>
@benrfairless benrfairless self-assigned this Jul 23, 2026
…to match what is currently on the server

Signed-off-by: Ben Fairless <ben@oaf.org.au>
@benrfairless
benrfairless marked this pull request as ready for review July 26, 2026 23:08
@benrfairless
benrfairless requested a review from a team as a code owner July 26, 2026 23:08
@benrfairless
benrfairless enabled auto-merge July 26, 2026 23:08
Comment thread roles/internal/theyvoteforyou/templates/theyvoteforyou_foreman

@ianheggie-oaf ianheggie-oaf 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.

Thanks for fixing my mistake, but there is (now) a merge conflict to be resolved.

@ianheggie-oaf ianheggie-oaf 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.

theyvoteforyou_foreman should have a .j2 extension to follow recently established convention for template files

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

theyvoteforyou_foreman sudoers task fails: uses copy but file moved to templates/

2 participants