cancel
Showing results for 
Search instead for 
Did you mean: 
  • 6,514 Views

molecule usage for ansible development


Hi
I recently came to know about molecule which i am trying to use for ansible based automations that i am doing.

I tried looking for a topic related to molecule in this community but could not find one so thought of creating one.

Below are the points which i feel good have thoughts from this community,

1) is molecule to be used as a developement guideline framework for ansibled based automations?
2) i came to know molecule can work with various infra options like aws docker etc.
3) Will molecule tested and verified playbooks helps in onboarding those to ansible tower?

any other point that this community can contribute to understand pros and cons of molecule usage.
7 Replies
aoyawale
Mission Specialist
Mission Specialist
  • 6,495 Views

Hello,

I would say yes to all the questions. Molecule can be used to test all your roles in different infrastructure.

0 Kudos
Anthony
Mission Specialist
Mission Specialist
  • 6,465 Views

Hello,

I also agree, currently I'm using molecule for testing roles before using them in production or putting them in Tower. 

0 Kudos
bonnevil
Starfighter Starfighter
Starfighter
  • 6,418 Views

At AnsibleFest a couple of weeks ago, the presentation on the Ansible Galaxy ecosystem talked a lot about moving toward using molecule as part of the developer workflow.  Molecule would be used both to initialize roles, and then to test them (along with ansible-lint).  It's also expected that ansible-lint results will start getting applied as one content scoring factor on roles in Galaxy. I haven't worked with molecule much myself yet, though.

Galaxy had been allowed to coast for a little while, but apparently activity to improve it is heating up quite a bit.

oldbenko
Moderator
Moderator
  • 6,393 Views
Moved:

0 Kudos
DanK
Moderator
Moderator
  • 6,414 Views

In short - yes.  Molecule is a framework for testing ansible artifacts.  Both molecule and ansible-lint have been adopted by the ansible community.  I expect that in the coming months/year, there will be much better documentation, tradecraft, and integration of molecule/ansible-lint with regard to the ansible ecosystem.

In general, ansible playbooks and roles should be routinely tested, especially when changes are made to those artifacts.

Does that help? 

bonnevil
Starfighter Starfighter
Starfighter
  • 6,408 Views

Jeff Geerling (geerlingguy), one of the more prolific role developers on Ansible Galaxy, has just started to use molecule for his projects.  He posted a blog entry in the last few days that I haven't had a chance to read through yet, that you might find relevant: https://www.jeffgeerling.com/blog/2018/testing-your-ansible-roles-molecule

Upstream Ansible Galaxy development is working on a possible replacement for the current ansible-galaxy tool, called mazer.  One of the design goals is to integrate that tool into a workflow that also includes molecule and ansible-lint for development and testing.  It's still very much a tech preview, though, and things could work out differently after they experiment with it for a while.  However, both molecule and ansible-lint are now part of the Ansible community project.

Molecule docs: https://molecule.readthedocs.io/en/latest/

Molecule GitHub repository: https://github.com/ansible/molecule

 

Tags (1)
BramMertens
Flight Engineer
Flight Engineer
  • 3,527 Views

I realize this is an old post but as I'm adding molecule to some of the roles I'm developing I have run into a number of issues.

First issue is that I am unable to test roles that require additional repos to be enabled via rhsm if the container OS differs from the host.

See also my StackOverflow post on this issue . Basically enabling the "rhel-server-rhscl-7-rpms" repo using rhsm_repository in a RHEL7 UBI container on a RHEL8 host fails.

Also testing a role on Ubuntu18 in addition to RHEL7/8 failed because the Ubuntu container does not have systemd available.

RHCE 100-015-239
Join the discussion
You must log in to join this conversation.