Can Ansible execute a Dockerfile on Docker to setup platforms for PXE boots?

I’d like to setup an HTTP server on a Docker image to serve as a platform for PXE booting and I don’t see a clear way for Ansible to be able to execute a Dockerfile on a local Docker instance to spawn an HTTP server. I don’t know if it’d be effective to continuously build and destroy a docker image housing this PXE boot but wanted to see if at least a setup is possible from what I specify in my Dockerfile.

Lots of ways to handle this…

What you are after is called “baremetal provisioning”. https://www.ansible.com/use-cases/provisioning

Start with reading this thread… https://www.reddit.com/r/ansible/comments/7c7lsg/install_os_on_bare_metal/

And lots of existing roles already on Ansible Galaxy to help you get started… https://galaxy.ansible.com/search?keywords=pxe&order_by=-relevance&page_size=100

As an aside, you might also want to learn about the new Ansible Container.

Introducing Ansible Container
Container users have relied on Ansible for some time to help orchestrate the process of building their containers,
but to fully automate the process of container building to production deployment still required a host of additional tooling.
Not anymore.

https://www.ansible.com/blog/ansible-container-project
https://www.ansible.com/blog/ansible-container-0-9
https://www.ansible.com/integrations/containers/ansible-container