Continuous Testing with Molecule, Ansible, and GitHub Actions
HTML-код
- Опубликовано: 12 окт 2020
- This presentation was given at AnsibleFest Global 2020.
The presentation uses an example and explanation from Chapter 13 in my book, Ansible for DevOps: www.ansiblefordevops.com
I am uploading it to the RUclips channel since the platform where the session is stored is not all that easy to access after the fact. Here's the description from my session:
"Make sure you never commit a broken playbook using Molecule, Ansible, and GitHub Actions. Jeff Geerling discusses his CI workflows using GitHub Actions to manage hundreds of Ansible-based projects, including playbooks, roles, collections, and even Kubernetes Operators. Learn how Molecule makes developing and testing Ansible content easier, and how you can integrate it with GitHub Actions-or any other CI environment-for easy Ansible CI."
#AnsibleFest #Ansible #Molecule Наука
Awesome and thorough as always! Thanks for all you do Jeff!
Watched this live and watching again 😀
Thank you for this great presentation of rare quality and clarity! And thanks for your book! :)
Thanks for making this available. It wasn't available after the live session and I was told that on demand won't be up until after the conference ends. And then it will only be available for a year.
Great session.
they are usually available minutes after the presentation is over. I see it there now.
@@jeremys6003 yeah, they did appear after a short time. Support gave incorrect info. I find the service they are using a bit janky.
@@markberry5994 Agreed but I did just learn the sessions will stay online for 12 months.
Great tutorial sir, and this comes right after almost all sessions of Ansible Fest , did saw you there
Awesome demo and explanation of Molecule. I need to port this over to a Network Automation scenario
Great video. Very clear as usual.
As someone that hasn’t got a clue on what your talking about I find myself learning more on each subject you review.
Jeff your so far a head of me that your words are zipping past me at the speed of light.
It’s as though I have found a book written by a alien race. Very interesting to look at but I haven’t figured out if I have it up side down or right side up. 👇🏽👆🏾
awesome content
thanks so much! Your talk is super-clear and useful as always.
I'm producing a screencast very similar to this one, where I'm developing a *Terraform* script using Molecule. M/Ansible is super useful and flexible, I hope that the combination with TF is a "best of both worlds" thing vs a "brain explody" thing :)
I haven't personally used Terraform with Molecule, but it seems doable! I know a lot of people use Ansible + Terraform.
Thanks Jeff for such a great presentation. Can this be used to test any codebase not just limited to Ansible roles?
Nice video! I am only just getting into this and it can get rather confusing with all options one has. Do you ever use Jenkins for any sorts of purposes in relation to Ansible or does this fulfill your needs?
Great Great Tutorial. What is the best way to convert this? I would like to use molecule-ec2 with gitlab-ci
👏👏
Green checkmark good ✅✅
Lot of Actions ehhh, Keep on coming...
What is the advantage of running daily/monthly tests if you are already testing on every PR and push?
For many projects, there are days or weeks where nobody is actively working on them, so the regular CI runs can catch things like bitrot (compatibility with newer versions of Ansible, ansible-test, etc.
Introductions finish at time index 5:40
Why not run the linting in actions rather than molecule? That way it only runs once rather than once per os/playbook test on molecule.
That's not a bad idea. I still like having the ability to run `molecule lint` though, locally, and having Molecule do that work for me. The lint step only takes 3-5 seconds, but it would shave a little time if I just had a separate job that only did the lint, and the other jobs just ran the molecule test scenario without needing to have ansible-lint and yamllint installed (though they install pretty quick).
It’s funny you should say this, on github.com/marvel-nccr I am just in the process of updating our roles testing from travis to GH Actions.
In this I have also moved the linting from molecule to pre-commit, with the added bonus of using yaml-pretty-format to remove some of the manual work.
This gist is essentially what I’m adding: gist.github.com/chrisjsewell/c8b4465e1bc006f483d9313d3a33eff4
There is also adds continuous deployment added 😀 But it would be great if ansible-galaxy had more focussed support for this, as they have with the TravisCI webhook
I would like to see you use Gitlab CI.
I don't understand the use of `- import_playbook: ../../main.yml`. Why not just use something like
- name: Converge
hosts: all
roles:
- role: my_role
This is to test a playbook. Sometimes you want to test playbooks with multiple roles or just simple playbooks not utilizing roles.
Would you considered an update on using molecule? There have been a lot of changes recently…
Most notably/irritating is the removal of the lint command from molecule. 😠
excuseme, what is your $PS1?
Faster than Sonic
SEGAAAAAAAAAAA
@@JeffGeerling I was really hoping to join today but couldn't keep track of time :( but tomorrow is another day!
Hello Jeremy! Please help me how to deploy jenkins server with Ansible, your role in ansible-galaxy don't work :((
There's a problem I have on testing ansible role while in development. I can see that you always require role itself by it's name in `converge.yml` in almost all your `ansible-role-*` repos, and it causes INSTALLATION OF THE STABLE VERSION FROM GALAXY. But I don't think this is a good idea! How do you test changes then? I mean, how can you test a branch or PR then?
I believe that the best practice should be make `converge.yml` use only current state of the code of the role, where it is. Doing this way you can even run `molecule test` locally before committing and pushing anything.
And I also found that it should be something like
```
tasks:
- name: "Include this role"
include_role:
name: "ansible-role-myrole"
```
And this is how it's generated by `molecule init role`. So there are two questions I have:
1. Is there any more nice way to do the same without specifying name "ansible-role-myrole"?
2. Why don't you use this in your repos?
Thank you! :)
I got it! You intentionally create the working directory "geerlingguy.php", so the `roles: geerlingguy.php` doesn't go to the galaxy! That's a tricky!