diff --git a/changelogs/fragments/3798-fix-lxd-connection-option-vars-support.yml b/changelogs/fragments/3798-fix-lxd-connection-option-vars-support.yml new file mode 100644 index 0000000000..799929a887 --- /dev/null +++ b/changelogs/fragments/3798-fix-lxd-connection-option-vars-support.yml @@ -0,0 +1,4 @@ +--- +minor_changes: + - lxd connection plugin - make sure that ``ansible_lxd_host``, ``ansible_executable``, and + ``ansible_lxd_executable`` work (https://github.com/ansible-collections/community.general/pull/3798). diff --git a/plugins/connection/lxd.py b/plugins/connection/lxd.py index 63eaf6ca51..a964932b3f 100644 --- a/plugins/connection/lxd.py +++ b/plugins/connection/lxd.py @@ -89,9 +89,9 @@ class Connection(ConnectionBase): local_cmd.extend(["--project", self.get_option("project")]) local_cmd.extend([ "exec", - "%s:%s" % (self.get_option("remote"), self._host), + "%s:%s" % (self.get_option("remote"), self.get_option("remote_addr")), "--", - self._play_context.executable, "-c", cmd + self.get_option("executable"), "-c", cmd ]) local_cmd = [to_bytes(i, errors='surrogate_or_strict') for i in local_cmd] @@ -126,7 +126,7 @@ class Connection(ConnectionBase): local_cmd.extend([ "file", "push", in_path, - "%s:%s/%s" % (self.get_option("remote"), self._host, out_path) + "%s:%s/%s" % (self.get_option("remote"), self.get_option("remote_addr"), out_path) ]) local_cmd = [to_bytes(i, errors='surrogate_or_strict') for i in local_cmd] @@ -145,7 +145,7 @@ class Connection(ConnectionBase): local_cmd.extend(["--project", self.get_option("project")]) local_cmd.extend([ "file", "pull", - "%s:%s/%s" % (self.get_option("remote"), self._host, in_path), + "%s:%s/%s" % (self.get_option("remote"), self.get_option("remote_addr"), in_path), out_path ])