ansible-bender
ansible-bender copied to clipboard
Can't build simple-playbook on vagrant up
Here are some things that I found on attempting to try out ansible-bender.
I found the presence of a Vagrantfile great, as this could be useful not just for a dev environment but also for someone to try it out.
Adding this line to the Vagrantfile
config.vm.synced_folder ".", "/src"
In order to successfully build I had to:
- disable SELinux to rectify what appeared to be a
podman
issue. - run ansible-bender as root
Here is a gist for that error with SELinux enabled, as the Fedora default.
Here is the gist for the non-root ansible-bender build.
Perhaps we could put in the appropriate config to in a separate playbook for the Vagrant provision process, move the common things between that and the recipe.yml playbook into a task file to be included by both playbooks.
Happy to do up a PR on any of this.
Thanks for taking time to look into this so thoroughly. I recall I added the vagrantfile when I tested something and needed a clean VM.
I completely agree with you that the fact we have the vagrantfile could be a great opportunity for everyone to try bender in a clean environment.
Please, if you have time and motivation to do all the work you described, I'd gladly accept such pull request. Especially when there will be a clear list of steps how to do so. Not everyone is as experienced and skilful as you are!
As for the SELinux issue, I have it in the enforcing mode on my laptop and haven't noticed any issues recently. Would to be nice to get it fixed, feel free to create a dedicated issue for that, or even link to an issue in podman's tracker.
Thank you!
Definitely keen to do the work on this. I'll make the changes for the Vagrantfile first.
Question @TomasTomecek on this comment from the Vagrantfile.
# FIXME: it will fail since the playbook expects a container environment # we should fix it
Anything else that would fail, apart from the /src
folder containing the git repo code? As I think the config.vm.synced_folder
option resolves that issue.
Definitely keen to do the work on this. I'll make the changes for the Vagrantfile first.
Question @TomasTomecek on this comment from the Vagrantfile.
# FIXME: it will fail since the playbook expects a container environment # we should fix it
Anything else that would fail, apart from the
/src
folder containing the git repo code? As I think theconfig.vm.synced_folder
option resolves that issue.
Yup, sounds like that's exactly it.
Hi, I know this issue is a couple years old but I am also interested in having a VM with which I can develop and test ansible-bender.
I tried using the Vagrantfile as is but ran into a number of issues. They included:
- Downloading the fedora 30/31 VM resulted in a 404:
An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again. **The requested URL returned error: 404**
. The VMs appear to be available, but are a couple years old. Upgrading to fedora 37, I was able to download the Vagrant boxes without issue. - After upgrading the fedora box used, I noticed that several of the pre/post ansible tasks were related to the older versions of fedora. For example, using cgroups1, the container runtime being used (moby vs docker), the storage driver configuration changes and changing the cgroup driver.
- I could never get the reboot provisioning step to work. Vagrant runs the reboot and immediately tries the next provisioning step. There is a Vagrant plugin to deal with reboots, but after removing a lot of the grub configuration (that was necessary because of the older versions of fedora) - I think it's possible to get away with not rebooting.
I've taken some of the advice in this thread and updated the Vagrantfile in #286. While I still have to run ansible-bender as root in the VM to build an image using the example playbook, the tests themselves can be run on the first run of vagrant up
without issue.
Thank you for the feedback: completely agree that the vagrant setup is very outdated: I haven't used it in years.