Skip to content

Instantly share code, notes, and snippets.

@benthomasson
Forked from mkanoor/locals_in_multi.yml
Last active February 9, 2023 19:29
Show Gist options
  • Select an option

  • Save benthomasson/0ea748da615751a02e974b9fe5567f2e to your computer and use it in GitHub Desktop.

Select an option

Save benthomasson/0ea748da615751a02e974b9fe5567f2e to your computer and use it in GitHub Desktop.
---
- name: Using locals instead of events
hosts: all
sources:
- range:
limit: 5
rules:
- name: r1
condition:
all:
- assign events.abc to find event where i == 1
- assign events.saved to find fact where k is defined
- find event where i == events.saved.k
- find event where i == events.abc.i + events.m_2.i
action:
debug:
first: "{{ events.abc }}"
second: "{{ events.saved }}"
third: "{{ events.m_2 }}"
fourth: "{{ events.m_3 }}"
- name: r2
condition: event.i == 0
action:
set_fact:
fact:
k: 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment