Skip to content

Commit

Permalink
fix: podman: set podman connection information for ansible
Browse files Browse the repository at this point in the history
Ansible connection.podman.podman connection module uses ansible_host as
a container ID to connect to. Use container ID instead of IP address
which cannot be reached in rootless setup anyway.

It makes `ansible -c podman -i metadata-inventory.yaml` usable in
rootless podman setup because one cannot connect over IP addresses to
the containers as the networking bridge is not visible from the host.

Signed-off-by: Alexander Bokovoy <[email protected]>
  • Loading branch information
abbra committed Oct 10, 2024
1 parent 2774506 commit 7fd95bb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mrack/providers/podman.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ def prov_result_to_host_data(self, prov_result, req):
result["status"] = status
result["os"] = prov_result.get("mrack_req").get("os")
result["group"] = prov_result.get("mrack_req").get("group")
meta_extra = {}
meta_extra["ansible_host"] = result["id"]
result["meta_extra"] = meta_extra

return result

Expand Down

0 comments on commit 7fd95bb

Please sign in to comment.