I have a lot of roles that I want to test via molecule
, and I'm a molecule
beginner.
If I create a molecule scenario in each role, there will be significant duplicated code.
Is there a pattern that people use to avoid have many roles with same Dockerfile.j2
, molecule.yml
, etc.
Perhaps some kind of composition (through dependency injection) or if that's not feasible some kinda inheritance?
$ molecule init role -r stackoverflow
--> Initializing new role stackoverflow...
Initialized role in /private/tmp/stackoverflow successfully.
$ tree stackoverflow
stackoverflow
├── README.md
├── defaults
│ └── main.yml
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── molecule
│ └── default
│ ├── Dockerfile.j2
│ ├── INSTALL.rst
│ ├── molecule.yml
│ ├── playbook.yml
│ └── tests
│ ├── test_default.py
│ └── test_default.pyc
├── tasks
│ └── main.yml
└── vars
└── main.yml
8 directories, 12 files