- hosts: localhost gather_facts: false tasks: - name: Add localhost to all group if no hosts are defined ansible.builtin.add_host: name: localhost ansible_connection: "local" when: groups['all'] | length == 0 - hosts: all tasks: - ansible.builtin.import_role: name: "containers"