On 25. jan. 2017 17:40, 'Hadmut Danisch' via Ansible Project wrote:
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)
On the Ansible control machine add a remote lxd host as described here
https://www.stgraber.org/2016/04/12/lxd-2-0-remote-hosts-and-container-migration-612/
Then in you inventory file if you called the remote foo, you can do this
someserver ansible_connection=lxd ansible_host=foo:someserver
Then you can use host1 in the playbook as usual.
--
Kai Stian Olstad
--
You received this message because you are subscribed to the Google Groups "Ansible
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/89a554b9-85f4-95f8-cd21-e18b0205869c%40olstad.com.
For more options, visit https://groups.google.com/d/optout.