1

We inherited a project with a large ansible code base of multiple playbooks and local roles. The current structure reassembles a fairly normal ansible layout.

ansible
  playbooks
    a.yml
    b.yml
    c.yml
    d.yml
  templates
  files
  role
    role_a
    role_b
  inventory
   group_vars
     all
     test
     stage
     prod

We were looking to add some testing with molecule but looking for a layout that would accommodate multiple playbooks without too much restructuring of the repository. I've personally always set up cookie-cutter structures and layout for developing and testing a single role or a single playbook per repo but not anything to this extent. Some ideas:

  1. A scenario per playbook.
molecule
  a
  b
  c
  d
  1. One default with a rather large converge. This one sort of is a bit more concerning to me as these playbooks are not exactly very friendly to run on top of each other and it may not catch dependency problems between playbooks.

Any suggestions or experience with this would be appreciated.

user2403018
  • 297
  • 1
  • 4
  • 12
  • I would continue as if the roles where not in a monolithic repo and add molecule individually to each of them. That makes it easier to get them out in their own repo if/when you decide to refactor. – Zeitounator May 08 '21 at 07:27
  • @Zeitounator thanks, I should have mentioned more details but that is the plan with the roles to just add the common testing structure to each one. The playbooks are another beast, which is where we want to begin with a minimal form of testing (as the playbooks themselves are monolithic beasts). Any suggestions there? – user2403018 May 08 '21 at 12:15
  • 1
    I'm not sure you will like my suggestion: refactor those playbooks in roles/collections that you can correctly test with molecule. – Zeitounator May 08 '21 at 12:17
  • Lol, nope I don't like it, I love that answer. That is the long term plan for sure. – user2403018 May 08 '21 at 12:39

0 Answers0