Created
December 15, 2022 16:14
-
-
Save emorisse/d0525cf32418c7a71f239fade53f3903 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: date and time demo | |
hosts: localhost | |
connection: local | |
gather_facts: true | |
tasks: | |
- name: time of day | |
vars: | |
afternoon: 'afternoon' | |
morning: "{{ 'morning' if ansible_date_time.hour < '12' else afternoon }}" | |
period: "{{ 'evening' if ansible_date_time.hour >= '17' else morning }}" | |
debug: msg="{{ 'Good ' + period + '!' }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment