if I have a machine running in an Ubuntu lxd container (without a sshd ), I can tell ansible in the inventory something like
someserver ansible_connection=lxd
which makes ansible use the lxc exec command instead of ssh. This works if the ansible and the lxd host are running on the same machine.
But how would I tell ansible to do that (without annoying delegates in every single task) to access the container if lxd is running on a different machine?
e.g.
A machine running ansible with ssh access to B
B machine running a sshd and lxd
someserver a lxd container without sshd running on B
without delegate clauses (playbook should run for different targets, not all on lxd)