[tripleo] using molecule to test ansible playbooks and roles

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[tripleo] using molecule to test ansible playbooks and roles

Sorin Sbarnea
I recently came across molecule  a project originated at Cisco which recently become an officially Ansible project, at the same time as ansible-lint. Both projects were transferred from their former locations to Ansible github organization -- I guess as a confirmation that they are now officially supported by the core team. I used ansible-lint for years and it did same me a lot of time, molecule is still new to me.

Few weeks back I started to play with molecule as at least on paper it was supposed to resolve the problem of testing roles on multiple platforms and usage scenarios and while the work done for enabling tripleo-quickstart to support fedora-28 (py3). I was trying to find a faster way to test these changes faster and locally --- and avoid increasing the load on CI before I get the confirmation that code works locally.

The results of my testing that started about two weeks ago are very positive and can be seen on:
You can find there a job names opentstack-tox-molecule which runs in ~15minutes but this is only because on CI docker caching does not work as well as locally, locally it re-runs in ~2-3minutes.

I would like to hear your thoughts on this and if you also have some time to checkout that change and run it yourself it would be wonderful.

Once you download the change you only have to run "tox -e molecule", (or "make" which also clones sister extras repo if needed)

Feel free to send questions to the change itself, on #oooq or by email.

Cheers
Sorin Sbarnea

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: [hidden email]?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Reply | Threaded
Open this post in threaded view
|

Re: [tripleo] using molecule to test ansible playbooks and roles

Paul Belanger-2
On Sun, Nov 11, 2018 at 11:29:43AM +0000, Sorin Sbarnea wrote:

> I recently came across molecule <https://github.com/ansible/molecule>  a project originated at Cisco which recently become an officially Ansible project, at the same time as ansible-lint. Both projects were transferred from their former locations to Ansible github organization -- I guess as a confirmation that they are now officially supported by the core team. I used ansible-lint for years and it did same me a lot of time, molecule is still new to me.
>
> Few weeks back I started to play with molecule as at least on paper it was supposed to resolve the problem of testing roles on multiple platforms and usage scenarios and while the work done for enabling tripleo-quickstart to support fedora-28 (py3). I was trying to find a faster way to test these changes faster and locally --- and avoid increasing the load on CI before I get the confirmation that code works locally.
>
> The results of my testing that started about two weeks ago are very positive and can be seen on:
> https://review.openstack.org/#/c/613672/ <https://review.openstack.org/#/c/613672/>
> You can find there a job names opentstack-tox-molecule which runs in ~15minutes but this is only because on CI docker caching does not work as well as locally, locally it re-runs in ~2-3minutes.
>
> I would like to hear your thoughts on this and if you also have some time to checkout that change and run it yourself it would be wonderful.
>
> Once you download the change you only have to run "tox -e molecule", (or "make" which also clones sister extras repo if needed)
>
> Feel free to send questions to the change itself, on #oooq or by email.
>
I've been doing this for a while with ansible-role-nodepool[1], same
idea you run tox -emolecule and the role will use the docker backend to
validate. I also run it in the gate (with docker backend) however this
is online to validate that end users will not be broken locally if they
run tox -emolecule. There is a downside with docker, no systemd
integration, which is fine for me as I have other tests that are able to
provide coverage.

With zuul, it really isn't needed to run nested docker for linters and
smoke testing, as it mostly creates unneeded overhead.  However, if you
do want to standardize on molecule, I recommend you don't use docker
backend but use the delegated and reused the inventory provided by zuul.
Then you still use molecule but get the bonus of using the VMs presented
by zuul / nodepool.

- Paul

[1] http://git.openstack.org/cgit/openstack/ansible-role-nodepool

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: [hidden email]?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev