Best practice to test a playbook on a Docker image

Hi, Ansible Noob here.

We’re developing ansible roles and playbooks for production VMs which are RHEL7 systems.
We can’t test our playbook on those machines because they are dedicated to another service.
So we only can test playbooks on Docker Images similar to VMs, installing the same software.
We have a docker image “ansible-admin” that is identical to a RHEL7 ansible admin VM, and another image “ansible-target”.
What would the best, most reliable way to test a playbook on those images?
We’re also facing the problem that those images can’t “docker run” on our debian workstations as we get a systemd tmpfs error message.

We’re already testing our roles with molecule, which is awesome, but we would like to run tests for playbook too.
Thanks.

Hi, Ansible Noob here.

We're developing ansible roles and playbooks for production VMs which are RHEL7 systems.
We can't test our playbook on those machines because they are dedicated to another service.
So we only can test playbooks on Docker Images similar to VMs, installing the same software.
We have a docker image "ansible-admin" that is identical to a RHEL7 ansible admin VM, and another image "ansible-target".
What would the best, most reliable way to test a playbook on those images?
We're also facing the problem that those images can't "docker run" on our debian workstations as we get a systemd tmpfs
error message.

We're already testing our roles with molecule, which is awesome, but we would like to run tests for playbook too.
Thanks.

Why don't you use a development RHEL7 VM for testing? This should be closer to your production environment than a
docker image.

Regards
         Racke

I don’t have such VM, but I guess I can build one.
How would you do? The VM would be both admin and target? Or would you build an admin and a target on the same network?
Does it means I have to have both a iso or USB image, and a registered account on RHEL repos?
Thanks for your help

I don't have such VM, but I guess I can build one.
How would you do? The VM would be both admin and target? Or would you build an admin and a target on the same network?
Does it means I have to have both a iso or USB image, and a registered account on RHEL repos?
Thanks for your help

The controller (admin) could be a Linux machine or even a Windows one (not what I would use ..). The target is a virtual
machine on that controller. You can get that up with Virtual box and Vagrant for example. Search for "Working with Red
Hat Linux (RHEL) in a Vagrant Box" or just take a Vagrant box from their website.

Disclaimer:

I use only CentOS boxes, but it shouldn't be that much different.

Regards
        Racke

Ok thanks a lot

Actually you can't run Ansible from the Windows OS itself:
https://docs.ansible.com/ansible/latest/user_guide/windows_faq.html#can-ansible-run-on-windows
Running from a Linux VM on Windows (or WSL) then yes.

Depending on your requirements for parity, you might be able to get away with using RHEL7 container images for testing. I’ve recently started exploring some testing practices using Molecule and RHEL’s new(ish) UBI images. Molecule is primarily used for testing roles and the UBI images ship with some yum packages available for download and don’t require a RHEL account for access. So far liking the possibilities for using them in Ansible development.

More info if you’re curious: https://www.redhat.com/en/blog/introducing-red-hat-universal-base-image

Ok, that’s a lot of solutions, I’ll test it all. Thank you all.