Skip to content

Instantly share code, notes, and snippets.

@mkanoor
Created February 6, 2023 16:14
Show Gist options
  • Select an option

  • Save mkanoor/797b9acb490060c39d5d234a29ec78c6 to your computer and use it in GitHub Desktop.

Select an option

Save mkanoor/797b9acb490060c39d5d234a29ec78c6 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:
- locals.abc << event.i == 1
- locals.saved << fact.k is defined
- event.i == locals.saved.k
- event.i == locals.abc.i + locals.m_2.i
action:
debug:
first: "{{ ansible_eda.events.abc }}"
second: "{{ ansible_eda.events.saved }}"
third: "{{ ansible_eda.events.m_2 }}"
fourth: "{{ ansible_eda.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