-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathical_test.yml
39 lines (32 loc) · 1.25 KB
/
ical_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- hosts: localhost
gather_facts: no
vars:
instant: "{{ lookup('pipe','date -u +%Y-%m-%dT%H:%M:%S%z') }}"
url: 'https://calendar.google.com/calendar/ical/eonjl72kgg8ah9mip9pb23tlck%40group.calendar.google.com/public/basic.ics'
tasks:
- name: Show instant
debug:
var: instant
- name: Test with time = "{{ instant }}"
debug:
msg: "There's an event now:"
when: lookup('ical', url, instant=instant)
vars:
instant: "{{ lookup('pipe','date -u +%Y-%m-%dT%H:%M:%S%z') }}"
- name: Test with time = "{{ instant }}"
debug:
msg: "There's an event at {{ lookup('ical', url, instant=instant) }}"
when: lookup('ical', url, instant=instant)
vars:
instant: "{{ lookup('pipe','date -v+1H -u +%Y-%m-%dT%H:%M:%S%z') }}"
- name: Test with time = "{{ instant }}"
debug:
msg: "There's an event at {{ instant }}"
when: lookup('ical', url, instant=instant)
vars:
instant: "{{ lookup('pipe','date -v-30M -u +%Y-%m-%dT%H:%M:%S%z') }}"
- name: Test with time = "{{ instant }} - Now but no instant passed to filter"
debug:
msg: "There's an event now: {{ lookup('ical', url )}}"
when: lookup('ical', url)