network interface not reported from podman container

SUMMARY

The eth0 interface is not reported by the setup module when running a podman pod with a user defined network.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

setup

ANSIBLE VERSION
$ ansible --version
ansible 2.10.4
  config file = None
  configured module search path = ['/home/hashlog/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/hashlog/.local/lib/python3.9/site-packages/ansible
  executable location = /home/hashlog/.local/bin/ansible
  python version = 3.9.1 (default, Jan 20 2021, 00:00:00) [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)]
$ pip list | grep ansible
ansible-base 2.10.5
CONFIGURATION
None
OS / ENVIRONMENT

OS: Fedora 33
Podman: Version 2.2.1

STEPS TO REPRODUCE
$ podman network create testnet
$ podman run -d -ti --name pod --network=testnet centos:8 bash
$ podman exec -ti pod ip -br link
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 
eth0@if12        UP             9e:f6:ec:ec:62:b5 <BROADCAST,MULTICAST,UP,LOWER_UP> 
$ ansible all -e ansible_python_interpreter=/usr/bin/python3 -c podman -i pod, -m setup | grep -P '(ansible_lo|ansible_eth0)'
        "ansible_lo": {
        "ansible_local": {},

EXPECTED RESULTS

The setup module returns the configuration of the eth0 and the lo interface.

$ ansible all -e ansible_python_interpreter=/usr/bin/python3 -c podman -i pod, -m setup | grep -P '(ansible_lo|ansible_eth0)'
        "ansible_lo": {
        "ansible_local": {},
        "ansible_eth0": {
ACTUAL RESULTS

The setup module does not return an element for the eth0 interface. The ip of the container is reported correctly in the ansible_default_ipv4 element.

$ ansible all -e ansible_python_interpreter=/usr/bin/python3 -c podman -i pod, -m setup | grep -A 4 'ansible_default_ipv4'
        "ansible_default_ipv4": {
            "address": "10.88.4.3",
            "gateway": "10.88.4.1",
            "interface": "eth0"
        },

Verbose -vvvv output

ansible 2.10.4
  config file = None
  configured module search path = ['/home/fgierlinger/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/fgierlinger/.local/lib/python3.9/site-packages/ansible
  executable location = /home/fgierlinger/.local/bin/ansible
  python version = 3.9.1 (default, Jan 20 2021, 00:00:00) [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)]
No config file found; using defaults
setting up inventory plugins
Parsed pod, inventory source with host_list plugin
Loading callback plugin minimal of type stdout, v2.0 from /home/fgierlinger/.local/lib/python3.9/site-packages/ansible/plugins/callback/minimal.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
META: ran handlers
redirecting (type: connection) ansible.builtin.podman to containers.podman.podman
Loading collection containers.podman from /home/fgierlinger/.local/lib/python3.9/site-packages/ansible_collections/containers/podman
Using podman connection from collection
<pod> RUN [b'/usr/bin/podman', b'mount', b'pod']
Failed to mount container pod: b'Error: cannot run command "podman mount" in rootless mode, must execute `podman unshare` first'
<pod> RUN [b'/usr/bin/podman', b'exec', b'pod', b'/bin/sh', b'-c', b'echo ~ && sleep 0']
<pod> RUN [b'/usr/bin/podman', b'exec', b'pod', b'/bin/sh', b'-c', b'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1613340692.4438846-99309-83375953767261 `" && echo ansible-tmp-1613340692.4438846-99309-83375953767261="` echo /root/.ansible/tmp/ansible-tmp-1613340692.4438846-99309-83375953767261 `" ) && sleep 0']
Using module file /home/fgierlinger/.local/lib/python3.9/site-packages/ansible/modules/setup.py
<pod> PUT /home/fgierlinger/.ansible/tmp/ansible-local-99305rc97e2wj/tmppjnadphj TO /root/.ansible/tmp/ansible-tmp-1613340692.4438846-99309-83375953767261/AnsiballZ_setup.py
<pod> RUN [b'/usr/bin/podman', b'cp', b'/home/fgierlinger/.ansible/tmp/ansible-local-99305rc97e2wj/tmppjnadphj', b'pod:/root/.ansible/tmp/ansible-tmp-1613340692.4438846-99309-83375953767261/AnsiballZ_setup.py']
<pod> RUN [b'/usr/bin/podman', b'exec', b'pod', b'/bin/sh', b'-c', b'chmod u+x /root/.ansible/tmp/ansible-tmp-1613340692.4438846-99309-83375953767261/ /root/.ansible/tmp/ansible-tmp-1613340692.4438846-99309-83375953767261/AnsiballZ_setup.py && sleep 0']
<pod> RUN [b'/usr/bin/podman', b'exec', b'pod', b'/bin/sh', b'-c', b'/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1613340692.4438846-99309-83375953767261/AnsiballZ_setup.py && sleep 0']
<pod> RUN [b'/usr/bin/podman', b'exec', b'pod', b'/bin/sh', b'-c', b'rm -f -r /root/.ansible/tmp/ansible-tmp-1613340692.4438846-99309-83375953767261/ > /dev/null 2>&1 && sleep 0']
pod | SUCCESS => {

1 possible answer(s) on “network interface not reported from podman container