Skip to content

Instantly share code, notes, and snippets.

@sivel
Last active Aug 16, 2021
Embed
What would you like to do?
Ansible Include Until
---
- hosts: localhost
gather_facts: false
tasks:
- include_tasks: include_me.yml
vars:
include_max: 10
- set_fact:
include_counter: "{{ include_counter|default(0)|int + 1 }}"
- block:
- command: "{{ 'false' if include_counter|int < 5 else 'true' }}"
rescue:
- include_tasks: include_me.yml
when: include_counter|int < include_max|default(10)|int
- fail:
msg: Failed to meet conditional
when: include_counter|int >= include_max|default(10)|int
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment