{"id":15140718,"url":"https://github.com/jomrr/ansible-molecule-images","last_synced_at":"2026-04-19T00:18:49.620Z","repository":{"id":223210817,"uuid":"759607249","full_name":"jomrr/ansible-molecule-images","owner":"jomrr","description":"Ansible playbooks for building containers used to test Ansible roles with molecule.","archived":false,"fork":false,"pushed_at":"2025-12-14T01:38:26.000Z","size":42,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-15T23:40:03.776Z","etag":null,"topics":["ansible","docker-image","molecule","testing"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jomrr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-19T01:25:15.000Z","updated_at":"2025-12-14T01:38:30.000Z","dependencies_parsed_at":"2024-02-19T02:26:16.383Z","dependency_job_id":"d8874c9a-54eb-4ba9-aeb9-53d5b0a24006","html_url":"https://github.com/jomrr/ansible-molecule-images","commit_stats":null,"previous_names":["jam82/ansible-molecule-images","jomrr/ansible-molecule-images"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/jomrr/ansible-molecule-images","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jomrr%2Fansible-molecule-images","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jomrr%2Fansible-molecule-images/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jomrr%2Fansible-molecule-images/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jomrr%2Fansible-molecule-images/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jomrr","download_url":"https://codeload.github.com/jomrr/ansible-molecule-images/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jomrr%2Fansible-molecule-images/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31989341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"ssl_error","status_checked_at":"2026-04-18T20:23:29.375Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","docker-image","molecule","testing"],"created_at":"2024-09-26T08:40:23.952Z","updated_at":"2026-04-19T00:18:49.542Z","avatar_url":"https://github.com/jomrr.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ansible-molecule-images\n\n![GitHub](https://img.shields.io/github/license/jomrr/ansible-molecule-images) ![GitHub last commit](https://img.shields.io/github/last-commit/jomrr/ansible-molecule-images) ![GitHub issues](https://img.shields.io/github/issues-raw/jomrr/ansible-molecule-images)\n\nThis repository contains a Makefile, Ansible inventory and playbook for building\nDocker images running an init system for use in Ansible Molecule tests.\n\n\u003e This is the successor of the buildah scripts from [buildah-molecule-images](https://github.com/jomrr/buildah-molecule-images).\n\n## TL;DR\n\n```bash\nsudo dnf -y install git make python3 python3-pip python3-virtualenv\n\nmkdir -p ~/src/ansible \u0026\u0026 cd ~/src/ansible\n\ngit clone https://github.com/jomrr/ansible-molecule-images\n\ncd ansible-molecule-images\n\npip install --user --upgrade pip\npip install --user keyring\n\n# set docker registry user and secret, add to ~/.bashrc or ~/.bashrc.d/env\nkeyring set docker user\nkeyring set docker secret\n\n# nvim ~/.bashrc.d/env\nexport DOCKER_USER=$(keyring get docker user)\nexport DOCKER_SECRET=$(keyring get docker secret)\n\n# optionally edit containers.yml and add more registries and credentials under key push_registries.\n# nvim containers.yml\nmake install\n\nmake \u003call|almalinux|alpine|amazonlinux|archlinux|debian|fedora|opensuse|oralcelinux|ubuntu\u003e\n\n# to upgrade the virtualenv packages and ansible-galaxy dependencies run:\nmake upgrade\n```\n\n## Description\n\nThe playbook [`playbooks/build.yml`](playbooks/build.yml) utilizes the `ansible.builtin.template` module to render Dockerfiles to the directory `build/{{ inventory_hostname }}/Dockerfile` and then uses the `containers.podman,podman_image` module to build and push the images to the configured registries from the inventory file [`containers.yml`](containers.yml). In this file the registries and its credentials are listed as `list of dictionaries` under the key `push_registries`. The name of the built image is configured in `build_image` as host_var, the tags in `build_tags`, also as host_vars.\n\n## Inventory variables in [`containers.yml`](containers.yml)\n\nAny of these variables can be set at all, group or host level, where host level has the highest precedence.\n\n| variable | scope | type | default | description |\n| -------- | ----- | ---- | ------- | ----------- |\n| ansible_connection | all | str | local | defines ansible_connection=local for all inventory hosts |\n| build_image | group | str | None | name/repo of the built image, the namespace is used from `push_registries.item.username` |\n| build_maintainer | all | str | Jonas Mauer \u003c\u003cjam@kabelmail.net\u003e\u003e | build maintainer used in `MAINTAINER` and `ENV maintainer=` statement in generated Dockerfiles |\n| build_tags | host | list=str | None | tags for the built images, the first listed tag will be used in FROM statement in Dockerfile, so e.g. `[39, latest]` will use tag `39` to build the image and push it tagged as `39` and `latest` |\n| container_image | group | str | None | name of the image to use in FROM statement in generated Dockerfile |\n| container_registry | all | str | docker.io | the container registry from where an image is pulled, used in FROM statement in generated Dockerfile |\n| push_registries | all | list=dict | [ { name: docker.io, username: \"{{ lookup('ansible.builtin.env', 'DOCKER_USER') }}\", password: \"{{ lookup('ansible.builtin.env', 'DOCKER_USER') }}\" } ] | list of registriy definitions as dictionaries to where the built images are pushed |\n\n## Getting Started\n\nThis provides an overview of the prerequisites and ansible dependencies, as well as some usage examples.\n\n### Prerequisites\n\nThe following prerequisites must be installed before using this playbook.\n\n#### System packages (Fedora)\n\n\u003e The following packages need to be installed manually, adopt to your distribution as package names may vary:\n\n- `git`\n- `make`\n- `python3` \u003e= 3.6\n- `python3-pip`\n- `python3-virtualenv`\n\n#### Python (requirements.txt)\n\nThe python prerquisites are installed in a virtualenv `.venv` via the Makefile with `make install`.\n\n- ansible \u003e= 2.15\n\nTo install it manually for your user without virtualenv run:\n\n```bash\npip install --user --upgrade pip\npip install --user --upgrade ansible \u003e= 2.15\n```\n\nFor development the following are also installed by `make install`:\n\n- commitizen\n- pre-commit\n- python-semantic-release\n\n### Dependencies (requirements.yml)\n\nThe `containers.podman` collection will be installed in the virtualenv during `make install`.\n\nTo install it manually for your regular user without virtualenv run:\n\n```bash\nansible-galaxy collection install containers.podman\n```\n\nAs a requirements.yml file\n\n```yaml\n---\n# name: ansible-molecule-images\n# file: requirements.yml\n\ncollections:\n  - containers.podman\n\nroles: []\n\n```\n\nit can be installed with:\n\n```bash\nansible-galaxy install -r requiremens.yml\n```\n\n### Usage / Examples\n\n#### Build and push images for `Fedora` and `Debian`\n\nAll Fedora images are created in parallel, after completion the Debian images are created.\n\n```bash\nmake fedora debian\n```\n\n#### Build and push images for `Fedora` and `Debian` in parallel\n\nThis will make `make` run 2 jobs simultaniously, but mind the resource consumption:\n\n```bash\nmake -j 2 fedora debian\n```\n\nThis basically translates to the two commands:\n\n```bash\nansible-playbook playbooks/build.yml --limit=fedora \u0026\nansible-playbook playbooks/build.yml --limit=debian \u0026\n```\n\nThe inventory `containers.yml` is configured as static yaml inventory in `ansible.cfg` and therefore implicitly used by `ansible-playbook`.\n\n## License\n\nThis content is published under the [MIT License](LICENSE).\n\n## Author(s)\n\nThis content was created in 2024 by Jonas Mauer (@jomrr).\n\nThanks to [@fgoebel](https://github.com/fgoebel) for his contributions to [buildah-molecule-images](https://github.com/jomrr/buildah-molecule-images). They are included here. Looking forward to collaborating again.\n\n## References\n\n- [Ansible Docs - containers.podman.podman_image module](https://docs.ansible.com/ansible/latest/collections/containers/podman/podman_image_module.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjomrr%2Fansible-molecule-images","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjomrr%2Fansible-molecule-images","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjomrr%2Fansible-molecule-images/lists"}