Created
June 29, 2016 13:01
-
-
Save hyperized/426a6a481566d705458df5152540377d 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
--- | |
- hosts: localhost | |
vars: | |
hour_block_size: 4 | |
tasks: | |
# To find the nearest hour within a X (hour_block_size) hour span (nearest neighbor), sort floor | |
- set_fact: | |
block_of_hours: "{{ ( ( ansible_date_time.hour | int ) // hour_block_size ) | int }}" | |
- debug: msg="{{ [ ( block_of_hours | int ) ] | map('extract', range(0, 24, hour_block_size)) | list }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment