Open crossbill opened 5 years ago
I can reproduce, seems that buildah doesn't like that image:
PLAY [ansible-bender functionality] *****************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************
fatal: [new_container-20190531-100731782857-cont]: FAILED! => {"msg": "Failed to set execute bit on remote files (rc: 1, err: chmod: changing permissions of '/tmp/ansible-tm
p-1559290180.3841994-199304213862925/AnsiballZ_setup.py': Operation not permitted\nerror while running runtime: exit status 1\n)"}
PLAY RECAP ******************************************************************************************************************************************************************
new_container-20190531-100731782857-cont : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
But I when I try to play with the image, it works fine:
$ buildah from docker.io/ansible/awx_web
awx_web-working-container
$ buildah run -t awx_web-working-container -- bash
bash-4.2$ cd /tmp
bash-4.2$ ls
bash-4.2$ id
uid=1000 gid=0(root) groups=0(root)
bash-4.2$ touch /tmp/asd
bash-4.2$ chmod 0000 /tmp/asd
bash-4.2$ chmod 0777 /tmp/asd
I don't understand what's wrong.
To make things worse, the same error happens when I build as root. So this is definitely a bug, but I literally have no idea if this is bender, ansible or buildah.
I have also noticed the same, can seen the error even when run as root. I was at the impression that it was buildah, since bender was trying to run a buildah command to change permission on the folder?
since bender was trying to run a buildah command to change permission on the folder?
It's not bender, it's ansible who copies the AnsiballZ_setup.py file to /tmp in the container, then tries to change the perms and then invoke the file.
Seeing a similar error message in a issue raised in https://github.com/splunk/docker-splunk/issues/105
Wondering if this an issues with the storage driver. I recon buildah defaults to overlay and doesn't support overlay2.
To make things worse, the same error happens when I build as root. So this is definitely a bug, but I literally have no idea if this is bender, ansible or buildah.
I get around it by building a base image. Switching the user to root, Dockerfile :
FROM ansible/awx_web
USER root
To add to the confusion: I get this error while building a docker image with packer, but only if I don't use root. My molecule playbooks work just fine on the same base image (ubuntu:18.04). The prepared image's HCL file is below if you're interested.
packer {
required_plugins {
docker = {
version = ">= 0.0.7"
source = "github.com/hashicorp/docker"
}
}
}
source "docker" "ubuntu" {
image = "ubuntu:18.04"
commit = true
changes = [
"WORKDIR /home/esd",
"USER esd"
]
run_command = ["-d", "-i", "-t", "{{.Image}}", "/bin/bash"]
}
build {
name = "ubuntu"
source "source.docker.ubuntu" {
name = "development"
}
provisioner "shell" {
# Install some requirements that the ubuntu container doesn't come with.
inline = [
"apt-get update && apt-get install -y python3.6 acl",
"add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ bionic universe' && apt-get update",
"apt-get install -y python3.6 python3-pip python-urllib3 python-openssl python-pyasn1 sudo",
"useradd --groups sudo -ms /bin/bash esd",
"echo esd:redacted | chpasswd",
]
}
post-processors {
post-processor "docker-tag" {
repository = "frappe-base"
tags = ["latest"]
}
post-processor "docker-save" {
path = "prepared.tar"
}
}
}
The playbook below attempts to run some configuration on the "prepared" image above, with the esd user. It consistently fails at "Gathering Facts".
packer {
required_plugins {
docker = {
version = ">= 0.0.7"
source = "github.com/hashicorp/docker"
}
}
}
source "docker" "ubuntu" {
image = "frappe-base:latest"
pull = false
commit = true
run_command = ["-d", "-i", "-t", "{{.Image}}", "/bin/bash"]
}
build {
name = "ubuntu"
source "source.docker.ubuntu" {
name = "development"
}
provisioner "ansible" {
playbook_file = "./frappe-bench.yml"
user = "esd"
}
post-processors {
post-processor "docker-tag" {
repository = "frappe"
tags = ["latest"]
}
post-processor "docker-save" {
path = "docker.tar"
}
}
}
New to ansible-bender, was trying to create a custom awx_task/awx_web container using ansible-bender
host os: ubuntu Default installation: haven't changed any config
Am I seeing the following error message, since the original container was build as root user?
Error message:
Playbook: