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

Support executing ansible playbooks as tests #490

Open
psss opened this issue Dec 10, 2020 · 3 comments
Open

Support executing ansible playbooks as tests #490

psss opened this issue Dec 10, 2020 · 3 comments
Labels
plugin | ansible The ansible plugins step | execute Stuff related to the execute step

Comments

@psss
Copy link
Collaborator

psss commented Dec 10, 2020

It would be nice to support running an ansible playbook as a test. Here's a real-life example of a reboot test from the selinux repository. The best approach would be probably to add a new framework type ansible which would allow executing the playbook and check for its exit status.

Example test metadata could look like this:

test: path/to/the/playbook.yaml
framework: ansible
@psss
Copy link
Collaborator Author

psss commented Dec 10, 2020

Or shall this be covered by an sti executor #229 instead?

@psss psss added plugin | ansible The ansible plugins step | execute Stuff related to the execute step labels Dec 10, 2020
@thrix
Copy link
Collaborator

thrix commented Dec 10, 2020

I would rather see it as separate efforts.

@idorax idorax self-assigned this Jun 14, 2022
@psss
Copy link
Collaborator Author

psss commented Nov 28, 2023

What would be the difference between just running a shell script test?

  • The ansible-playbook needs to be run on the tmt runner
  • Example: ansible-playbook path/to/the/playbook.yaml -i provision-inventory-from-guests-yaml

Would this be a safe for the test runner?

  • No, it’s possible to explicitly request in playbook to execute stuff on the control node
  • So arbitrary commands could be executed on the tmt runner

What about ansible galaxy dependencies?

  • Extra packages would have to be installed on the runner
  • And the collection needs to be installed as well on the test runner

What about using the multihost provision instead?

  • One of the guests could be used as the ansible control node
  • tmt could provide an inventory file so that it’s easy to execute the ansible-playbook
  • Ideally including the ssh keys and all the stuff so that the test does not have to care about this

Using multiple guests seems to be the best approach, we need to clarify though what the exact scope of this should be, what exact should be the responsiblity of tmt and what should be left on the test.

@idorax idorax removed their assignment May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin | ansible The ansible plugins step | execute Stuff related to the execute step
Projects
None yet
Development

No branches or pull requests

3 participants