Best practice to test a playbook on a Docker image

59 views
Skip to first unread message

Julien Cochennec

unread,
Oct 21, 2019, 11:20:38 AM10/21/19
to Ansible Project
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.

Stefan Hornburg (Racke)

unread,
Oct 21, 2019, 11:29:16 AM10/21/19
to ansible...@googlegroups.com
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

>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/4b0d7a77-e907-4523-8113-f3da1c75663c%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/4b0d7a77-e907-4523-8113-f3da1c75663c%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

Julien Cochennec

unread,
Oct 21, 2019, 11:43:21 AM10/21/19
to Ansible Project
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

Le lundi 21 octobre 2019 17:29:16 UTC+2, Stefan Hornburg (Racke) a écrit :
On 10/21/19 6:20 PM, Julien Cochennec wrote:
> 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

>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to

Stefan Hornburg (Racke)

unread,
Oct 21, 2019, 11:52:45 AM10/21/19
to ansible...@googlegroups.com
On 10/21/19 6:43 PM, Julien Cochennec wrote:
> 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

>
> Le lundi 21 octobre 2019 17:29:16 UTC+2, Stefan Hornburg (Racke) a écrit :
>
> On 10/21/19 6:20 PM, Julien Cochennec wrote:
> > 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
>
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to
> > ansible...@googlegroups.com <javascript:> <mailto:ansible-proje...@googlegroups.com <javascript:>>.
> <https://groups.google.com/d/msgid/ansible-project/4b0d7a77-e907-4523-8113-f3da1c75663c%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/4b0d7a77-e907-4523-8113-f3da1c75663c%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5209be61-9c00-42bf-a338-e35800d4c66b%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/5209be61-9c00-42bf-a338-e35800d4c66b%40googlegroups.com?utm_medium=email&utm_source=footer>.
signature.asc

Julien Cochennec

unread,
Oct 21, 2019, 11:56:32 AM10/21/19
to ansible...@googlegroups.com
Ok thanks a lot

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bf8cc17d-5d5c-1386-8e9b-12575e17dfd0%40linuxia.de.

Dick Visser

unread,
Oct 21, 2019, 1:23:31 PM10/21/19
to ansible...@googlegroups.com
On Mon, 21 Oct 2019 at 17:52, Stefan Hornburg (Racke) <ra...@linuxia.de> wrote:
>
> On 10/21/19 6:43 PM, Julien Cochennec wrote:
> > 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 ..).

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.


--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

Uriel

unread,
Oct 21, 2019, 1:29:35 PM10/21/19
to Ansible Project
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

Julien Cochennec

unread,
Oct 22, 2019, 2:17:49 AM10/22/19
to Ansible Project
Ok, that's a lot of solutions, I'll test it all. Thank you all.
Reply all
Reply to author
Forward
0 new messages