Ansible: In a playbook, filter a role by tag(s) without passing at the command-line

后端 未结 2 1210
醉话见心
醉话见心 2021-02-05 00:08

In Ansible 1.7, I can use --tags from the command-line to only run a subset of that playbooks tasks.

But I\'m wanting to bake into my playbook to run a set of roles wit

相关标签:
2条回答
  • 2021-02-05 00:18

    You only have the following options with the current version of Ansible:

    1. Specify the tags on the command line
    2. Use a variable instead of a tag to conditionally run tasks
    3. Split your webserver role into multiple roles and use role dependencies for the common tasks

    This feature request has come up on the mailing list a few times and I haven't seen any indication from the dev team that it will be added as a new feature.

    0 讨论(0)
  • 2021-02-05 00:27

    The use of conditionals can meet your needs.

    You can see more information in my answer to another person's similar question here.

    0 讨论(0)
提交回复
热议问题