containers / ansible-podman-collections

Repository for Ansible content that can include playbooks, roles, modules, and plugins for use with the Podman tool
GNU General Public License v3.0
269 stars 147 forks source link

Podman collection throws when adding command #855

Closed IBims1NicerTobi closed 1 month ago

IBims1NicerTobi commented 1 month ago

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Steps to reproduce the issue:

- name: Create the satisfactory container
  containers.podman.podman_container:
    healthcheck: 'bash /healthcheck.sh'
    image: ghcr.io/wolveix/satisfactory-server:latest
    name: satisfactory
    volumes:
      - "satisfactory-config:/config"
    network:
      - "{{ podman_default_net }}"
    publish:
      - "7777:7777/udp"
      - "7777:7777/tcp"
    env:
      MAXPLAYERS: 8
      PGID: 1000
      PUID: 1000
      ROOTLESS: false
      STEAMBETA: false
      TIMEOUT: 60
    command: "/init.sh -MultiHome=100.74.179.69"
    generate_systemd:
      path: /etc/systemd/system

fatal: [aquadome]: FAILED! => {"changed": false, "module_stderr": "Shared connection to fde1:fca8:ff11:ac7c:c691:b6ff:fe53:6551 closed.\r\n", "module_stdout": "\r\nTraceback (most recent call last):\r\n File \"/home/tobias/.ansible/tmp/ansible-tmp-1727393082.4879982-47591-163728377481723/AnsiballZ_podman_container.py\", line 107, in <module>\r\n _ansiballz_main()\r\n File \"/home/tobias/.ansible/tmp/ansible-tmp-1727393082.4879982-47591-163728377481723/AnsiballZ_podman_container.py\", line 99, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/tobias/.ansible/tmp/ansible-tmp-1727393082.4879982-47591-163728377481723/AnsiballZ_podman_container.py\", line 47, in invoke_module\r\n runpy.run_module(mod_name='ansible_collections.containers.podman.plugins.modules.podman_container', init_globals=dict(_module_fqn='ansible_collections.containers.podman.plugins.modules.podman_container', _modlib_path=modlib_path),\r\n File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\r\n _run_code(code, mod_globals, init_globals,\r\n File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\r\n exec(code, run_globals)\r\n File \"/tmp/ansible_containers.podman.podman_container_payload_dx5ivqli/ansible_containers.podman.podman_container_payload.zip/ansible_collections/containers/podman/plugins/modules/podman_container.py\", line 1377, in <module>\r\n File \"/tmp/ansible_containers.podman.podman_container_payload_dx5ivqli/ansible_containers.podman.podman_container_payload.zip/ansible_collections/containers/podman/plugins/modules/podman_container.py\", line 1372, in main\r\n File \"/tmp/ansible_containers.podman.podman_container_payload_dx5ivqli/ansible_containers.podman.podman_container_payload.zip/ansible_collections/containers/podman/plugins/module_utils/podman/podman_container_lib.py\", line 1918, in execute\r\n File \"/tmp/ansible_containers.podman.podman_container_payload_dx5ivqli/ansible_containers.podman.podman_container_payload.zip/ansible_collections/containers/podman/plugins/module_utils/podman/podman_container_lib.py\", line 1822, in make_started\r\n File \"/tmp/ansible_containers.podman.podman_container_payload_dx5ivqli/ansible_containers.podman.podman_container_payload.zip/ansible_collections/containers/podman/plugins/module_utils/podman/podman_container_lib.py\", line 1580, in different\r\n File \"/tmp/ansible_containers.podman.podman_container_payload_dx5ivqli/ansible_containers.podman.podman_container_payload.zip/ansible_collections/containers/podman/plugins/module_utils/podman/podman_container_lib.py\", line 1501, in is_different\r\n File \"/tmp/ansible_containers.podman.podman_container_payload_dx5ivqli/ansible_containers.podman.podman_container_payload.zip/ansible_collections/containers/podman/plugins/module_utils/podman/podman_container_lib.py\", line 1042, in diffparam_command\r\n File \"/tmp/ansible_containers.podman.podman_container_payload_dx5ivqli/ansible_containers.podman.podman_container_payload.zip/ansible_collections/containers/podman/plugins/module_utils/podman/podman_container_lib.py\", line 1020, in _join_quotes\r\nTypeError: 'NoneType' object is not iterable\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

Describe the results you received:

The python module throws

Describe the results you expected:

The python module does not throw

Additional information you deem important (e.g. issue happens only occasionally):

Host:
$ ansible --version
ansible [core 2.17.3]
  config file = /home/tobias/.config/ansible/ansible.cfg
  configured module search path = ['/home/tobias/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /home/tobias/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.5 (main, Aug  9 2024, 08:20:41) [GCC 14.2.1 20240805] (/usr/bin/python)
  jinja version = 3.1.4
  libyaml = True
$ ansible-galaxy collection list | grep podman
containers.podman                        1.15.4
Sever:
$ python --version
Python 3.9.18
$ podman --version
podman version 4.9.4-rhel

Output of podman version:

$ podman version
Client:       Podman Engine
Version:      4.9.4-rhel
API Version:  4.9.4-rhel
Go Version:   go1.21.11 (Red Hat 1.21.11-1.el9_4)
Built:        Wed Sep  4 11:34:43 2024
OS/Arch:      linux/amd64

Output of podman info --debug:

$ podman info --debug
host:
  arch: amd64
  buildahVersion: 1.33.8
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.10-1.el9.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.10, commit: 3ea3d7f99779af0fcd69ec16c211a7dc3b4efb60'
  cpuUtilization:
    idlePercent: 97.48
    systemPercent: 0.82
    userPercent: 1.7
  cpus: 12
  databaseBackend: sqlite
  distribution:
    distribution: rocky
    version: "9.4"
  eventLogger: journald
  freeLocks: 2048
  hostname: aquadome
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.14.0-427.33.1.el9_4.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 7056683008
  memTotal: 29040672768
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.10.0-3.el9_4.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.10.0
    package: netavark-1.10.3-1.el9.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.10.3
  ociRuntime:
    name: crun
    package: crun-1.14.3-1.el9.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.14.3
      commit: 1961d211ba98f532ea52d2e80f4c20359f241a98
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  pasta:
    executable: ""
    package: ""
    version: ""
  remoteSocket:
    exists: false
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.3-1.el9.x86_64
    version: |-
      slirp4netns version 1.2.3
      commit: c22fde291bb35b354e6ca44d13be181c76a0a432
      libslirp: 4.4.0
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.2
  swapFree: 0
  swapTotal: 0
  uptime: 75h 57m 41.00s (Approximately 3.12 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.access.redhat.com
  - registry.redhat.io
  - docker.io
store:
  configFile: /home/tobias/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/tobias/.local/share/containers/storage
  graphRootAllocated: 998012657664
  graphRootUsed: 42166235136
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 0
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/tobias/.local/share/containers/storage/volumes
version:
  APIVersion: 4.9.4-rhel
  Built: 1725442483
  BuiltTime: Wed Sep  4 11:34:43 2024
  GitCommit: ""
  GoVersion: go1.21.11 (Red Hat 1.21.11-1.el9_4)
  Os: linux
  OsArch: linux/amd64
  Version: 4.9.4-rhel

Package info (e.g. output of rpm -q podman or apt list podman):

$ rpm -q podman
podman-4.9.4-10.el9_4.x86_64

Playbok you run with ansible (e.g. content of playbook.yaml):

- name: Create the satisfactory container
  containers.podman.podman_container:
    healthcheck: 'bash /healthcheck.sh'
    image: ghcr.io/wolveix/satisfactory-server:latest
    name: satisfactory
    volumes:
      - "satisfactory-config:/config"
    network:
      - "{{ podman_default_net }}"
    publish:
      - "7777:7777/udp"
      - "7777:7777/tcp"
    env:
      MAXPLAYERS: 8
      PGID: 1000
      PUID: 1000
      ROOTLESS: false
      STEAMBETA: false
      TIMEOUT: 60
    command: "/init.sh -MultiHome=100.74.179.69"
    generate_systemd:
      path: /etc/systemd/system

Command line and output of ansible run with high verbosity

log.txt

IBims1NicerTobi commented 1 month ago

Additional info:

- name: Create the satisfactory container
  containers.podman.podman_container:
    healthcheck: 'bash /healthcheck.sh'
    image: ghcr.io/wolveix/satisfactory-server:latest
    name: satisfactory
    volumes:
      - "satisfactory-config:/config"
    network:
      - "{{ podman_default_net }}"
    publish:
      - "7777:7777/udp"
      - "7777:7777/tcp"
    env:
      MAXPLAYERS: 8
      PGID: 1000
      PUID: 1000
      ROOTLESS: false
      STEAMBETA: false
      TIMEOUT: 60
    command: 
      - "/init.sh"
      - "-MultiHome=100.74.179.69"
    generate_systemd:
      path: /etc/systemd/system

Also throws

- name: Create the satisfactory container
  containers.podman.podman_container:
    healthcheck: 'bash /healthcheck.sh'
    image: ghcr.io/wolveix/satisfactory-server:latest
    name: satisfactory
    volumes:
      - "satisfactory-config:/config"
    network:
      - "{{ podman_default_net }}"
    publish:
      - "7777:7777/udp"
      - "7777:7777/tcp"
    env:
      MAXPLAYERS: 8
      PGID: 1000
      PUID: 1000
      ROOTLESS: false
      STEAMBETA: false
      TIMEOUT: 60
    generate_systemd:
      path: /etc/systemd/system

Doesn't throw

sshnaidm commented 1 month ago

Fixed in #839, please update to 1.16 version