Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the parameter ansible_roles_diff_mode to enable Ansible diff mode #749

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rpluem-vf
Copy link

@rpluem-vf rpluem-vf commented Jan 24, 2025

Overview of Changes

  • Add the parameter ansible_roles_diff_mode to enable Ansible diff mode. Furthermore add the needed functionality to the reports helper to show these diffs in reports.

Implementation Considerations

  • What factors or considerations were taken into account while implementing this change?

Testing Steps

  • Have an Ansible role imported into Foreman that changes a file e.g. via a template, copy or lineinfile task and set the ansible_roles_diff_mode parameter to true for this host. Run the Ansible Ansible Roles - Ansible Default job. Afterwards the diff of the change can been seen in the script output and in the config report via a link. This requires all three PR's.

Checklists

  • I am familiar with the contributing guidelines.
  • I have added relevant tests for my changes.
  • I have updated the documentation accordingly.

Additional Notes

Depends on the following PR's:

Sorry, something went wrong.

Add the parameter ansible_roles_diff_mode to enable Ansible diff mode.
Furthermore add the needed functionality to the reports helper to
show these diffs in reports.

* app/helpers/foreman_ansible/ansible_reports_helper.rb:
  Check if the result hash of a task contains a 'report_diff' key
  and make its value, the unified diff, available via a link.

* app/models/foreman_ansible/ansible_provider.rb:
  Set the diff_mode smart proxy parameter based on the parameter
  ansible_roles_diff_mode.

* db/seeds.d/100_common_parameters.rb:
  Create the global parameter ansible_roles_diff_mode with a default
  of false.

* test/fixtures/report.json:
  Add fixture data for new test case

* test/unit/helpers/ansible_reports_helper_test.rb:
  - Adjust expected strings existing test cases
  - Add new test case for diff_mode
  - Include further modules used by ansible_reports_helper.rb

Signed-off-by: Ruediger Pluem <ruediger.pluem@vodafone.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant