共享
跨场景共享¶
Playbook 和测试可以在不同场景之间共享。
$ tree shared-tests
shared-tests
├── molecule
│ ├── centos
│ │ └── molecule.yml
│ ├── resources
│ │ ├── playbooks
│ │ │ ├── Dockerfile.j2 (optional)
│ │ │ ├── create.yml
│ │ │ ├── destroy.yml
│ │ │ ├── converge.yml # <-- previously called playbook.yml
│ │ │ └── prepare.yml
│ │ └── tests
│ │ └── test_default.py
│ ├── ubuntu
│ │ └── molecule.yml
│ └── ubuntu-upstart
│ └── molecule.yml
测试和 playbook 可以在不同场景之间共享。
在此示例中,tests
目录位于共享位置,并且 molecule.yml
指向共享的测试。
在第二个示例中,动作 create
、destroy
、converge
和 prepare
从共享目录加载。