Lev Goncharov

DevOps Engineer

View My GitHub Profile

Test me if you can. Do YML developers Dream of testing ansible?

It is text version of presentation 2018-04-25 from Saint-Petersburg Linux User Group . Configuration example locates at https://github.com/ultral/ansible-role-testing

Introduction

I suppose that that you make configuration management, not bash. It means that you have to test it some how. Have you ever tested ansible roles? How do you do it?

In my case, we have:

How to do it?

Let us compare solutions for testing.

Name Test Kitchen Molecule Create new
Language ruby python bash/ruby
Watchers 132 126 0
Stars 1413 1154 1
Forks 502 174 2
License Apache 2.0 MIT Any
Commits 1929 1264 0
Releases 101 121 0
Contributors 109 82 5
Name testinfra serverspec inspec Goss
Github philpep/testinfra mizzy/serverspec chef/inspec aelsabbahy/goss
Language python ruby ruby go
Watchers 93 145 165 67
Stars 997 2105 1167 2170
Forks 138 361 330 156
License Apache 2.0 MIT Apache 2.0 Apache 2.0
Commits 380 1854 4609 309
Releases 35 282 346 47
Contributors 43 110 159 31

We decided not to reinvent the wheel & get production ready solution. Our infrastructure team had strong ruby skills & great experience with ruby, as a result we chose Test Kitchen & inspec

Kitchen-CI

kitchen-ci schema

Green Build Policy

Green build policy schema

Nested virtualization

As you remember, we had a private cloud with limited possibility to create VMs on demand. We decided to create VMs inside VMs.

we need to go deeper

First of all we tried to run Virtualbox x32 without nested. It was bad idea because of kernel panic. Also vast majority of our VMs in our infrastructure are x86_64, so we decided to continue research. As a result we decided to use nested virtualization. Hopefully it was supported by our host servers.

Faced issues

I was implementing testkitchen and faced with some issues. You can read it here

Conclusion

molecule

On one hand, current implementation works, but on the other hand, there are some issues

As a result, molecule & docker might be pretty interesting solution.

Links