#!/usr/bin/env ansible-playbook --- - hosts: server roles: - networking - base - users - ssh tasks: - name: Check if host is using cloud init stat: path: /etc/cloud register: cloudinit_folder - include_role: name: cloudinit when: cloudinit_folder.stat.exists