ansible-podman-collections
ansible-podman-collections copied to clipboard
container.podman.podman_image: newline character appended to directory path causing => Error: context must be a directory
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Attempting to build container with a task that goes like this:
---
- name: Build app
containers.podman.podman_image:
name: app
path: "{{ role_path }}/files"
from a playbook that goes a little something like this:
---
- name: Provide APP
hosts: app_hosts
roles:
- { role: app }
Steps to reproduce the issue:
-
create role in roles directory
<project-dir>/roles/app
with the task as described above. -
create playbook in the playbooks directory
<project-dir>/playbooks/provideApp
with the playbook as described above -
run playbook from
<projectdir>
with:ansible-playbook ./playbooks/provideApp
Describe the results you received:
[user@host]$ ansible-playbook ./playbooks/provideAPP
PLAY [Provide APP] *****************************************************************************************************************************************
TASK [Gathering Facts] **************************************************************************************************************************************
Enter passphrase for key '/home/user/.ssh/id_ed25519':
ok: [APP_HOST]
TASK [app : Build APP] ************************************************************************************************************************************
fatal: [APP_HOST]: FAILED! => {"changed": false, "msg": "Failed to build image app:latest: Error: context must be a directory: \"/home/user/project-dir/roles/app/files\"\n"}
PLAY RECAP **************************************************************************************************************************************************
APP_HOST : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Describe the results you expected:
This image should build from the Dockerfile, and was building from the Dockerfile fine, yet now seems to be appending a new line character to the end of the directory path.
Additional information you deem important (e.g. issue happens only occasionally): This was working fine, and all of a sudden has stopped working. I've tried other directory paths and receiving the same result.
**Output of `podman version`:**
Client: Podman Engine
Version: 4.1.1
API Version: 4.1.1
Go Version: go1.18.4
Built: Sat Jul 23 07:05:59 2022
OS/Arch: linux/amd64
Output of podman info
:
host:
arch: amd64
buildahVersion: 1.26.1
cgroupControllers:
- memory
- pids
cgroupManager: systemd
cgroupVersion: v2
conmon:
package: conmon-2.1.0-2.fc36.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.1.0, commit: '
cpuUtilization:
idlePercent: 74.1
systemPercent: 5.66
userPercent: 20.24
cpus: 8
distribution:
distribution: fedora
version: "36"
eventLogger: journald
hostname: host
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.18.13-200.fc36.x86_64
linkmode: dynamic
logDriver: journald
memFree: 17736101888
memTotal: 33455050752
networkBackend: netavark
ociRuntime:
name: crun
package: crun-1.5-1.fc36.x86_64
path: /usr/bin/crun
version: |-
crun version 1.5
commit: 54ebb8ca8bf7e6ddae2eb919f5b82d1d96863dea
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
os: linux
remoteSocket:
exists: true
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.0-0.2.beta.0.fc36.x86_64
version: |-
slirp4netns version 1.2.0-beta.0
commit: 477db14a24ff1a3de3a705e51ca2c4c1fe3dda64
libslirp: 4.6.1
SLIRP_CONFIG_VERSION_MAX: 3
libseccomp: 2.5.3
swapFree: 42949664768
swapTotal: 42949664768
uptime: 25h 18m 57.19s (Approximately 1.04 days)
plugins:
log:
- k8s-file
- none
- passthrough
- journald
network:
- bridge
- macvlan
volume:
- local
registries:
search:
- registry.fedoraproject.org
- registry.access.redhat.com
- docker.io
- quay.io
store:
configFile: /home/user/.config/containers/storage.conf
containerStore:
number: 0
paused: 0
running: 0
stopped: 0
graphDriverName: overlay
graphOptions: {}
graphRoot: /home/user/.local/share/containers/storage
graphRootAllocated: 185167757312
graphRootUsed: 116324347904
graphStatus:
Backing Filesystem: xfs
Native Overlay Diff: "true"
Supports d_type: "true"
Using metacopy: "false"
imageCopyTmpDir: /var/tmp
imageStore:
number: 1
runRoot: /run/user/1000/containers
volumePath: /home/user/.local/share/containers/storage/volumes
version:
APIVersion: 4.1.1
Built: 1658516759
BuiltTime: Sat Jul 23 07:05:59 2022
GitCommit: ""
GoVersion: go1.18.4
Os: linux
OsArch: linux/amd64
Version: 4.1.1
Package info (e.g. output of rpm -q podman
or apt list podman
):
podman-4.1.1-3.fc36.x86_64
Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.): i'm running this against a vm using kvm/qemu
If Ansible is responsible for adding the newline, you'd probably be better off filing an issue against the Ansible Podman collection.
@techquila which version of Ansible Podman collection do you use? Which version did you use when it works?
@techquila can you please provide more details and context? I can't reproduce it.