Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@geekbass
Created July 31, 2018 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save geekbass/16f95f2193ad36a2e671fd8b7f648b83 to your computer and use it in GitHub Desktop.
Save geekbass/16f95f2193ad36a2e671fd8b7f648b83 to your computer and use it in GitHub Desktop.
Ansible 'when' example for playbook
---
- hosts: hosts
vars:
tasks:
- name: add filebeat yaml config for Non Agents ONLY
copy: src=filebeat.yml dest=/etc/filebeat/filebeat.yml owner=root group=root
when: "'non-agents' in group_names"
- name: add filebeat yaml config for Agents ONLY
copy: src=filebeat-agents.yml dest=/etc/filebeat/filebeat.yml owner=root group=root
when: "'agents' in group_names"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment