--- - hosts: '{{ host }}' # Skip gather facts - host may not exist yet gather_facts: false tasks: - name: 'import lxc_guest role on lxc_host' import_role: name='lxc_guest' vars: vm_name: '{{ inventory_hostname }}' vm_size: '{{ vm_size }}' delegate_to: '{{ ansible_lxc_host }}' - name: 'enable ssh->lxc_attach connection' set_fact: ansible_connection='ssh_lxc' - name: 'gather facts - now the host must exist' setup: tags: - 'always' - name: 'configure ssh server' import_role: name='ssh_server' - name: 'enable ssh direct connection - ssh is configured on host' set_fact: ansible_connection='ssh' ...