From d2bf6486fc34b27c83b5608bfbc58746641494d6 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 2 Jun 2019 09:45:18 +0100 Subject: [PATCH] Add Ansible Molecule post --- ...riven-ansible-role-development-molecule.md | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 source/_posts/2019-06-02-test-driven-ansible-role-development-molecule.md diff --git a/source/_posts/2019-06-02-test-driven-ansible-role-development-molecule.md b/source/_posts/2019-06-02-test-driven-ansible-role-development-molecule.md new file mode 100644 index 000000000..a6afbbdb0 --- /dev/null +++ b/source/_posts/2019-06-02-test-driven-ansible-role-development-molecule.md @@ -0,0 +1,31 @@ +--- +title: Test Driven Ansible Role Development with Molecule +excerpt: ~ +tags: [ansible, molecule, testing, video] +--- +I used to maintain a number of [Ansible roles][roles], and I recently wrote one for automatically generating `settings.php` files for Drupal projects that I use for some client projects as part of the [Ansible and Ansistrano deployment process][talk], as it can populate these files with credentials stored in Ansible Vault. + +I uploaded an initial version of the role [onto GitHub][github], but haven’t yet released it onto Ansible Galaxy. + +I’d seen in other people’s roles and read elsewhere about writing automated tests for Ansible roles using a tool called [Molecule][molecule], and wanted to write some tests for this role before publishing it onto Galaxy. + +I looked around for resources about Molecule, and found a [blog post by Jeff Geerling][jeff-post], but also this YouTube video that I found very helpful. + +I’ve since been re-writing the role from scratch based on Molecule, and plan to release an official version of it soon. + +{% include 'video-embed' with { + classes: 'video-full', + video: { + id: 'DAnMyBZ8-Qs', + attr: { + height: '315', + width: '560', + } + } +} %} + +[github]: https://github.com/opdavies/ansible-role-drupal-settings +[jeff-post]: https://www.jeffgeerling.com/blog/2018/testing-your-ansible-roles-molecule +[molecule]: https://molecule.readthedocs.io +[roles]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html +[talk]: /talks/deploying-php-ansible-ansistrano