3

当我使用 Ansible Molecule 执行功能测试时,跳过某些角色任务的最简单方法是什么?

4

2 回答 2

8

当代码由分子notestmolecule-notest.

例子:

- name: my task
  tags: notest
  shell: sudo rm -rf /
于 2019-07-26T08:59:39.273 回答
3

您可以使用 ansible-playbook 命令的附加命令行参数来跳过这样的标签:

molecule converge -- --skip-tags="<your role>"

要使用此选项,您必须首先标记您的任务,如https://stackoverflow.com/a/57216583/7066745所示

来源:https ://molecule.readthedocs.io/en/latest/usage.html

于 2020-07-03T12:22:51.387 回答