Skip to content

Instantly share code, notes, and snippets.

@justdoit0823
Created September 28, 2017 08:52
Show Gist options
  • Save justdoit0823/fe9254cf9039f0ad891b52ea45fa40e6 to your computer and use it in GitHub Desktop.
Save justdoit0823/fe9254cf9039f0ad891b52ea45fa40e6 to your computer and use it in GitHub Desktop.
Manage multiple projects witnin one playbook in ansible.
---
- name: "common task"
command: "{{item.cmd}}"
with_items:
- {cmd: "A", tag: ["projectA"]}
- {cmd: "B", tag: ["projectB"]}
when: item.tag | intersect(current_tag)
tags:
- projectA
- projectA-sub1
- projectA-sub2
- projectB
- projectB-sub1
- projectB-sub2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment